home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iprofile.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  4.9 KB  |  165 lines

  1. #ifndef _IPROFILE_
  2. #define _IPROFILE_
  3. /*******************************************************************************
  4. * FILE NAME: iprofile.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     iProfile                                                                 *
  9. *     iProfile::Cursor                                                         *
  10. *                                                                              *
  11. * COPYRIGHT:                                                                   *
  12. *   IBM Open Class Library                                                     *
  13. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  14. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  15. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #include <ivbase.hpp>
  20. #include <ihandle.hpp>
  21. #include <istring.hpp>
  22.  
  23. class IProfileData;
  24. class IProfileCursorData;
  25.  
  26. #pragma pack(4)
  27.  
  28. class IProfile : public IVBase {
  29. typedef IVBase
  30.   Inherited;
  31. public:
  32. class Cursor;
  33. /*------------------------------- Constructors -------------------------------*/
  34.   IProfile  ( const char*      profileName );
  35.   IProfile  ( const IProfile&  aProfile );
  36.  
  37. virtual
  38.   ~IProfile ( );
  39.  
  40. IProfile
  41.  &operator= ( const IProfile&  aProfile );
  42.  
  43. /*----------------------------- Special Profiles -----------------------------*/
  44. static IProfile
  45.   systemProfile ( );
  46.  
  47. static IProfile
  48.   userProfile   ( );
  49.  
  50. /*---------------------------- Profile Information ---------------------------*/
  51. virtual IString
  52.   name                 ( ) const,
  53.   applicationOrKeyAt   ( const Cursor& cursor ) const;
  54.  
  55.  
  56. virtual unsigned long
  57.   numberOfKeys         ( const char*   applName = 0 ) const;
  58.  
  59. virtual unsigned long
  60.   numberOfApplications ( ) const;
  61.  
  62.  
  63. /*------------------------ Default Application Name --------------------------*/
  64. virtual IString
  65.   defaultApplicationName     ( ) const;
  66.  
  67. virtual IProfile
  68.   &setDefaultApplicationName ( const char* applName );
  69.  
  70. /*------------------------ Reading and Writing Data --------------------------*/
  71. virtual IString
  72.   elementWithKey               ( const char* key,
  73.                                  const char* applName = 0 ) const;
  74.  
  75. virtual long
  76.   integerWithKey               ( const char* key,
  77.                                  const char* applName = 0 ) const;
  78.  
  79. virtual IProfile
  80.  &addOrReplaceElementWithKey   ( const char* key,
  81.                                  const IString& data,
  82.                                  const char* applName = 0 ),
  83.  
  84.  &addOrReplaceElementWithKey   ( const char* key,
  85.                                  long        data,
  86.                                  const char* applName = 0 );
  87.  
  88. virtual IProfile
  89.  &deleteElementWithKey         ( const char* key,
  90.                                  const char* applName = 0 ),
  91.  
  92.  &deleteElementWithApplication ( const char* applName = 0 );
  93.  
  94. static void
  95.   deleteProfile                ( const char* profileName );
  96.  
  97. /*--------------------------------- Testing ----------------------------------*/
  98. virtual Boolean
  99.   containsApplication ( const char* applName ) const,
  100.   containsKeyName     ( const char* key,
  101.                         const char* applName = 0 ) const;
  102.  
  103. class Cursor : public IVBase {
  104. public:
  105. /*------------------------------- Constructors -------------------------------*/
  106.   Cursor ( IProfile&   profile );
  107.   Cursor ( IProfile&   profile,
  108.            const char* applName );
  109. virtual
  110.  ~Cursor ( );
  111.  
  112. /*---------------------------- Profile Iteration -----------------------------*/
  113. virtual Boolean
  114.   setToFirst    ( ),
  115.   setToNext     ( ),
  116.   setToPrevious ( ),
  117.   setToLast     ( ),
  118.   isValid       ( Boolean checkFile = false ) const;
  119.  
  120. virtual void
  121.   invalidate    ( );
  122.  
  123. private:
  124. /*-------------------------------- Private -----------------------------------*/
  125. friend class IProfile;
  126.  
  127.  
  128. void
  129.   initCursor ( const char*   profileName,
  130.                const char*   appName);
  131.  
  132. unsigned
  133.   pos;
  134.  
  135. IString
  136.   strCl,
  137.   applNameCl;
  138.  
  139.  
  140. IProfileCursorData
  141.  *fCursorData;
  142.  
  143. }; // IProfile::Cursor
  144.  
  145.  
  146. private:
  147. /*------------------------------ Hidden Members ------------------------------*/
  148.  
  149. /*--------------------------------- Private ----------------------------------*/
  150.  
  151. IString
  152.   defApplName,
  153.   profileName;
  154.  
  155.  
  156. IProfileData
  157.  *fProfileData;
  158.  
  159. friend class IProfileData;
  160. }; // iProfile
  161.  
  162. #pragma pack()
  163.  
  164. #endif // _IPROFILE_
  165.