kpilot Library API Documentation

pilotDOCHead.cc

00001 /* pilotDOCHead.cc KPilot 00002 ** 00003 ** Copyright (C) 2002 by Reinhold Kainhofer 00004 ** 00005 ** This is a C++ class dealing with PalmDOC text records 00006 */ 00007 00008 /* 00009 ** This program is free software; you can redistribute it and/or modify 00010 ** it under the terms of the GNU General Public License as published by 00011 ** the Free Software Foundation; either version 2 of the License, or 00012 ** (at your option) any later version. 00013 ** 00014 ** This program is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program in a file called COPYING; if not, write to 00021 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00022 ** MA 02111-1307, USA. 00023 */ 00024 00025 /* 00026 ** Bug reports and questions can be sent to kde-pim@kde.org 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 /* initialize the entry from another one. If rec==NULL, this constructor does the same as PilotDOCHead() 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
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003