home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / listpm7.zip / ltprof.hpp < prev    next >
C/C++ Source or Header  |  1999-07-14  |  3KB  |  88 lines

  1. /*
  2.     listPM list files under Presentation Manager. Uses Open Class Libarary.
  3.     Copyright (C) 1998, 1999  Paul Elliott
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     Paul Elliott
  20.     PMB # 181
  21.     11900 Metric Blvd Ste. J
  22.     Austin Tx 78758-3117
  23.     pelliott@io.com
  24. */
  25. #ifndef LTPROF
  26. #define LTPROF
  27. #include <istring.hpp>
  28. #include "AProfile.hpp"
  29.  
  30. #include "ltper.hpp"
  31.  
  32. // ToStorage is an abstract base class allowing fixed length byte strings
  33. // to be moved to and from some generalized kind of external storage.
  34. // ProfStorage implements this using UICL profiles.
  35.  
  36. class ProfStorage : public ToStorage
  37. {
  38.   private:
  39.      AProfile profile;                   // Store the application profile.
  40.      IString key;                        // key string for this info.
  41.   public:
  42.      // set key in the profile being used..
  43.      virtual void setKey(const IString& id)
  44.      {
  45.         key = id;
  46.      };
  47.  
  48.      // return the key string being used.
  49.      virtual IString getKey() const
  50.      {
  51.         return key;
  52.      };
  53.  
  54.      // delete the key in the application used.
  55.      virtual void deleteKey()
  56.      {
  57.         profile.deleteElementWithKey( key );
  58.      };
  59.      // read from profile.
  60.      virtual void read ( char * buf,int count);
  61.  
  62.      // Write to profile.
  63.      virtual void write (const char * buf,int count);
  64.  
  65.      // the information (the key) exists in the profile.
  66.      virtual Boolean isInStorage(void)
  67.      {
  68.         return profile.containsKeyName( key );
  69.      };
  70.  
  71.      // Construct from 3 informations:
  72.      // 1) application name.
  73.      // 2) key for application profile file name in system wide user profile.
  74.      // 3) key for this piece of info.
  75.      ProfStorage(const IString& app_name,const IString& user_file_id,
  76.                  const IString& id );
  77.  
  78.      // copy from an existing ProfStorage.
  79.      friend class ProfStorage;
  80.      ProfStorage(const ProfStorage& old,const IString& id) :
  81.        profile(old.profile),
  82.        key(id)
  83.      {
  84.      };
  85.  
  86. };
  87. #endif // LTPROF
  88.