pilotDOCEntry.cc
00001
00002
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 #include "options.h"
00030 #include "pilotDOCEntry.h"
00031
00032
00033
00034 static const char *pilotDOCEntry_id =
00035 "$Id: pilotDOCEntry.cc,v 1.4 2003/03/08 01:43:05 waba Exp $";
00036 const int PilotDOCEntry::TEXT_SIZE = 4096;
00037
00038
00039 PilotDOCEntry::PilotDOCEntry():PilotAppCategory()
00040 {
00041 FUNCTIONSETUP;
00042 compress = false;
00043 }
00044
00045
00046
00047
00048
00049 PilotDOCEntry::PilotDOCEntry(PilotRecord * rec, bool compressed):PilotAppCategory(rec)
00050 {
00051 if (rec) fText.setText((unsigned char *) rec->getData(), rec->getLen(), compressed);
00052 compress = compressed;
00053 (void) pilotDOCEntry_id;
00054 }
00055
00056
00057
00058 PilotDOCEntry::PilotDOCEntry(const PilotDOCEntry & e):PilotAppCategory(e)
00059 {
00060 FUNCTIONSETUP;
00061
00062 fText.setText(e.fText.text(), e.fText.Len(), e.fText.compressed());
00063 compress = e.compress;
00064 }
00065
00066
00067
00068 PilotDOCEntry & PilotDOCEntry::operator =(const PilotDOCEntry & e)
00069 {
00070 if (this != &e)
00071 {
00072 fText.setText(e.fText.text(), e.fText.Len(), e.fText.compressed());
00073 compress = e.compress;
00074 }
00075 return *this;
00076 }
00077
00078
00079
00080 void *PilotDOCEntry::pack(void *buf, int *len)
00081 {
00082
00083 if (compress)
00084 {
00085 *len = fText.Compress();
00086 }
00087 else
00088 {
00089 *len = fText.Decompress();
00090 }
00091 if (len > 0)
00092 {
00093
00094 memcpy(buf, (const char *) fText.text(), *len);
00095 return buf;
00096 }
00097 return 0L;
00098 }
00099
00100
This file is part of the documentation for kpilot Library Version 3.2.2.