Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opimrecord.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003                              Copyright (C) The Main Author <main-author@whereever.org>
00004               =.             Copyright (C) The Opie Team <opie-devel@handhelds.org>
00005             .=l.
00006            .>+-=
00007  _;:,     .>    :=|.         This program is free software; you can
00008 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00009 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00010 .="- .-=="i,     .._         License as published by the Free Software
00011  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00012      ._= =}       :          or (at your option) any later version.
00013     .%`+i>       _;_.
00014     .i_,=:_.      -<s.       This program is distributed in the hope that
00015      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00016     : ..    .:,     . . .    without even the implied warranty of
00017     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00018   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00019 ..}^=.=       =       ;      Library General Public License for more
00020 ++=   -.     .`     .:       details.
00021  :     =  ...= . :.=-
00022  -.   .:....=;==+<;          You should have received a copy of the GNU
00023   -_. . .   )=.  =           Library General Public License along with
00024     --        :-=`           this library; see the file COPYING.LIB.
00025                              If not, write to the Free Software Foundation,
00026                              Inc., 59 Temple Place - Suite 330,
00027                              Boston, MA 02111-1307, USA.
00028 */
00029 
00030 #ifndef OPIMRECORD_H
00031 #define OPIMRECORD_H
00032 
00033 /* OPIE */
00034 #include <opie2/opimxrefmanager.h>
00035 #include <opie2/opimglobal.h>
00036 
00037 /*
00038  * we need to get customMap which is private...
00039  */
00040 #define private protected
00041 #include <qpe/palmtoprecord.h>
00042 #undef private
00043 
00044 /* QT */
00045 #include <qdatastream.h>
00046 #include <qmap.h>
00047 #include <qstring.h>
00048 #include <qstringlist.h>
00049 
00050 namespace Opie
00051 {
00057 class OPimRecord : public Qtopia::Record
00058 {
00059   public:
00065     OPimRecord( UID uid = 0 );
00066     ~OPimRecord();
00067 
00071     OPimRecord( const OPimRecord& rec );
00072 
00076     OPimRecord &operator=( const OPimRecord& );
00077 
00081     QStringList categoryNames( const QString& appname ) const;
00082 
00086     void setCategoryNames( const QStringList& );
00087 
00092     void addCategoryName( const QString& );
00093 
00098     virtual bool isEmpty() const;
00099 
00103     virtual QString toRichText() const = 0;
00104 
00108     virtual QString toShortText() const = 0;
00109 
00113     virtual QString type() const = 0;
00114 
00118     virtual bool match( const QString &regexp ) const
00119     {
00120         setLastHitField( -1 );
00121         return Qtopia::Record::match( QRegExp( regexp ) );
00122     };
00123 
00129     int lastHitField() const;
00130 
00134     virtual QMap<int, QString> toMap() const = 0;
00135     // virtual fromMap( const <int, QString>& map ) = 0; // Should be added in the future (eilers)
00136 
00140     QMap<QString, QString> toExtraMap() const;
00141     void setExtraMap( const QMap<QString, QString>& );
00142 
00144 
00147     virtual QString           recordField( int )    const = 0;
00148 //    virtual QArray<int>       recordAttributes()const = 0;
00149 //    virtual QMap<int,QString> recordAttributesTranslated() const = 0;
00150 //    QString                   recordAttributeTranslated(int field)const;
00152 
00159     OPimXRefManager& xrefmanager();
00160 
00164     virtual void setUid( int uid );
00165 
00166     /*
00167      * used inside the Templates for casting
00168      * REIMPLEMENT in your ....
00169      */
00170     virtual int rtti() const;
00171 
00177     virtual bool loadFromStream( QDataStream& );
00178     virtual bool saveToStream( QDataStream& stream ) const;
00179 
00180   protected:
00181     // need to be const cause it is called from const methods
00182     mutable int m_lastHit;
00183     void setLastHitField( int lastHit ) const;
00184     Qtopia::UidGen &uidGen();
00185     //    QString crossToString()const;
00186 
00187   private:
00188     class OPimRecordPrivate;
00189     OPimRecordPrivate *d;
00190     OPimXRefManager m_xrefman;
00191     static Qtopia::UidGen m_uidGen;
00192 
00193   private:
00194     void flush( const OPimXRefPartner&, QDataStream& stream ) const;
00195     OPimXRefPartner partner( QDataStream& );
00196 };
00197 
00198 }
00199 
00200 #endif

Generated on Sat Nov 5 16:16:21 2005 for OPIE by  doxygen 1.4.2