home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------
- // Copyright @ 1997 TCK Software, Incorporated
- // All Rights Reserved
- // -------------------------------------------------------------------------
- #ifndef __PERSON2_H__
- #define __PERSON2_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 PERS2_NAME 30
- #define PERS2_NOTE 40
- #define PERS2_PHONE 15
- #define PERS2_PHONEDESC 10
-
- #define PERS2_MAX_PHONES 5
- struct sPerson2Phone
- {
- _TCHAR m_phoneDesc[PERS2_PHONEDESC+1];
- _TCHAR m_phone[PERS2_PHONE+1];
- };
-
- struct CPerson2
- {
- _TCHAR m_name[PERS2_NAME+1]; // Name
- _TCHAR m_note[PERS2_NOTE+1]; // Note
- struct sPerson2Phone m_phones[PERS2_MAX_PHONES]; // Phones
- _TCHAR m_deleted; // Y or N
- _TCHAR m_carriage_return;
- _TCHAR m_newline;
-
- public:
- CPerson2(); // Constructor
- CPerson2(CPerson2 &); // Copy Constructor
- ~CPerson2(); // Destructor
- CPerson2& operator =(CPerson2 &); // Copy operator
- BOOL IsDeleted() { return (m_deleted == _T('Y')); }
- void OnWrite()
- { RecDB_Replace((LPTSTR)this, sizeof(*this), _T('\0'), _T('~')); }
- void OnRead()
- { RecDB_Replace((LPTSTR)this, sizeof(*this), _T('~'), _T('\0')); }
- void Clear();
- };
-
-
- typedef CRecDB<CPerson2> CPerson2DB;
-
- #endif