home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / ASE / ASICONF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-08  |  8.9 KB  |  264 lines

  1. /*****************************************************************************
  2.     Name: asiconf.h
  3.  
  4.     Description:  Windows initialization file and asi configuration file classes
  5.  
  6.     Author: Alexander Nikolayev & Oleg Chashin
  7.             Autodesk, Inc.
  8.             Moscow, Russia.
  9.  
  10.       (C) Copyright 1991-93 by Autodesk, Inc.
  11.    ***************************************************************************
  12.       This program is copyrighted by Autodesk, Inc. and is  licensed
  13.       to you under the following conditions.  You may not distribute
  14.       or  publish the source code of this program in any form.   You
  15.       may  incorporate this code in object form in derivative  works
  16.       provided  such  derivative  works  are  (i.) are  designed and
  17.       intended  to  work  solely  with  Autodesk, Inc. products, and
  18.       (ii.)  contain  Autodesk's  copyright  notice  "(C)  Copyright
  19.       1988-1993 by Autodesk, Inc."
  20.    ***************************************************************************
  21.  
  22.       THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
  23.       WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
  24.       PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
  25.  
  26.    ***************************************************************************
  27.                            RESTRICTED RIGHTS LEGEND
  28.  
  29.       Use, duplication, or disclosure by the U.S. Government is subject
  30.       to restrictions set forth in FAR 52.227-19 (Commerical Computer
  31.       Software - Restricted Rights) and DFAR 252.227-7013 (c) (1) (ii)
  32.       (Rights in Technical Data and Computer Software), as applicable.
  33.    ***************************************************************************
  34.  
  35.  
  36.     Entry Points:
  37.  
  38.     Modification History:
  39.        27 Sep 1993  - ann    -  original written
  40.  
  41.     Bugs and restriction on use:
  42.  
  43.     Notes:
  44.  
  45. *****************************************************************************/
  46. #ifndef ASI_ASICONF_HH
  47. #define ASI_ASICONF_HH asiconfhh
  48.  
  49. //////////////////////////////////////////////////////////////////////////////
  50. //
  51. // TYPEDEFS */
  52. //
  53. //////////////////////////////////////////////////////////////////////////////
  54. #if defined(__cplusplus)
  55.  
  56. //class CAsiList;
  57.  
  58. class CAsiWinIni: public CAsiObject
  59. // This class allows to get access to the windows initialization file
  60. //
  61. //
  62. //  CAsiWinIni (const CAsiUcStr &fname)
  63. //
  64. //  Description
  65. //
  66. //   Constructs a windows initialization file object. Windows initialization
  67. //   file name is passed to constructor. File is located on disk according 
  68. //   to rules used to locate any AutoCAD (ASI) system file.
  69. //   
  70. //
  71. //   int openCfgFile (const CAsiUcStr & section) 
  72. //
  73. //  This function reads data from the Windows initialization file.
  74. //  It allows to read all entries of the specified section.
  75. //  These function stores entry  names and corresponding value into 
  76. //  internal selection set of entries. 
  77. //  Entry name and value can be retrieved from it by means of getEntry 
  78. //  member function.
  79. //
  80. //  Parameters
  81. //
  82. //    section   section name containing an entry
  83. //
  84. //  Return Value
  85. //
  86. //    Number of entried read. 0 if there are no enties.
  87. //
  88. //   EAsiBoolean readCfgString (const CAsiUcStr & section, 
  89. //                              const CAsiUcStr & entry,
  90. //                    CAsiUcStr * )
  91. // 
  92. //  This function reads data from the Windows initialization file.
  93. //  It allows to read value of specified entry. These function stores entry
  94. //  names and corresponding value into internal selection set of entries. 
  95. //
  96. //
  97. //  Parameters
  98. //
  99. //    section   section name containing an entry
  100. //
  101. //    entry     name of entry whose associated string is to be retrieved.
  102. //
  103. //  Return Value
  104. //
  105. //    kAsiTrue if succeded and kAsiFalse otherwise
  106. //
  107. //
  108. //   EAsiBoolean getEntry (int item, 
  109. //                         CAsiUcStr *entry, 
  110. //                         CAsiUcStr *value)
  111. //
  112. //   This functions retieves entry name and its value from the entries 
  113. //   selection set
  114. //
  115. //
  116. //   EAsiBoolean writeCfgString (const CAsiUcStr §ion, 
  117. //                               const CAsiUcStr &entry,
  118. //                               const CAsiUcStr &value)
  119. //
  120. //   Description
  121. //
  122. //  This function copies a string into the specified entry of the  
  123. //  Windows Initialization File. 
  124. //  If Windows Initialization file doesn't exist, it is created in the 
  125. //  current directory. If specified section doesn't exist, it is created. 
  126. //  If specified entry doesn't exist in specified section, it is created. 
  127. //  If the value string is void (length of data equal to 0), the specified 
  128. //  entry is deleted.  If the last entry in section was deleted, then container
  129. //  section is also deleted.
  130. //
  131. //
  132. //   Parameters
  133. //
  134. //    section  section name to which the string is to be copied.
  135. // 
  136. //    entry    entry name which have to be modified.
  137. //
  138. //    str      Value to be associated with the entry in file.
  139. //
  140. //
  141. //  Return Value
  142. //
  143. //    kAsiTrue if succeded and kAsiFalse otherwise
  144. //
  145. //
  146. //
  147. {
  148. public:
  149.     // Constrcution/Destrcution
  150.     //
  151.              CAsiWinIni (const CAsiUcStr &cfgname);
  152.              CAsiWinIni (const char *);
  153.     virtual ~CAsiWinIni (void);
  154.  
  155.     // Read/Write configuration file entry
  156.     //
  157. virtual       int           openCfgFile (const CAsiUcStr &);
  158. virtual       int           openCfgFile (const char *);
  159.  
  160. virtual       EAsiBoolean readCfgString (const CAsiUcStr &,
  161.                                          const CAsiUcStr &,
  162.                                          CAsiUcStr * ); 
  163. virtual       EAsiBoolean readCfgString (const char *,
  164.                                          const char *,
  165.                                          CAsiUcStr * ); 
  166.  
  167.  
  168. virtual       EAsiBoolean getEntry      (int, 
  169.                                         CAsiUcStr *, 
  170.                                         CAsiUcStr *);
  171.  
  172.  
  173. virtual      EAsiBoolean writeCfgString (const CAsiUcStr &, 
  174.                                          const CAsiUcStr &,
  175.                                          const CAsiUcStr &);
  176. virtual      EAsiBoolean writeCfgString (const char *, 
  177.                                          const char *,
  178.                                          const char *);
  179.  
  180. protected:
  181.  
  182.        CAsiUcStr        FileName;   // Config file object
  183.        ulong            LupTimeL;   // First part of Time of least file modification
  184.        ulong            LupTimeH;   // Second part of Time of least file modification
  185.        CAsiObject       *Sections;  // Sections
  186.        CAsiObject       *Strings;   // Strings of the file
  187.        int              cursect;    // Current section in list of section
  188.  
  189. };
  190.  
  191.  
  192. class CAsiConfig : public CAsiWinIni
  193. //
  194. // This class allows to get access to the ASI configuration file (asi.ini). 
  195. // This class is derived from the CAsiWinIni class.
  196. //
  197. //
  198. // EAsiBoolean createEnv (const CAsiUcStr &env, const CAsiUcStr &drv)
  199. //
  200. // This function creates environment section in the ASI.INI configuration 
  201. // file. Created environment will be driven by the specified DBMS driver, which
  202. // description shall be present in the configuration file. 
  203. //
  204. //  Return value
  205. //
  206. //  kAsiFalse if environment can't be created. kAsiTrue after successful 
  207. //  complition.
  208. //
  209. //
  210. //  EAsiBoolean dropEnv   (const CAsiUcStr &env)
  211. //
  212. // This function drops environment section from the asi.ini file. 
  213. //
  214. // If environment cannot be droped, kAsiFalse is returned.
  215. //
  216. //
  217. {
  218. public:
  219.     // Constrcution/Destrcution
  220.     //
  221.  
  222.              CAsiConfig (void);
  223.     virtual ~CAsiConfig (void);
  224.  
  225.     // Read/Write asi.ini configuration file entry
  226.     //
  227. virtual       int           openCfgFile (const CAsiUcStr &);
  228. virtual       int           openCfgFile (const char *);
  229.  
  230. virtual       EAsiBoolean readCfgString (const CAsiUcStr &,
  231.                                         const CAsiUcStr &,
  232.                                         CAsiUcStr * ); 
  233. virtual       EAsiBoolean readCfgString (const char *,
  234.                                          const char *,
  235.                                          CAsiUcStr * ); 
  236.  
  237. virtual       EAsiBoolean getEntry      (int, 
  238.                                         CAsiUcStr *, 
  239.                                         CAsiUcStr *);
  240.  
  241. virtual      EAsiBoolean writeCfgString (const CAsiUcStr &, 
  242.                                          const CAsiUcStr &,
  243.                                          const CAsiUcStr &);
  244. virtual      EAsiBoolean writeCfgString (const char *, 
  245.                                          const char *,
  246.                                          const char *);
  247.  
  248.  
  249.     // Create/Drop environment section
  250.     //
  251.              EAsiBoolean createEnv (const CAsiUcStr &env, const CAsiUcStr &drv);
  252.              EAsiBoolean createEnv (const char *, const char *);
  253.  
  254.              EAsiBoolean dropEnv   (const CAsiUcStr &env);
  255.              EAsiBoolean dropEnv   (const char *);
  256.  
  257. };
  258.  
  259. #endif /* __cplusplus */
  260.  
  261. #endif /* ASI_ASICONF_HH */
  262. /*EOF*/
  263.  
  264.