pilotDOCHead.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 #include "options.h"
00029 #include "pilotDOCHead.h"
00030
00031 #include "makedoc9.h"
00032
00033
00034
00035 static const char *pilotDOCHead_id =
00036 "$Id: pilotDOCHead.cc,v 1.3 2003/03/08 01:43:05 waba Exp $";
00037 const int PilotDOCHead::textRecordSize = 4096;
00038
00039
00040
00041 PilotDOCHead::PilotDOCHead():PilotAppCategory(),
00042 version(0),
00043 spare(0), storyLen(0), numRecords(0), recordSize(textRecordSize), position(0)
00044 {
00045 FUNCTIONSETUP;
00046 (void) pilotDOCHead_id;
00047 }
00048
00049
00050
00051
00052
00053 PilotDOCHead::PilotDOCHead(PilotRecord * rec):PilotAppCategory(rec)
00054 {
00055 unpack((const void *) rec->getData());
00056 }
00057
00058
00059 PilotDOCHead::PilotDOCHead(const PilotDOCHead & e):PilotAppCategory(e)
00060 {
00061 FUNCTIONSETUP;
00062 *this = e;
00063 }
00064
00065
00066
00067 PilotDOCHead & PilotDOCHead::operator =(const PilotDOCHead & e)
00068 {
00069 if (this != &e)
00070 {
00071 version = e.version;
00072 spare = e.spare;
00073 storyLen = e.storyLen;
00074 numRecords = e.numRecords;
00075 recordSize = e.recordSize;
00076 position = e.position;
00077 }
00078 return *this;
00079 }
00080
00081
00082
00083 void *PilotDOCHead::pack(void *buf, int *len)
00084 {
00085 char *tmp = (char *) buf;
00086
00087 *len = 16;
00088 set_short(tmp, version);
00089 tmp+=2;
00090 set_short(tmp, spare);
00091 tmp+=2;
00092 set_long(tmp, storyLen);
00093 tmp+=4;
00094 set_short(tmp, numRecords);
00095 tmp+=2;
00096 set_short(tmp, recordSize);
00097 tmp+=2;
00098 set_short(tmp, position);
00099 return buf;
00100 }
00101
00102
00103 void PilotDOCHead::unpack(const void *buf, int)
00104 {
00105 char *tmp = (char *) buf;
00106
00107 version = get_short(tmp);
00108 tmp+=2;
00109 spare = get_short(tmp);
00110 tmp+=2;
00111 storyLen = get_long(tmp);
00112 tmp+=4;
00113 numRecords = get_short(tmp);
00114 tmp+=2;
00115 recordSize = get_short(tmp);
00116 tmp+=2;
00117 position = get_long(tmp);
00118 }
00119
This file is part of the documentation for kpilot Library Version 3.2.2.