home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 Mobile
/
Chip_Mobile_2001.iso
/
palm
/
business
/
printcar
/
printcar.exe
/
src
/
DB
/
AddressAppInfo.cc
next >
Wrap
C/C++ Source or Header
|
2000-06-10
|
1KB
|
74 lines
//
// $Id: AddressAppInfo.cc,v 1.1 2000/06/10 00:19:56 sergey Exp $
//
#include <Pilot.h>
#include "AddressAppInfo.h"
#include "Util/Assert.h"
namespace DB
{
// constants
// From palm-link package:
const int BASE_APP_INFO_SIZE = 278;
const int LABEL_COUNT = 22;
// construction
AddressAppInfo::AddressAppInfo()
{
clearData();
}
AddressAppInfo::~AddressAppInfo()
{}
// operations
bool AddressAppInfo::restore(const void* buffer)
{
clearData();
if (buffer != 0)
{
unsigned char* ptr = (unsigned char*)buffer+BASE_APP_INFO_SIZE;
char labels[LABEL_COUNT][LABEL_SIZE];
MemMove(labels, ptr+4, sizeof(labels));
int i;
for (i = 3; i < 8; i++)
StrCopy(_phoneLabels[i-3], labels[i]);
for (i = 19; i < 22; i++)
StrCopy(_phoneLabels[i-14], labels[i]);
return true;
}
return false;
}
// attributes
const char* AddressAppInfo::phoneLabel(int index) const
{
if (0 <= index && index < PHONE_LABEL_COUNT)
return _phoneLabels[index];
assert(false);
return "";
}
// implementation
void AddressAppInfo::clearData()
{
MemSet(_phoneLabels, sizeof(_phoneLabels), 0);
}
}
// namespace DB