home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------
- // Copyright @ 1997 TCK Software, Incorporated
- // All Rights Reserved
- // -------------------------------------------------------------------------
- #ifndef __PERSON_H__
- #define __PERSON_H__
-
- #include <string.h>
- #include "recDb.h"
-
- // -------------------------------------------------------------------------
- // This file contains the class definintions of the Person Book and contained
- // objects
- // CPersonDB - the person flat file database - a parameterized CRecDB
- // represents a person database (flat file DB of CPerson records)
- // the file contains 1 heading line and many Person Objects
- // CPerson - the person structure
- // represents a single person record
- // CRecDB - a record database object - a Parameterized (Template) Class
- // represents a flat file database of records
- // the file contains 0 to many T Objects
- // -------------------------------------------------------------------------
-
- #define PERS_NAME 30
- #define PERS_ADDR 30
- #define PERS_CITY 30
- #define PERS_STATE 2
- #define PERS_ZIP 5
- #define PERS_PHONE 15
-
- struct CPerson
- {
- _TCHAR m_name[PERS_NAME+1]; // Name
- _TCHAR m_address[PERS_ADDR+1]; // Adddress
- _TCHAR m_city[PERS_CITY+1]; // City
- _TCHAR m_state[PERS_STATE+1]; // State
- _TCHAR m_zip[PERS_ZIP+1]; // Zip Code
- _TCHAR m_phone[PERS_PHONE+1]; // Phone
- _TCHAR m_bFriend; // Y or N
- _TCHAR m_deleted; // Y or N
- _TCHAR m_carriage_return;
- _TCHAR m_newline;
-
- public:
- CPerson(); // Constructor
- CPerson(CPerson &); // Copy Constructor
- ~CPerson(); // Destructor
- CPerson& operator =(CPerson &); // Copy operator
- BOOL IsDeleted() { return (m_deleted == _T('Y')); }
- void OnWrite()
- { RecDB_Replace((_TCHAR*)this, sizeof(*this), _T('\0'), _T('~')); }
- void OnRead()
- { RecDB_Replace((_TCHAR*)this, sizeof(*this), _T('~'), _T('\0')); }
- void Clear();
- };
-
-
- typedef CRecDB<CPerson> CPersonDB;
-
- #endif