pilotAppCategory.h
00001 #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
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <qstring.h>
00040
00041 #include "pilotRecord.h"
00042
00043 class QTextCodec;
00044
00045 class PilotAppCategory
00046 {
00047 protected:
00048 int fAttrs;
00049 recordid_t fId;
00050
00059 int fCategory;
00060
00061 virtual void *pack(void *, int *) = 0;
00062 virtual void unpack(const void *, int = 0) = 0;
00063
00064
00065 public:
00066 PilotAppCategory(void) :
00067 fAttrs(0),
00068 fId(0),
00069 fCategory(0)
00070 {} ;
00071
00072 PilotAppCategory(int a, recordid_t i, int c) :
00073 fAttrs(a),
00074 fId(i),
00075 fCategory(c)
00076 {} ;
00077
00078 PilotAppCategory(PilotRecord* rec) :
00079 fAttrs((rec)?rec->getAttrib():0),
00080 fId((rec)?rec->getID():0),
00081 fCategory((rec)?rec->getCat():0)
00082 {} ;
00083
00084 PilotAppCategory(const PilotAppCategory ©From) :
00085 fAttrs(copyFrom.fAttrs),
00086 fId(copyFrom.fId),
00087 fCategory(copyFrom.fCategory)
00088 {} ;
00089
00090 PilotAppCategory& operator=( const PilotAppCategory &r )
00091 {
00092 fAttrs = r.fAttrs;
00093 fId = r.fId;
00094 fCategory = r.fCategory;
00095 return *this;
00096 } ;
00097
00098 bool operator==(const PilotAppCategory &compareTo)
00099 {
00100 return (fAttrs==compareTo.fAttrs && fId==compareTo.fId && fCategory==compareTo.fCategory);
00101 } ;
00102
00103 virtual ~PilotAppCategory(void) {};
00104
00108 virtual PilotRecord* pack()
00109 {
00110 int len = 0xffff;
00111 void* buff = new unsigned char[len];
00112 pack(buff, &len);
00113 PilotRecord* rec = new PilotRecord(buff, len, getAttrib(), getCat(), id());
00114 delete [] (unsigned char*)buff;
00115 return rec;
00116 }
00117
00118 int getAttrib(void) const { return fAttrs; }
00119 int getCat(void) const { return fCategory; }
00120 void setCat(int cat) { fCategory = cat; }
00121 recordid_t id(void) const { return fId; }
00122 recordid_t getID() { return id(); }
00123 recordid_t getID() const { return id(); }
00124 void setID(recordid_t id) { fId = id; }
00125 void setAttrib(int attrib) { fAttrs = attrib; }
00126
00127 virtual QString getTextRepresentation(bool=false) {return i18n("Unknown record type");};
00128
00129 public:
00130 bool isSecret() const { return fAttrs & dlpRecAttrSecret ; } ;
00131 bool isDeleted() const { return fAttrs & dlpRecAttrDeleted ; } ;
00132 bool isArchived() const { return fAttrs & dlpRecAttrArchived ; } ;
00133 void makeSecret() { fAttrs |= dlpRecAttrSecret; } ;
00134 void makeDeleted() { fAttrs |= dlpRecAttrDeleted ; } ;
00135 void makeArchived() { fAttrs |= dlpRecAttrArchived ; } ;
00136 bool isModified() const { return fAttrs & dlpRecAttrDirty; }
00137
00138 protected:
00139 static QTextCodec *pilotCodec;
00140 public:
00141 static QTextCodec *codec()
00142 { if (pilotCodec) return pilotCodec; else return createCodec(0L); } ;
00143 static QTextCodec *createCodec(const char *);
00144 static QTextCodec *setupPilotCodec(const QString &);
00145 static QString codecName();
00146 };
00147
00148 #endif
This file is part of the documentation for kpilot Library Version 3.2.2.