kpilot/lib
pilotAppCategory.h00001 #ifndef _KPILOT_PILOTAPPCATEGORY_H
00002 #define _KPILOT_PILOTAPPCATEGORY_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00041 #include <qstring.h>
00042 #include <klocale.h>
00043
00044 #include <pi-appinfo.h>
00045
00046 #include "pilotRecord.h"
00047
00048 class QTextCodec;
00049
00060 class KDE_EXPORT PilotAppCategory : public PilotRecordBase
00061 {
00062 protected:
00076 virtual void *pack_(void *buf, int *size) = 0;
00077
00081 virtual void unpack(const void *buf, int size) = 0;
00082
00083
00084 public:
00089 PilotAppCategory(int a=0, recordid_t i=0, int c=0) :
00090 PilotRecordBase(a,c,i)
00091 {} ;
00092
00096 PilotAppCategory(const PilotRecord* rec) :
00097 PilotRecordBase( ((rec)?rec->attributes():0),
00098 ((rec)?rec->category():0),
00099 ((rec)?rec->id():0)
00100 )
00101 {} ;
00102
00104 PilotAppCategory(const PilotAppCategory ©From) :
00105 PilotRecordBase(copyFrom.attributes(),
00106 copyFrom.id(),
00107 copyFrom.category() )
00108 {} ;
00109
00111 PilotAppCategory& operator=( const PilotAppCategory &r )
00112 {
00113 setAttributes( r.attributes() );
00114 setID( r.id() );
00115 setCategory( r.category() );
00116 return *this;
00117 } ;
00118
00122 bool operator==(const PilotAppCategory &compareTo)
00123 {
00124 return (attributes() ==compareTo.attributes() &&
00125 id() ==compareTo.id() &&
00126 category() ==compareTo.category() );
00127 } ;
00128
00130 virtual ~PilotAppCategory(void) {};
00131
00136 virtual PilotRecord* pack();
00137
00144 virtual QString getTextRepresentation(bool rt=false)
00145 { Q_UNUSED(rt); return i18n("Unknown record type"); }
00146
00151 void setCategory( int c ) { return PilotRecordBase::setCategory(c); }
00160 bool setCategory(struct CategoryAppInfo &info,const QString &label);
00161 bool KDE_DEPRECATED setCat(struct CategoryAppInfo &info,const QString &label)
00162 { return setCategory(info,label); }
00163
00164 protected:
00165 static QTextCodec *pilotCodec;
00166 public:
00172 static QString fromPilot( const char *c, int len );
00173
00179 static int toPilot( const QString &s, char *buf, int len);
00180
00184 static QTextCodec *codec()
00185 { if (pilotCodec) return pilotCodec; else return setupPilotCodec(QString::null); } ;
00191 static QTextCodec *setupPilotCodec(const QString &name);
00193 static QString codecName();
00194 };
00195
00196
00197
00198 #endif
|