aboutsummaryrefslogtreecommitdiff
path: root/deskutils/kdepim4/files/patch-kmailcvt-filters.hxx
blob: 44a41ff100076971aa8f7884382c57b0e9fd2b22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Index: filters.hxx
===================================================================
--- kmailcvt/filters.hxx	(revision 427509)
+++ kmailcvt/filters.hxx	(working copy)
@@ -86,7 +86,58 @@
     QString m_info;
 };
 
+/** Glorified QString[N] for (a) understandability (b) older gcc
+*   compatibility, see for instance 
+* http://mail.kde.org/pipermail/kmail-devel/2005-April/017690.html
+*/
+template <unsigned int size> class FolderStructureBase
+{
+public:
+	typedef QString NString[size];
+	/** Constructor. Need a default constructor for QValueList. */
+	FolderStructureBase() {} ;
 
+	/** Constructor. Turn N QStrings into a folder structure 
+	*   description. 
+	*/
+	FolderStructureBase(const NString &s)
+	{
+	    for(unsigned int i=0; i<size; i++) d[i]=s[i];
+	} ;
+
+	/** Copy Constructor. */
+	FolderStructureBase(const FolderStructureBase &s)
+	{
+	    for(unsigned int i=0; i<size; i++) d[i]=s[i];
+	} ;
+
+	/** Assignment operator. Does the same thing as 
+	*   the copy constructor.
+	*/
+	FolderStructureBase &operator =(const FolderStructureBase &s)
+	{
+	    for(unsigned int i=0; i<size; i++) d[i]=s[i];
+	    return *this;
+	} ;
+
+	/** Access the different fields. There doesn't seem to
+	*   be a real semantics for the fields.
+	*/
+	const QString operator [](unsigned int i) const
+	{
+	    if (i<size) return d[i]; else return QString::null;
+	} ;
+
+	/** Access the different fields, for writing. */
+	QString &operator [](unsigned int i)
+	{
+	    Q_ASSERT(i<size);
+	    if (i<size) return d[i]; else return d[0];
+	} ;
+private:
+	QString d[size];
+} ;
+
 #endif
 
 // vim: ts=2 sw=2 et