Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Navigation.cpp

Go to the documentation of this file.
00001 #ifdef _WINDOWS
00002 #include <string.h>
00003 #endif
00004 #include "Navigation.h"
00005 
00006 void CNavigation::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
00007 {
00008     len = srclen+sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE);
00009     data = new unsigned char[len];
00010     unsigned char* p = data;
00011     memcpy(p, src, srclen);
00012     p += srclen;
00013     memcpy(p, &historystart, sizeof(size_t));
00014     p += sizeof(size_t);
00015     memcpy(p, &historyend, sizeof(size_t));
00016     p += sizeof(size_t);
00017     memcpy(p, &historycurrent, sizeof(size_t));
00018     p += sizeof(size_t);
00019     memcpy(p, history, sizeof(size_t)*NAVIGATION_HISTORY_SIZE);
00020 }
00021 
00022 void CNavigation::putSaveData(unsigned char*& src, unsigned short& srclen)
00023 {
00024     if (srclen >= sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE))
00025     {
00026         unsigned char* p = src;
00027         memcpy(&historystart, p, sizeof(size_t));
00028         p += sizeof(size_t);
00029         memcpy(&historyend, p, sizeof(size_t));
00030         p += sizeof(size_t);
00031         memcpy(&historycurrent, p, sizeof(size_t));
00032         p += sizeof(size_t);
00033         memcpy(history, p, sizeof(size_t)*NAVIGATION_HISTORY_SIZE);
00034         src = p + sizeof(size_t)*NAVIGATION_HISTORY_SIZE;
00035         srclen -= sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE);
00036     }
00037 /*
00038     printf("<%u,%u,%u>\n", historystart, historyend, historycurrent);
00039     for (int i = historystart; i <= historyend; i++)
00040         printf("<%u> ", history[i]);
00041     printf("\n");
00042 */
00043 }

Generated on Sat Nov 5 16:16:56 2005 for OPIE by  doxygen 1.4.2