home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / business / printcar / printcar.exe / src / AddressList.h < prev    next >
C/C++ Source or Header  |  2000-06-10  |  2KB  |  62 lines

  1. //
  2. //  $Id: AddressList.h,v 1.4 2000/06/10 00:19:39 sergey Exp $
  3. //
  4.  
  5. #ifndef _AddressList_h_
  6. #define _AddressList_h_
  7.  
  8. #include "DB/Database.h"
  9. #include "DB/AddressAppInfo.h"
  10. #include "DB/AdresseRecord.h"
  11.  
  12.  
  13. //
  14. // This class represents a list of address items.
  15. // The data will be read from the AdresseDB.
  16. //
  17. class AddressList
  18. {
  19. public:
  20.     AddressList();
  21.  
  22. private:
  23.     AddressList(const AddressList&);
  24.     AddressList& operator =(const AddressList&);
  25.  
  26. // operations
  27. public:
  28.     const DB::AddressAppInfo& appInfo() const;
  29.  
  30.     int recordCount() const;
  31.     const DB::AdresseRecord& record(int index) const;
  32.  
  33.     // Returns display name in form "firstName, lastName"
  34.     const char* getDisplayName(int index, char* result, int maxResultSize) const;
  35.  
  36.     // Returns index of the record found by the record's
  37.     // "lastName" entry first letter. Return -1 if record not found.
  38.     int findByFirstLetter(int startIndex, char letter) const;
  39.  
  40. // attributes
  41.  
  42.     bool isRecord(int index) const;
  43.  
  44. // implementation
  45. private:
  46.     bool ensureDatabaseOpened() const;
  47.     bool ensureRecordLoaded(int index) const;
  48.     int copyString(const char* src, char* dest, int maxDestSize) const;
  49.  
  50.     // Checks the record name for first letter match.
  51.     bool isFirstLetterMatch(int index, char letter) const;
  52.  
  53. // data members
  54. private:
  55.     mutable int                 _lastIndex;
  56.     mutable DB::Database        _database;
  57.     mutable DB::AddressAppInfo  _appInfo;
  58.     mutable DB::AdresseRecord   _currentRecord;
  59. };
  60.  
  61. #endif  // _AddressList_h_
  62.