kpilot Library API Documentation

pilotDOCBookmark.cc

00001 /* pilotDOCBookmark.cc          KPilot
00002 **
00003 ** Copyright (C) 2002 by Reinhold Kainhofer
00004 **
00005 ** This is a C++ class for the DOC bookmark record structure
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 "pilotDOCBookmark.h"
00031 
00032 
00033 
00034 static const char *pilotDOCBookmark_id =
00035     "$Id: pilotDOCBookmark.cc,v 1.3 2003/03/08 01:43:05 waba Exp $";
00036 
00037 
00038 
00039 PilotDOCBookmark::PilotDOCBookmark():PilotAppCategory(), pos(0)
00040 {
00041     FUNCTIONSETUP;
00042     memset(&bookmarkName[0], 0, 16);
00043 }
00044 
00045 
00046 
00047 /* initialize the entry from another one. If rec==NULL, this constructor does the same as PilotDOCBookmark()
00048 */
00049 PilotDOCBookmark::PilotDOCBookmark(PilotRecord * rec):PilotAppCategory(rec)
00050 {
00051     if (rec)
00052     {
00053         strncpy(&bookmarkName[0], (char *) rec->getData(), 16);
00054         bookmarkName[16]='\0';
00055         pos = get_long(&rec->getData()[16]);// << 8 + (rec->getData())[17];
00056     }
00057     (void) pilotDOCBookmark_id;
00058 }
00059 
00060 
00061 
00062 PilotDOCBookmark::
00063 PilotDOCBookmark(const PilotDOCBookmark & e):PilotAppCategory(e)
00064 {
00065     FUNCTIONSETUP;
00066     *this = e;
00067 }
00068 
00069 
00070 
00071 PilotDOCBookmark & PilotDOCBookmark::operator =(const PilotDOCBookmark & e)
00072 {
00073     if (this != &e)
00074     {
00075         strncpy(&bookmarkName[0], &e.bookmarkName[0], 16);
00076         bookmarkName[16]='\0';
00077         pos = e.pos;
00078     }
00079     return *this;
00080 }
00081 
00082 
00083 
00084 void *PilotDOCBookmark::pack(void *buf, int *len)
00085 {
00086     char *tmp = (char *) buf;
00087 
00088 //  buf=malloc(16*sizeof(char)+sizeof(long int));
00089     strncpy(tmp, &bookmarkName[0], 16);
00090     //*(long int *) (tmp + 16) = pos;
00091     set_long(tmp + 16, pos);
00092     *len = 20;
00093     return buf;
00094 }
00095 
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 Sat May 1 11:36:48 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003