opimrecord.h
Go to the documentation of this file.00001 #ifndef OPIE_PIM_RECORD_H 00002 #define OPIE_PIM_RECORD_H 00003 00004 #include <qdatastream.h> 00005 #include <qmap.h> 00006 #include <qstring.h> 00007 #include <qstringlist.h> 00008 00009 /* 00010 * we need to get customMap which is private... 00011 */ 00012 #define private protected 00013 #include <qpe/palmtoprecord.h> 00014 #undef private 00015 00016 #include <opie/opimxrefmanager.h> 00017 00023 class OPimRecord : public Qtopia::Record { 00024 public: 00030 OPimRecord(int uid = 0); 00031 ~OPimRecord(); 00032 00036 OPimRecord( const OPimRecord& rec ); 00037 00041 OPimRecord &operator=( const OPimRecord& ); 00042 00046 QStringList categoryNames( const QString& appname )const; 00047 00051 void setCategoryNames( const QStringList& ); 00052 00057 void addCategoryName( const QString& ); 00058 00063 virtual bool isEmpty()const; 00064 00068 virtual QString toRichText()const = 0; 00069 00073 virtual QString toShortText()const = 0; 00074 00078 virtual QString type()const = 0; 00079 00083 virtual bool match( const QString ®exp ) const 00084 {setLastHitField( -1 ); 00085 return Qtopia::Record::match(QRegExp(regexp));}; 00086 00092 int lastHitField()const; 00093 00097 virtual QMap<int, QString> toMap()const = 0; 00098 // virtual fromMap( const <int, QString>& map ) = 0; // Should be added in the future (eilers) 00099 00103 QMap<QString, QString> toExtraMap()const; 00104 void setExtraMap( const QMap<QString, QString>& ); 00105 00109 virtual QString recordField(int)const = 0; 00110 00117 OPimXRefManager& xrefmanager(); 00118 00122 virtual void setUid( int uid ); 00123 00124 /* 00125 * used inside the Templates for casting 00126 * REIMPLEMENT in your .... 00127 */ 00128 static int rtti(); 00129 00135 virtual bool loadFromStream(QDataStream& ); 00136 virtual bool saveToStream( QDataStream& stream )const; 00137 00138 protected: 00139 // need to be const cause it is called from const methods 00140 mutable int m_lastHit; 00141 void setLastHitField( int lastHit )const; 00142 Qtopia::UidGen &uidGen(); 00143 // QString crossToString()const; 00144 00145 private: 00146 class OPimRecordPrivate; 00147 OPimRecordPrivate *d; 00148 OPimXRefManager m_xrefman; 00149 static Qtopia::UidGen m_uidGen; 00150 00151 private: 00152 void flush( const OPimXRefPartner&, QDataStream& stream )const; 00153 OPimXRefPartner partner( QDataStream& ); 00154 }; 00155 00156 00157 00158 #endif
