kpilot Library API Documentation

pilotDOCEntry.cc

00001 /* pilotDOCEntry.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 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 /* initialize the entry from another one. If rec==NULL, this constructor does the same as PilotDOCEntry() 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 // See PilotDateEntry::operator = for details 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 // int len; 00083 if (compress) 00084 { 00085 *len = fText.Compress(); 00086 } 00087 else 00088 { 00089 *len = fText.Decompress(); 00090 } 00091 if (len > 0) 00092 { 00093 // char*out=new char[len]; 00094 memcpy(buf, (const char *) fText.text(), *len); 00095 return buf; 00096 } 00097 return 0L; 00098 } 00099 00100
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