home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / VFORM.ZIP / Samples / vfTest / Person2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-10  |  1.9 KB  |  61 lines

  1. // -------------------------------------------------------------------------
  2. // Copyright @ 1997 TCK Software, Incorporated
  3. // All Rights Reserved
  4. // -------------------------------------------------------------------------
  5. #ifndef __PERSON2_H__
  6. #define __PERSON2_H__
  7.  
  8. #include <string.h>
  9. #include "recDb.h"
  10.  
  11. // -------------------------------------------------------------------------
  12. // This file contains the class definintions of the Person Book and contained 
  13. // objects
  14. //    CPersonDB   - the person flat file database - a parameterized CRecDB
  15. //                    represents a person database (flat file DB of CPerson records)
  16. //                    the file contains 1 heading line and many Person Objects
  17. //    CPerson        - the person structure
  18. //                    represents a single person record
  19. //    CRecDB        - a record database object - a Parameterized (Template) Class
  20. //                    represents a flat file database of records
  21. //                    the file contains 0 to many T Objects
  22. // -------------------------------------------------------------------------
  23.  
  24. #define PERS2_NAME    30
  25. #define PERS2_NOTE    40
  26. #define PERS2_PHONE    15
  27. #define PERS2_PHONEDESC    10
  28.  
  29. #define PERS2_MAX_PHONES    5
  30. struct sPerson2Phone
  31. {
  32.     _TCHAR    m_phoneDesc[PERS2_PHONEDESC+1];
  33.     _TCHAR    m_phone[PERS2_PHONE+1];
  34. };
  35.  
  36. struct CPerson2
  37. {
  38.     _TCHAR    m_name[PERS2_NAME+1];        // Name
  39.     _TCHAR    m_note[PERS2_NOTE+1];        // Note
  40.     struct sPerson2Phone    m_phones[PERS2_MAX_PHONES];    // Phones
  41.     _TCHAR    m_deleted;                    // Y or N
  42.     _TCHAR    m_carriage_return;
  43.     _TCHAR    m_newline;
  44.  
  45. public:
  46.     CPerson2();                                    // Constructor
  47.     CPerson2(CPerson2 &);                        // Copy Constructor 
  48.     ~CPerson2();                                // Destructor
  49.     CPerson2& operator =(CPerson2 &);            // Copy operator
  50.     BOOL    IsDeleted() { return (m_deleted == _T('Y')); }
  51.     void    OnWrite()    
  52.         { RecDB_Replace((LPTSTR)this, sizeof(*this), _T('\0'), _T('~')); }
  53.     void    OnRead()    
  54.         { RecDB_Replace((LPTSTR)this, sizeof(*this), _T('~'), _T('\0')); }
  55.     void Clear();
  56. };
  57.  
  58.  
  59. typedef CRecDB<CPerson2> CPerson2DB;
  60.  
  61. #endif