home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 February / Chip_2001-02_cd1.bin / sharewar / vecad / source / Config.h < prev    next >
C/C++ Source or Header  |  2000-06-23  |  1KB  |  63 lines

  1. /********************************************************************
  2. * Project: VeCAD ver.5.1
  3. * Copyright (C) 1999-2000 by Oleg Kolbaskin.
  4. * All rights reserved.
  5. *
  6. * Application Configuraion
  7. ********************************************************************/
  8. #ifndef CONFIG_H
  9. #define CONFIG_H
  10.  
  11. #ifndef _WINDOWS_
  12.   #include <windows.h>
  13. #endif
  14. #ifndef _INC_STDIO
  15.   #include <stdio.h>
  16. #endif
  17.  
  18. #define MAX_CFGITEM  1000
  19.  
  20.  
  21. //-------------------------------------
  22. class CConfigItem {
  23.   TCHAR* szKey;
  24.   TCHAR* szValue;
  25. public:
  26.     CConfigItem ();
  27.     ~CConfigItem ();
  28.  
  29.   void Set      (LPCTSTR _szKey, LPCTSTR _szValue);
  30.   void Get      (LPTSTR  _szKey, LPTSTR  _szValue) const;
  31.  
  32.   LPCTSTR GetKey   () const {return szKey;}
  33.   LPCTSTR GetValue () const {return szValue;}
  34.  
  35.   bool GetValue (LPCTSTR _szKey, LPTSTR  _szValue) const;
  36.   bool SetValue (LPCTSTR _szKey, LPCTSTR _szValue);
  37.  
  38.   bool Write (FILE* df);
  39. };
  40.  
  41.  
  42. //-------------------------------------
  43. class CConfig {
  44.   TCHAR       szFileName[256];
  45.   CConfigItem Item[MAX_CFGITEM];
  46.   int         ISort[MAX_CFGITEM];
  47.   int         n_item;    
  48. public:
  49.     CConfig ();
  50.  
  51.   bool Open  (LPCTSTR szFileName);
  52.   bool Close ();
  53.  
  54.   bool GetValue (LPCTSTR szKey, LPTSTR  szValue ) const;
  55.   bool SetValue (LPCTSTR szKey, LPCTSTR szValue);
  56.  
  57.   int  CmpItems (int i1, int i2) const;
  58. };
  59.  
  60.  
  61. #endif  // CONFIG_H
  62.  
  63.