kpilot
pilotDOCEntry.ccGo to the documentation of this file.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 const int PilotDOCEntry::TEXT_SIZE = 4096;
00035
00036
00037 PilotDOCEntry::PilotDOCEntry():PilotRecordBase()
00038 {
00039 FUNCTIONSETUP;
00040 compress = false;
00041 }
00042
00043
00044
00045
00046
00047 PilotDOCEntry::PilotDOCEntry(PilotRecord * rec, bool compressed):PilotRecordBase(rec)
00048 {
00049 if (rec) fText.setText((unsigned char *) rec->data(), rec->size(), compressed);
00050 compress = compressed;
00051 }
00052
00053
00054
00055 PilotDOCEntry::PilotDOCEntry(const PilotDOCEntry & e):PilotRecordBase(e)
00056 {
00057 FUNCTIONSETUP;
00058
00059 fText.setText(e.fText.text(), e.fText.Len(), e.fText.compressed());
00060 compress = e.compress;
00061 }
00062
00063
00064
00065 PilotDOCEntry & PilotDOCEntry::operator =(const PilotDOCEntry & e)
00066 {
00067 if (this != &e)
00068 {
00069 fText.setText(e.fText.text(), e.fText.Len(), e.fText.compressed());
00070 compress = e.compress;
00071 }
00072 return *this;
00073 }
00074
00075
00076
00077
00078 PilotRecord *PilotDOCEntry::pack()
00079 {
00080 int len = compress ? fText.Compress() : fText.Decompress();
00081
00082 if (len<0)
00083 {
00084 return 0L;
00085 }
00086
00087 pi_buffer_t *b = pi_buffer_new( len + 4 );
00088 memcpy( b->data, (const char *) fText.text(), len );
00089 b->used = len;
00090 PilotRecord* rec = new PilotRecord(b, this);
00091 return rec;
00092 }
|