home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 Mobile
/
Chip_Mobile_2001.iso
/
palm
/
business
/
printcar
/
printcar.exe
/
src
/
CardRecord.h
< prev
next >
Wrap
C/C++ Source or Header
|
2000-06-10
|
2KB
|
84 lines
//
// $Id: CardRecord.h,v 1.4 2000/06/10 00:19:40 sergey Exp $
//
#ifndef _CardRecord_h_
#define _CardRecord_h_
#include "DB/RecordType.h"
namespace DB { class ResourceDatabase; }
//
// This is the Card record class.
// All the data of it's instance loaded from the resource database.
//
// Card record encoded in the resources database as a sequence of resources.
// Each record' resources begins with the number module 10. For instance:
//
// rec #1:
// 5000: strRes, name
// 5001: strRes, script
// 5002: bitmapRes, image
// 5003: strRes, libScriptID
//
// ...
// rec #N:
// 50N0: strRes, name
// 50N1: strRes, script
// 50N2: bitmapRes, image
//
// ...
// lib script:
// 4001: strRes, libScript
//
class CardRecord
{
public:
CardRecord();
~CardRecord();
private:
CardRecord(const CardRecord&);
CardRecord& operator =(const CardRecord&);
// operations
public:
// Record index is a relative offset from the "base" resource number in the Card DB.
bool load(int recordIndex, const DB::ResourceDatabase& cardDb);
// attributes
const char* name() const { return _name.data(); }
const char* script() const { return _script.data(); }
BitmapPtr image() const { return _image.data(); }
// Some cards could use some "library" scripts.
// In case of this method returns non null we must execute it before the "main" card script
const char* libScript() const { return _libScript.data(); }
// utilities
// Calculates amount of card records in the Card DB.
static int countRecords(const DB::ResourceDatabase& cardDb);
// implementation
private:
void loadImage(const DB::ResourceDatabase& cardDb, int cardID);
bool loadLibScript(const DB::ResourceDatabase& cardDb, int cardID);
// data members
private:
typedef DB::RecordType<const char*> StringResource;
typedef DB::RecordType<BitmapPtr> BitmapResource;
StringResource _name;
StringResource _script;
BitmapResource _image;
StringResource _libScript;
};
#endif // _CardRecord_h_