Diffstat (limited to 'libopie2/opiepim/core/opimrecord.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimrecord.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h index 3d774e2..63a3a98 100644 --- a/libopie2/opiepim/core/opimrecord.h +++ b/libopie2/opiepim/core/opimrecord.h | |||
@@ -1,158 +1,187 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
1 | #ifndef OPIE_PIM_RECORD_H | 29 | #ifndef OPIE_PIM_RECORD_H |
2 | #define OPIE_PIM_RECORD_H | 30 | #define OPIE_PIM_RECORD_H |
3 | 31 | ||
4 | #include <qdatastream.h> | 32 | #include <qdatastream.h> |
5 | #include <qmap.h> | 33 | #include <qmap.h> |
6 | #include <qstring.h> | 34 | #include <qstring.h> |
7 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
8 | 36 | ||
9 | /* | 37 | /* |
10 | * we need to get customMap which is private... | 38 | * we need to get customMap which is private... |
11 | */ | 39 | */ |
12 | #define private protected | 40 | #define private protected |
13 | #include <qpe/palmtoprecord.h> | 41 | #include <qpe/palmtoprecord.h> |
14 | #undef private | 42 | #undef private |
15 | 43 | ||
16 | #include <opie/opimxrefmanager.h> | 44 | #include <opie2/opimxrefmanager.h> |
17 | 45 | ||
46 | namespace Opie { | ||
18 | /** | 47 | /** |
19 | * This is the base class for | 48 | * This is the base class for |
20 | * all PIM Records | 49 | * all PIM Records |
21 | * | 50 | * |
22 | */ | 51 | */ |
23 | class OPimRecord : public Qtopia::Record { | 52 | class OPimRecord : public Qtopia::Record { |
24 | public: | 53 | public: |
25 | /** | 54 | /** |
26 | * c'tor | 55 | * c'tor |
27 | * uid of 0 isEmpty | 56 | * uid of 0 isEmpty |
28 | * uid of 1 will be assigned a new one | 57 | * uid of 1 will be assigned a new one |
29 | */ | 58 | */ |
30 | OPimRecord(int uid = 0); | 59 | OPimRecord(int uid = 0); |
31 | ~OPimRecord(); | 60 | ~OPimRecord(); |
32 | 61 | ||
33 | /** | 62 | /** |
34 | * copy c'tor | 63 | * copy c'tor |
35 | */ | 64 | */ |
36 | OPimRecord( const OPimRecord& rec ); | 65 | OPimRecord( const OPimRecord& rec ); |
37 | 66 | ||
38 | /** | 67 | /** |
39 | * copy operator | 68 | * copy operator |
40 | */ | 69 | */ |
41 | OPimRecord &operator=( const OPimRecord& ); | 70 | OPimRecord &operator=( const OPimRecord& ); |
42 | 71 | ||
43 | /** | 72 | /** |
44 | * category names resolved | 73 | * category names resolved |
45 | */ | 74 | */ |
46 | QStringList categoryNames( const QString& appname )const; | 75 | QStringList categoryNames( const QString& appname )const; |
47 | 76 | ||
48 | /** | 77 | /** |
49 | * set category names they will be resolved | 78 | * set category names they will be resolved |
50 | */ | 79 | */ |
51 | void setCategoryNames( const QStringList& ); | 80 | void setCategoryNames( const QStringList& ); |
52 | 81 | ||
53 | /** | 82 | /** |
54 | * addCategoryName adds a name | 83 | * addCategoryName adds a name |
55 | * to the internal category list | 84 | * to the internal category list |
56 | */ | 85 | */ |
57 | void addCategoryName( const QString& ); | 86 | void addCategoryName( const QString& ); |
58 | 87 | ||
59 | /** | 88 | /** |
60 | * if a Record isEmpty | 89 | * if a Record isEmpty |
61 | * it's empty if it's 0 | 90 | * it's empty if it's 0 |
62 | */ | 91 | */ |
63 | virtual bool isEmpty()const; | 92 | virtual bool isEmpty()const; |
64 | 93 | ||
65 | /** | 94 | /** |
66 | * toRichText summary | 95 | * toRichText summary |
67 | */ | 96 | */ |
68 | virtual QString toRichText()const = 0; | 97 | virtual QString toRichText()const = 0; |
69 | 98 | ||
70 | /** | 99 | /** |
71 | * a small one line summary | 100 | * a small one line summary |
72 | */ | 101 | */ |
73 | virtual QString toShortText()const = 0; | 102 | virtual QString toShortText()const = 0; |
74 | 103 | ||
75 | /** | 104 | /** |
76 | * the name of the Record | 105 | * the name of the Record |
77 | */ | 106 | */ |
78 | virtual QString type()const = 0; | 107 | virtual QString type()const = 0; |
79 | 108 | ||
80 | /** | 109 | /** |
81 | * matches the Records the regular expression? | 110 | * matches the Records the regular expression? |
82 | */ | 111 | */ |
83 | virtual bool match( const QString ®exp ) const | 112 | virtual bool match( const QString ®exp ) const |
84 | {setLastHitField( -1 ); | 113 | {setLastHitField( -1 ); |
85 | return Qtopia::Record::match(QRegExp(regexp));}; | 114 | return Qtopia::Record::match(QRegExp(regexp));}; |
86 | 115 | ||
87 | /** | 116 | /** |
88 | * if implemented this function returns which item has been | 117 | * if implemented this function returns which item has been |
89 | * last hit by the match() function. | 118 | * last hit by the match() function. |
90 | * or -1 if not implemented or no hit has occured | 119 | * or -1 if not implemented or no hit has occured |
91 | */ | 120 | */ |
92 | int lastHitField()const; | 121 | int lastHitField()const; |
93 | 122 | ||
94 | /** | 123 | /** |
95 | * converts the internal structure to a map | 124 | * converts the internal structure to a map |
96 | */ | 125 | */ |
97 | virtual QMap<int, QString> toMap()const = 0; | 126 | virtual QMap<int, QString> toMap()const = 0; |
98 | // virtual fromMap( const <int, QString>& map ) = 0; // Should be added in the future (eilers) | 127 | // virtual fromMap( const <int, QString>& map ) = 0; // Should be added in the future (eilers) |
99 | 128 | ||
100 | /** | 129 | /** |
101 | * key value representation of extra items | 130 | * key value representation of extra items |
102 | */ | 131 | */ |
103 | QMap<QString, QString> toExtraMap()const; | 132 | QMap<QString, QString> toExtraMap()const; |
104 | void setExtraMap( const QMap<QString, QString>& ); | 133 | void setExtraMap( const QMap<QString, QString>& ); |
105 | 134 | ||
106 | /** | 135 | /** |
107 | * the name for a recordField | 136 | * the name for a recordField |
108 | */ | 137 | */ |
109 | virtual QString recordField(int)const = 0; | 138 | virtual QString recordField(int)const = 0; |
110 | 139 | ||
111 | /** | 140 | /** |
112 | * returns a reference of the | 141 | * returns a reference of the |
113 | * Cross Reference Manager | 142 | * Cross Reference Manager |
114 | * Partner 'One' is THIS PIM RECORD! | 143 | * Partner 'One' is THIS PIM RECORD! |
115 | * 'Two' is the Partner where we link to | 144 | * 'Two' is the Partner where we link to |
116 | */ | 145 | */ |
117 | OPimXRefManager& xrefmanager(); | 146 | OPimXRefManager& xrefmanager(); |
118 | 147 | ||
119 | /** | 148 | /** |
120 | * set the uid | 149 | * set the uid |
121 | */ | 150 | */ |
122 | virtual void setUid( int uid ); | 151 | virtual void setUid( int uid ); |
123 | 152 | ||
124 | /* | 153 | /* |
125 | * used inside the Templates for casting | 154 | * used inside the Templates for casting |
126 | * REIMPLEMENT in your .... | 155 | * REIMPLEMENT in your .... |
127 | */ | 156 | */ |
128 | static int rtti(); | 157 | static int rtti(); |
129 | 158 | ||
130 | /** | 159 | /** |
131 | * some marshalling and de marshalling code | 160 | * some marshalling and de marshalling code |
132 | * saves the OPimRecord | 161 | * saves the OPimRecord |
133 | * to and from a DataStream | 162 | * to and from a DataStream |
134 | */ | 163 | */ |
135 | virtual bool loadFromStream(QDataStream& ); | 164 | virtual bool loadFromStream(QDataStream& ); |
136 | virtual bool saveToStream( QDataStream& stream )const; | 165 | virtual bool saveToStream( QDataStream& stream )const; |
137 | 166 | ||
138 | protected: | 167 | protected: |
139 | // need to be const cause it is called from const methods | 168 | // need to be const cause it is called from const methods |
140 | mutable int m_lastHit; | 169 | mutable int m_lastHit; |
141 | void setLastHitField( int lastHit )const; | 170 | void setLastHitField( int lastHit )const; |
142 | Qtopia::UidGen &uidGen(); | 171 | Qtopia::UidGen &uidGen(); |
143 | // QString crossToString()const; | 172 | // QString crossToString()const; |
144 | 173 | ||
145 | private: | 174 | private: |
146 | class OPimRecordPrivate; | 175 | class OPimRecordPrivate; |
147 | OPimRecordPrivate *d; | 176 | OPimRecordPrivate *d; |
148 | OPimXRefManager m_xrefman; | 177 | OPimXRefManager m_xrefman; |
149 | static Qtopia::UidGen m_uidGen; | 178 | static Qtopia::UidGen m_uidGen; |
150 | 179 | ||
151 | private: | 180 | private: |
152 | void flush( const OPimXRefPartner&, QDataStream& stream )const; | 181 | void flush( const OPimXRefPartner&, QDataStream& stream )const; |
153 | OPimXRefPartner partner( QDataStream& ); | 182 | OPimXRefPartner partner( QDataStream& ); |
154 | }; | 183 | }; |
155 | 184 | ||
156 | 185 | } | |
157 | 186 | ||
158 | #endif | 187 | #endif |