inidefns.h

Go to the documentation of this file.
00001 /****
00002  * \file inidefns.h <mi32/inidefns.h>
00003  * \brief Include file for Ini...() functions
00004  *
00005  * \if NODOC
00006  * $Id: inidefns.h_v 1.67 2004/03/30 16:23:39 mju Exp $
00007  *
00008  * $Log: inidefns.h_v $
00009  * Revision 1.67  2004/03/30 16:23:39  mju
00010  * Add IniList fns.
00011  *
00012  * Revision 1.66  2004/03/30 14:54:06  mju
00013  * Eliminate obsolete iniflags.
00014  * Make iniopen variant using filepath non-inline.
00015  *
00016  * Revision 1.65  2003/11/20 21:17:07  msmith
00017  * added set to ini auto
00018  *
00019  * Revision 1.64  2003/10/09 14:17:28  msmith
00020  * Updating documentation.
00021  *
00022  * Revision 1.63  2003/09/17 17:44:38  mju
00023  * Add IniWrite variant for MGUI::ID if 64-bit platform.
00024  *
00025  * Revision 1.62  2003/09/15 13:49:56  fileserver!dwilliss
00026  * Doxygen
00027  *
00028  * Revision 1.61  2003/09/08 20:39:13  dwilliss
00029  * Added doxygen tags for start/end function groups
00030  *
00031  * Revision 1.60  2003/05/14 14:19:35  mju
00032  * Add INIHND::IsOpen and chg Open to check if path matches current.
00033  *
00034  * Revision 1.59  2003/05/14 13:59:43  mju
00035  * Add IniGetFilePath.
00036  *
00037  * Revision 1.58  2003/05/13 17:09:44  msmith
00038  * INI_AUTO back to internal data.
00039  *
00040  * Revision 1.57  2003/05/07 21:42:19  msmith
00041  * INI_AUTO now references external data.
00042  *
00043  * Revision 1.56  2003/05/07 14:46:25  mju
00044  * Need both const and non-const casts for INI_AUTO templates.
00045  *
00046  * Revision 1.55  2003/05/06 21:07:15  msmith
00047  * Added INI_AUTO, INI_NOTIFIER, INI_AUTO_ENUM, and
00048  * INI_NOTIFIER_ENUM classes.
00049  *
00050  * Revision 1.54  2003/04/15 13:33:42  mju
00051  * Move fns using RECT2D to rect header to avoid circular dependency.
00052  *
00053  * Revision 1.52  2003/04/09 21:19:27  mju
00054  * Add iniflag_WriteRequired.
00055  *
00056  * Revision 1.51  2003/04/08 21:46:18  dwilliss
00057  * Changed template _T to _CT because MacOS X's ctype defines an _T
00058  *
00059  * Revision 1.50  2003/02/21 20:52:29  mju
00060  * Delete some obsolete/unsupported flags.
00061  * Update documentation.
00062  *
00063  * Revision 1.49  2003/02/17 21:39:14  mju
00064  * Remove iniflags_nothomepath as unused and not supported.
00065  *
00066  * Revision 1.48  2003/02/17 18:50:56  mju
00067  * Add readonly parm to inihnd.openhost with default of true.
00068  *
00069  * Revision 1.47  2003/02/17 18:48:47  mju
00070  * Remove openserver method from INIHND.
00071  *
00072  * Revision 1.46  2003/02/17 18:36:36  mju
00073  * Remove inifile_server defn as not used anymore.
00074  *
00075  * Revision 1.45  2002/09/09 13:50:33  mju
00076  * Deprecate inigetfilename as not used anyway.
00077  *
00078  * Revision 1.44  2002/09/09 13:40:28  mju
00079  * "Remove" deprecated stuff except if building DLL.
00080  *
00081  * Revision 1.43  2002/06/07 15:09:44  dwilliss
00082  * clarify a comment
00083  *
00084  * Revision 1.42  2002/03/28 16:28:10  mju
00085  * Deprecate non-type-safe INI functions.
00086  * Retire old ReadINI.../WriteINI functions.
00087  *
00088  * Revision 1.41  2001/09/27 18:01:55  scowan
00089  * Added a create no lock file flag.
00090  *
00091  * Revision 1.38  2001/02/28 18:44:37  mju
00092  * Add read/write overloads for 'long' and 'unsigned long' for WIN32.
00093  *
00094  * Revision 1.37  2000/10/31 15:55:06  mju
00095  * Add IniRead/WriteStringMultiLine fns.
00096  *
00097  * Revision 1.36  2000/10/27 17:20:07  mju
00098  * Add INIHND class.
00099  *
00100  * Revision 1.35  2000/08/30 20:42:10  mju
00101  * Eliminate some IniWrite overloads by passing integer and floating-point by value.
00102  *
00103  * Revision 1.34  2000/07/19 16:52:33  mju
00104  * Add docs for some inlines.
00105  *
00106  * Revision 1.33  2000/06/23 15:50:38  mju
00107  * Add IniReadEnum templates.
00108  *
00109  * Revision 1.32  2000/06/23 15:32:50  mju
00110  * Add IniReadBoolean().
00111  *
00112  * Revision 1.31  2000/06/23 14:11:18  mju
00113  * Add function-specific comments for type-safe read/write functions.
00114  * Deprecate old INIRead/Write functions.
00115  *
00116  * Revision 1.30  2000/06/09 17:46:39  sparsons
00117  * Genitor documentation.
00118  *
00119  * Revision 1.29  2000/03/23 14:58:29  mju
00120  * Always define LIBEXPORT *after* all include files in case any of them undefines it.
00121  *
00122  * Revision 1.28  2000/03/22 16:26:59  mju
00123  * Add IniOpen() which uses FILEPATH.
00124  *
00125  * Revision 1.26  1999/11/04 14:11:24  mju
00126  * Include color.h knows how to copy structures.
00127  *
00128  * Revision 1.25  1999/11/03  14:59:56  mju
00129  * Add INITYPE_Bool.
00130  * Add type-safe overloads for IniRead and IniWrite.
00131  *
00132  * Revision 1.24  1999/10/26 15:22:11  scowan
00133  * Return const from get filename.
00134  *
00135  * Revision 1.23  1999/08/04 16:42:43  mju
00136  * Use "const" for data parm in IniWrite fns.
00137  *
00138  * Revision 1.1  1996/07/24  20:34:43  scowan
00139  * Initial revision
00140  * \endif
00141 ****/
00142 
00143 #ifndef INC_MI32_INIDEFNS_H
00144 #define INC_MI32_INIDEFNS_H
00145 
00146 #ifndef  INC_MI32_STDDEFNS_H
00147    #include <mi32/stddefns.h>
00148 #endif
00149 
00150 #ifndef  INC_MI32_COLOR_H
00151    #include <mi32/color.h>
00152 #endif
00153 
00154 #ifndef  INC_MI32_MAPPROJ_H
00155    #include <mi32/mapproj.h>
00156 #endif
00157 
00158 #ifndef  INC_MI32_FILEPATH_H
00159    #include <mi32/filepath.h>
00160 #endif
00161 
00162 
00163 #ifdef MISYSTEMDLL
00164    #define LIBEXPORT MI_DLLEXPORT
00165 #else
00166    #define LIBEXPORT MI_DLLIMPORT
00167 #endif
00168 
00169 
00170 #define INITYPE_IniStruct     0x01000000              //!< Ini structure marker
00171 #define INITYPE_End           0                       //!< End of a list (0)
00172 #define INITYPE_ByteBoolean   1                       //!< Read a Yes/No, 1/0, Y/N, y/n, True/False, T/F, t/f
00173 #define INITYPE_IntBoolean    2                       //!< Read a Yes/No, 1/0, Y/N, y/n, True/False, T/F, t/f
00174 #define INITYPE_INT8          3                       //!< Read a byte
00175 #define INITYPE_UINT8         4                       //!< Read a unsigned byte
00176 #define INITYPE_INT16         5                       //!< Read a word
00177 #define INITYPE_UINT16        6                       //!< Read a unsigned word
00178 #define INITYPE_INT32         7                       //!< Read a long
00179 #define INITYPE_UINT32        8                       //!< Read a unsigned long
00180 #define INITYPE_Float         9                       //!< Read a float
00181 #define INITYPE_Double        10                      //!< Read a double
00182 #define INITYPE_String        11                      //!< Read a string
00183 #define INITYPE_ASCII         INITYPE_String          //!< Read a string
00184 #define INITYPE_Unicode       12                      //!< Read a UNICODE string
00185 #define INITYPE_UNICODE       INITYPE_Unicode
00186 #define INITYPE_DPOINT2D      13|INITYPE_IniStruct    //!< Read a 2D point
00187 #define INITYPE_DPOINT3D      14|INITYPE_IniStruct    //!< Read a 3D point
00188 #define INITYPE_MAPPROJPARM   15|INITYPE_IniStruct    //!< Read a MAPPROJPARM
00189 #define INITYPE_COLOR         17|INITYPE_IniStruct    //!< Read a COLOR
00190 #define INITYPE_DRECT2D       18|INITYPE_IniStruct    //!< Read a DRECT2D
00191 #define INITYPE_Bool          19                      //!< bool
00192 
00193 //! For basefilename in IniOpen().
00194 #define INIFILE_Standard      "tntproc.ini"
00195 #define INIFILE_Host          "tnthost.ini"
00196 
00197 //! Flags for Ini... functions.
00198 #define INIFLAG_None             0
00199 #define INIFLAG_WriteRequired    0x00000002     //!< Need write access, return error if not allowed
00200 #define INIFLAG_ReadOnly         0x00000004     //!< Open as read-only
00201 #define INIFLAG_InternalOnly     0x00000010     //!< Not a file, use internal buffer only
00202 
00203 
00204 //-------------------------------------------------------------------------------------------------
00205 //!      Function prototypes                                                                          
00206 //-------------------------------------------------------------------------------------------------
00207 
00208 extern "C" {
00209 
00210 #ifndef GENERATING_DOXYGEN_OUTPUT
00211 //! Internal functions
00212 
00213 LIBEXPORT INT32 _iniRead (
00214    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default .ini file    
00215    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00216    const char*const field,             //!< Field that the data is stored under
00217    UINT32 initype,                     //!< INITYPE of items to read
00218    void *data,                         //!< Pointer to buffer to read into, dependant on 'initype'
00219    INT32 count = 1                     //!< Number of items to read
00220    );
00221 
00222 LIBEXPORT INT32 _iniReadString (
00223    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00224    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00225    const char*const field,             //!< Field that data is stored in
00226    UINT32 initype,                     //!< INITYPE_ASCII or INITYPE_Unicode
00227    void *data,                         //!< Pointer to buffer to read into RETURNED
00228    INT32 len                           //!< Number of BYTES to read
00229    );
00230 
00231 LIBEXPORT INT32 _iniReadStringAllocML (
00232    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00233    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00234    const char*const field,             //!< Field that data is stored in
00235    UINT32 initype,                     //!< INITYPE_ASCII or INITYPE_Unicode
00236    void **data                         //!< Pointer to buffer to read into RETURNED
00237    );
00238 
00239 LIBEXPORT int _iniWrite (
00240    INIHANDLE iniptr,                   //!< Ini file handle, NULL for default .ini file
00241    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00242    const char* field,                  //!< Field that the data is stored under
00243    UINT32 initype,                     //!< Type of data to write
00244    const void *data,                   //!< Pointer to buffer to write from
00245    INT32 count                         //!< Number of entries to write
00246    );
00247 
00248 LIBEXPORT int _iniWriteString (
00249    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00250    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00251    const char *field,                  //!< Field that the data is to be stored under
00252    UINT32 initype,                     //!< INITYPE_ASCII or INITYPE_Unicode
00253    const void *data                    //!< Pointer to buffer to write from
00254    );
00255 
00256 LIBEXPORT int _iniWriteStringML (
00257    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00258    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00259    const char *field,                  //!< Field that the data is to be stored under
00260    UINT32 initype,                     //!< Type of data to write
00261    const void *data                    //!< Pointer to buffer to write from
00262    );
00263 
00264 #endif // GENERATING_DOXYGEN_OUTPUT
00265 
00266 
00267 //!:Associate with "INI File Functions"
00268 //!\addtogroup ini INI File Functions
00269 //!@{
00270 
00271 //! Close handle to opened .ini file.
00272 //!   This function should only be called when the .ini file is opened using IniOpen.
00273 LIBEXPORT void IniClose (
00274    INIHANDLE iniptr                    //!< Open INI file handle, NULL for default .ini file
00275    );
00276 
00277 //! Delete a field entry in the .ini file.
00278 LIBEXPORT int IniDeleteField (
00279    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default .ini file
00280    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00281    const char* field                   //!< Field to delete
00282    );
00283 
00284 //! Delete a group from the .ini file.
00285 LIBEXPORT int IniDeleteGroup (
00286    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default .ini file
00287    const char* group                   //!< Group to delete
00288    );
00289 
00290 //! Get internal buffer into UNICODE string.
00291 //! @return Number of Unicode characters in output or error < 0.
00292 LIBEXPORT int IniGetBuffer (
00293    INIHANDLE iniptr,                   //!< Open INI file handle, must pass INIFLAG_InternalOnly to IniOpen()
00294    UNICODE **buffer                    //!< Buffer from Ini handle RETURNED, free using MmFree().
00295    );
00296 
00297 //! Get path to actual Ini file.
00298 //! Returns empty path if handle not opened or is attached to memory buffer.
00299 LIBEXPORT const FILEPATH& IniGetFilePath (
00300    INIHANDLE inihandle
00301    );
00302 
00303 //! Determine if ini file is writable.
00304 //! @return 1 if it is writable, 0 if it is not.
00305 LIBEXPORT int IniIsWritable (
00306    INIHANDLE iniptr                    //!< Open INI file handle, NULL for default .ini file
00307    );
00308 
00309 //! Add file to preset list.
00310 LIBEXPORT ERRVALUE IniListAdd (
00311    const FILEPATH& filepath
00312    );
00313 
00314 //! Clear preset list.
00315 LIBEXPORT void IniListClear (
00316    );
00317 
00318 
00319 //! Open .ini file for modification.
00320 //!
00321 //! This function does not keep the .ini file itself open, it reads the whole file into memory and
00322 //!   processes it internally.  If NULL is passed for 'basefilename', the INIFLAG_InternalOnly flag must
00323 //! be specified or an error will result.  IniClose must be called to free the handle returned
00324 //!   by this function.  This function is not needed if the 'standard' .ini file is to be accessed,
00325 //!   the other Ini... functions will manage this internally.
00326 //! Defined flags:      
00327 //!      INIFLAG_ReadOnly     Do not allow writing through this handle.
00328 //!      INIFLAG_InternalOnly Open Ini handle for use with memory buffer.  See IniGetBuffer() and IniSetBuffer() for details.
00329 //!   Default .ini file defines:
00330 //!      INIFILE_Host         tnthost.ini
00331 //!         Host machine specific values, one per system.      
00332 LIBEXPORT int IniOpen (
00333    const char *basefilename,           //!< Name of .ini file to open (NULL for use with INIFLAG_InternalOnly)
00334    INIHANDLE *iniptr,                  //!< Handle to .ini file RETURNED
00335    UINT32 flags = INIFLAG_None         //!< Flags
00336    );
00337 
00338 //! Set application name for use when group == NULL and it overrides module name.
00339 LIBEXPORT void IniSetAppName (
00340    const char *AppName
00341    );
00342 
00343 //! Set internal buffer from passed UNICODE string.
00344 LIBEXPORT int IniSetBuffer (
00345    INIHANDLE iniptr,                   //!< Open INI file handle, must pass INIFLAG_InternalOnly to IniOpen()
00346    UNICODE *buffer                     //!< Buffer to pass into Ini handle
00347    );
00348 
00349 //! Write single boolean value to .ini file.
00350 //!
00351 //! @return Error if < 0 or number of bytes written.
00352 //!
00353 //! This is useful for writing constant values (TRUE or FALSE).
00354 LIBEXPORT int IniWriteBoolean (
00355    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00356    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00357    const char *field,                  //!< Field that the data is to be stored under
00358    int value                           //!< Value to write (NOT A POINTER)
00359    );
00360 
00361 }  // Extern "C"
00362 
00363 //! Open INI file specified by FILEPATH.
00364 LIBEXPORT ERRVALUE IniOpen (
00365    const FILEPATH& filepath,           //!< File path to open
00366    INIHANDLE *iniptr,                  //!< INI handle returned
00367    UINT32 flags = INIFLAG_None
00368    );
00369 
00370 //---------------------------------------------------------------------------------------------------------------------
00371 #ifndef GENERATING_DOXYGEN_OUTPUT
00372 // Removed items
00373 
00374 #if defined(MISYSTEMDLL)
00375 
00376 extern "C" {
00377 
00378 //! Read a string value.
00379 //!
00380 //!   REMOVED.  Use type-safe IniRead versions instead.
00381 //!
00382 //! @return Number of 'characters' read, -1 if no entry, or error code if < -1.
00383 //!
00384 //! List of available types:     
00385 //!      INITYPE_ASCII        ASCII (1-byte character) string
00386 //!      INITYPE_Unicode      UNICODE (2-byte character) string
00387 //! The 'size' field is used to specify the size of the buffer.  For Unicode this is NOT the same as 
00388 //! the number of characters.  Usually this will be specified by the sizeof(...) operator.
00389 //!   Unicode strings are stored in the .ini file as UTF8 encoding.
00390 //!   If you want to store strings with line terminators, you are required to create your own 
00391 //! line termination scheme.  You may use INITYPE_Unicode to read strings stored as ASCII.
00392 LIBEXPORT INT32 IniReadString (
00393    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00394    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00395    const char*const field,             //!< Field that data is stored in
00396    UINT32 initype,                     //!< INITYPE_ASCII or INITYPE_Unicode
00397    void *data,                         //!< Pointer to buffer to read into RETURNED
00398    INT32 len                           //!< Number of BYTES to read
00399    );
00400 
00401 //! Read the entry from the .ini file as an allocated ASCII or UNICODE string.
00402 //!
00403 //!   REMOVED.  Use MISTRING::IniRead() instead.
00404 //!
00405 //! @return Number of 'characters' read, -1 if no entry, or error code if < -1.
00406 //!
00407 //! This function will not read multi-line strings, use IniReadStringAllocML for multi-line strings.
00408 //!   Unicode strings are stored in the .ini file as UTF8 encoding.
00409 LIBEXPORT INT32 IniReadStringAlloc (
00410    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00411    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00412    const char*const field,             //!< Field that data is stored in
00413    void **data,                        //!< Pointer to buffer to read into RETURNED
00414    UINT32 initype                      //!< INITYPE_ASCII or INITYPE_Unicode
00415    );
00416 
00417 //! Read multi-line string from .ini file.
00418 //!
00419 //!   REMOVED.  Use MISTRING::IniRead() instead.
00420 //!
00421 //! @return Number of 'characters' read, -1 if no entry, or error code if < -1.
00422 LIBEXPORT INT32 IniReadStringAllocML (
00423    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00424    const char* group,                  //!< Group to find field in, uses GetAppName() if NULL
00425    const char*const field,             //!< Field that data is stored in
00426    UINT32 initype,                     //!< INITYPE_ASCII or INITYPE_Unicode
00427    void **data                         //!< Pointer to buffer to read into RETURNED
00428    );
00429 
00430 //! Write a string to the .ini file.
00431 //!
00432 //!   REMOVED.  Use type-safe IniWrite versions instead.
00433 //!
00434 //! @return Error if < 0 or number of bytes written.
00435 //!
00436 //! Do NOT use this function to store multi-line strings (containing newlines).  Use IniWriteStringML.
00437 //! Unicode strings are stored in the .ini file as UTF8 encoding.
00438 //! List of accepted types:      
00439 //!      INITYPE_ASCII        ASCII (1-byte character) string
00440 //!      INITYPE_Unicode      UNICODE (2-byte character) string 
00441 LIBEXPORT int IniWriteString (
00442    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00443    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00444    const char *field,                  //!< Field that the data is to be stored under
00445    UINT32 initype,                     //!< INITYPE_ASCII or INITYPE_Unicode
00446    const void *data                    //!< Pointer to buffer to write from
00447    );
00448 
00449 //! Write multi-line string to Ini file.
00450 //!
00451 //!   REMOVED.  Use type-safe IniWrite versions instead.
00452 LIBEXPORT int IniWriteStringML (
00453    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00454    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00455    const char *field,                  //!< Field that the data is to be stored under
00456    UINT32 initype,                     //!< Type of data to write
00457    const void *data                    //!< Pointer to buffer to write from
00458    );
00459 
00460 }  // Extern "C"
00461 
00462 #endif
00463 
00464 #endif // GENERATING_DOXYGEN_OUTPUT
00465 
00466 //---------------------------------------------------------------------------------------------------------------------
00467 
00468 //! Read 'bool' value from INI file.
00469 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, bool& value) { return (_iniRead(hdl,group,field,INITYPE_Bool,&value,1)); }
00470 
00471 //! Read 'bool' value from INI file with default.
00472 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, bool& value, bool dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00473 
00474 //! Read 'INT8' value from INI file.
00475 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT8& value) { return (_iniRead(hdl,group,field,INITYPE_INT8,&value,1)); }
00476 
00477 //! Read 'INT8' value from INI file with default.
00478 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT8& value, INT8 dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00479 
00480 //! Read 'INT8' value from INI file with default and range check.
00481 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT8& value, INT8 dft, INT8 min, INT8 max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00482 
00483 //! Read 'UINT8' value from INI file.
00484 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT8& value) { return (_iniRead(hdl,group,field,INITYPE_UINT8,&value,1)); }
00485 
00486 //! Read 'UINT8' value from INI file with default.
00487 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT8& value, UINT8 dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00488 
00489 //! Read 'UINT8' value from INI file with default and range.
00490 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT8& value, UINT8 dft, UINT8 min, UINT8 max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00491 
00492 //! Read 'INT16' value from INI file.
00493 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT16& value) { return (_iniRead(hdl,group,field,INITYPE_INT16,&value,1)); }
00494 
00495 //! Read 'INT16' value from INI file with default.
00496 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT16& value, INT16 dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00497 
00498 //! Read 'INT16' value from INI file with default and range.
00499 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT16& value, INT16 dft, INT16 min, INT16 max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00500 
00501 //! Read 'UINT16' value from INI file.
00502 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT16& value) { return (_iniRead(hdl,group,field,INITYPE_UINT16,&value,1)); }
00503 
00504 //! Read 'UINT16' value from INI file with default.
00505 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT16& value, UINT16 dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00506 
00507 //! Read 'UINT16' value from INI file with default and range.
00508 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT16& value, UINT16 dft, UINT16 min, UINT16 max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00509 
00510 //! Read 'INT32' value from INI file.
00511 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT32& value) { return (_iniRead(hdl,group,field,INITYPE_INT32,&value,1)); }
00512 
00513 //! Read 'INT32' value from INI file with default.
00514 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT32& value, INT32 dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00515 
00516 //! Read 'INT32' value from INI file with default and range.
00517 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, INT32& value, INT32 dft, INT32 min, INT32 max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00518 
00519 //! Read 'UINT32' value from INI file.
00520 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT32& value) { return (_iniRead(hdl,group,field,INITYPE_UINT32,&value,1)); }
00521 
00522 //! Read 'UINT32' value from INI file with default.
00523 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT32& value, UINT32 dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00524 
00525 //! Read 'UINT32' value from INI file with default and range.
00526 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UINT32& value, UINT32 dft, UINT32 min, UINT32 max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00527 
00528 #if defined(WIN32)
00529 
00530 //! Read 'long' value from INI file.
00531 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, long& value) { return (_iniRead(hdl,group,field,INITYPE_INT32,&value,1)); }
00532 
00533 //! Read 'long' value from INI file with default.
00534 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, long& value, long dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00535 
00536 //! Read 'long' value from INI file with default and range.
00537 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, long& value, long dft, long min, long max) { value = dft; long err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00538 
00539 //! Read 'unsigned long' value from INI file.
00540 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, unsigned long& value) { return (_iniRead(hdl,group,field,INITYPE_INT32,&value,1)); }
00541 
00542 //! Read 'unsigned long' value from INI file with default.
00543 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, unsigned long& value, unsigned long dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00544 
00545 //! Read 'unsigned long' value from INI file with default and range.
00546 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, unsigned long& value, unsigned long dft, unsigned long min, unsigned long max) { value = dft; long err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00547 
00548 #elif !defined(INT32_is_int)
00549 
00550 //! Read 'int' value from INI file.
00551 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, int& value) { return (_iniRead(hdl,group,field,INITYPE_INT32,&value,1)); }
00552 
00553 //! Read 'int' value from INI file with default.
00554 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, int& value, int dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00555 
00556 //! Read 'int' value from INI file with default and range.
00557 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, int& value, int dft, int min, int max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00558 
00559 #endif
00560 
00561 //! Read 'float' value from INI file.
00562 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, float& value) { return (_iniRead(hdl,group,field,INITYPE_Float,&value,1)); }
00563 
00564 //! Read 'float' value from INI file with default.
00565 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, float& value, float dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00566 
00567 //! Read 'float' value from INI file with default and range.
00568 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, float& value, float dft, float min, float max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00569 
00570 //! Read 'double' value from INI file.
00571 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, double& value) { return (_iniRead(hdl,group,field,INITYPE_Double,&value,1)); }
00572 
00573 //! Read 'double' value from INI file with default.
00574 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, double& value, double dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00575 
00576 //! Read 'double' value from INI file with default and range.
00577 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, double& value, double dft, double min, double max) { value = dft; int err = IniRead(hdl,group,field,value); if (value < min) value = min; else if (value > max) value = max; return (err); }
00578 
00579 //! Read 'char* string' value from INI file.
00580 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, char *str, int size) { return (_iniReadString(hdl,group,field,INITYPE_ASCII,str,size)); }
00581 
00582 //! Read 'UNICODE* string' value from INI file.
00583 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, UNICODE *str, int size) { return (_iniReadString(hdl,group,field,INITYPE_Unicode,str,size)); }
00584 
00585 //! Read 'COLOR' value from INI file.
00586 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, COLOR& value) { return (_iniRead(hdl,group,field,INITYPE_COLOR,&value,1)); }
00587 
00588 //! Read 'COLOR' value from INI file with default.
00589 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, COLOR& value, const COLOR& dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00590 
00591 //! Read 'DPOINT2D' value from INI file.
00592 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, DPOINT2D& value) { return (_iniRead(hdl,group,field,INITYPE_DPOINT2D,&value,1)); }
00593 
00594 //! Read 'DPOINT2D' value from INI file with default.
00595 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, DPOINT2D& value, const DPOINT2D& dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00596 
00597 //! Read 'DPOINT3D' value from INI file.
00598 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, DPOINT3D& value) { return (_iniRead(hdl,group,field,INITYPE_DPOINT3D,&value,1)); }
00599 
00600 //! Read 'DPOINT3D' value from INI file with default.
00601 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, DPOINT3D& value, const DPOINT3D& dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00602 
00603 //! Read 'MAPPROJPARM' value from INI file.
00604 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, MAPPROJPARM& value) { return (_iniRead(hdl,group,field,INITYPE_MAPPROJPARM,&value,1)); }
00605 
00606 //! Read 'MAPPROJPARM' value from INI file with default.
00607 inline int IniRead (INIHANDLE hdl, const char *group, const char *field, MAPPROJPARM& value, const MAPPROJPARM& dft) { value = dft; return (IniRead(hdl,group,field,value)); }
00608 
00609 //! Read general boolean value from INI file with default.
00610 //! If the entry does not exist in the file or any error occurs the default will be returned.
00611 inline bool IniReadBoolean (INIHANDLE hdl, const char *group, const char *field, bool dft) { bool value; IniRead(hdl,group,field,value,dft); return (value); }
00612 
00613 //! Read 'enum' from INI file.
00614 template <class _CT>
00615 inline int IniReadEnum (
00616    INIHANDLE hdl,
00617    const char *group,
00618    const char *field,
00619    _CT& value
00620    ) {
00621    int err, temp;
00622    if ((err = IniRead(hdl,group,field,temp)) >= 0) {
00623       value = static_cast<_CT>(temp);
00624       }
00625    return (err);
00626    }
00627 
00628 //! Read 'enum' from INI file with default.
00629 template <class _CT>
00630 inline int IniReadEnum (
00631    INIHANDLE hdl,
00632    const char *group,
00633    const char *field,
00634    _CT& value,
00635    _CT dft
00636    ) {
00637    int err, temp;
00638    if ((err = IniRead(hdl,group,field,temp)) >= 0) {
00639       value = static_cast<_CT>(temp);
00640       }
00641    else {
00642       value = dft;
00643       }
00644    return (err);
00645    }
00646 
00647 //! Read multi-line 'char*' string from INI file.
00648 inline int IniReadStringMultiLine (
00649    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00650    const char *group,                  //!< Group to find field in, uses GetAppName() if NULL
00651    const char *field,                  //!< Field that data is stored in
00652    char*& string                       //!< String to read into, allocated and returned
00653    ) {
00654    return (_iniReadStringAllocML(iniptr,group,field,INITYPE_ASCII,reinterpret_cast<void**>(&string)));
00655    }
00656 
00657 //! Read multi-line 'UNICODE*' string from INI file.
00658 inline int IniReadStringMultiLine (
00659    INIHANDLE iniptr,                   //!< Open INI file handle, NULL for default
00660    const char *group,                  //!< Group to find field in, uses GetAppName() if NULL
00661    const char *field,                  //!< Field that data is stored in
00662    UNICODE*& string                    //!< String to read into, allocated and returned
00663    ) {
00664    return (_iniReadStringAllocML(iniptr,group,field,INITYPE_Unicode,reinterpret_cast<void**>(&string)));
00665    }
00666 
00667 //! Write 'bool' value to INI file.
00668 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const bool& value) { return (IniWriteBoolean(hdl,group,field,value)); }
00669 
00670 //! Write signed integer or enum value to INI file.
00671 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, int value) { return (_iniWrite(hdl,group,field,INITYPE_INT32,&value,1)); }
00672 
00673 //! Write unsigned integer or enum value to INI file.
00674 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, unsigned int value) { return (_iniWrite(hdl,group,field,INITYPE_UINT32,&value,1)); }
00675 
00676 #if defined(WIN32)
00677 
00678 //! Write 'long' value to INI file.
00679 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, long value) { return (_iniWrite(hdl,group,field,INITYPE_INT32,&value,1)); }
00680 
00681 //! Write 'unsigned long' value to INI file.
00682 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, unsigned long value) { return (_iniWrite(hdl,group,field,INITYPE_UINT32,&value,1)); }
00683 
00684 #elif !defined(INT32_is_int)
00685 
00686 //! Write 'INT32' value to INI file.
00687 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, INT32 value) { return (_iniWrite(hdl,group,field,INITYPE_INT32,&value,1)); }
00688 
00689 //! Write 'UINT32' value to INI file.
00690 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, UINT32 value) { return (_iniWrite(hdl,group,field,INITYPE_UINT32,&value,1)); }
00691 
00692 #endif
00693 
00694 #if defined(LONGS_ARE_64_BIT)
00695 
00696 //! Write 'MGUI::ID' value to INI file.
00697 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, MGUI::ID value) { INT32 temp = static_cast<INT32>(value); return (_iniWrite(hdl,group,field,INITYPE_INT32,&temp,1)); }
00698 
00699 #endif
00700 
00701 //! Write floating-point value to INI file.
00702 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, double value) { return (_iniWrite(hdl,group,field,INITYPE_Double,&value,1)); }
00703 
00704 //! Write 'char* string' value to INI file.
00705 //! Do NOT use this function to store multi-line strings (containing newlines).  Use IniWriteStringMultiLine.
00706 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const char *str) { return (_iniWriteString(hdl,group,field,INITYPE_ASCII,str)); }
00707 
00708 //! Write 'UNICODE* string' value to INI file.
00709 //! Do NOT use this function to store multi-line strings (containing newlines).  Use IniWriteStringMultiLine.
00710 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const UNICODE *str) { return (_iniWriteString(hdl,group,field,INITYPE_Unicode,str)); }
00711 
00712 //! Write 'COLOR' value to INI file.
00713 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const COLOR& value) { return (_iniWrite(hdl,group,field,INITYPE_COLOR,&value,1)); }
00714 
00715 //! Write 'DPOINT2D' value to INI file.
00716 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const DPOINT2D& value) { return (_iniWrite(hdl,group,field,INITYPE_DPOINT2D,&value,1)); }
00717 
00718 //! Write 'DPOINT3D' value to INI file.
00719 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const DPOINT3D& value) { return (_iniWrite(hdl,group,field,INITYPE_DPOINT3D,&value,1)); }
00720 
00721 //! Write 'MAPPROJPARM' value to INI file.
00722 inline int IniWrite (INIHANDLE hdl, const char *group, const char *field, const MAPPROJPARM& value) { return (_iniWrite(hdl,group,field,INITYPE_MAPPROJPARM,&value,1)); }
00723 
00724 
00725 //! Write multi-line 'char*' string to Ini file.
00726 inline int IniWriteStringMultiLine (
00727    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00728    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00729    const char *field,                  //!< Field that the data is to be stored under
00730    const char *string                  //!< String to write
00731    ) {
00732    return (_iniWriteStringML(iniptr,group,field,INITYPE_ASCII,string));
00733    }
00734 
00735 //! Write multi-line 'UNICODE*' string to Ini file.
00736 inline int IniWriteStringMultiLine (
00737    INIHANDLE iniptr,                   //!< Open INI file handle NULL for default
00738    const char *group,                  //!< Group to locate field in, uses GetAppName() if NULL
00739    const char *field,                  //!< Field that the data is to be stored under
00740    const UNICODE *string               //!< String to write
00741    ) {
00742    return (_iniWriteStringML(iniptr,group,field,INITYPE_Unicode,string));
00743    }
00744 
00745 //!@}
00746 
00747 //-------------------------------------------------------------------------------------------------
00748 
00749 //! INI handle class support automatic closing of handle when going out of scope.
00750 class INIHND {
00751    public:
00752 
00753       //! Construct unopened handle.
00754       INIHND (
00755          ): m_handle(0) { }
00756 
00757       //! Destructor, closes handle if open.
00758       ~INIHND (
00759          ) { Close(); }
00760 
00761       //! Cast to INIHANDLE - Return actual handle for use in other Ini functions.
00762       //! Do not use in IniClose or errors will occur.
00763       operator INIHANDLE (
00764          ) const { return (m_handle); }
00765 
00766       //! Close handle if open.
00767       void Close (
00768          ) { if (IsOpen()) IniClose(m_handle); m_handle = 0; }
00769 
00770       //! Determine if handle references 'open' file.
00771       bool IsOpen (
00772          ) const { return (m_handle != 0); }
00773 
00774       //! Open "tnthost.ini" file.
00775       ERRVALUE OpenHost (
00776          bool readonly = true
00777          ) { Close(); return (IniOpen(INIFILE_Host,&m_handle,(readonly?INIFLAG_ReadOnly:0))); }
00778 
00779       //! Open specified file given FILEPATH.
00780       ERRVALUE Open (
00781          const FILEPATH& filepath
00782          ) {
00783          if (IsOpen() && filepath == IniGetFilePath(m_handle)) return (0);
00784          Close();
00785          return (IniOpen(filepath,&m_handle));
00786          }
00787 
00788    private:
00789       #ifndef GENERATING_DOXYGEN_OUTPUT
00790       INIHANDLE m_handle;
00791       // UNIMPLEMENTED / UNSUPPORTED
00792       INIHND (const INIHND&);
00793       INIHND& operator= (const INIHND&);
00794       #endif // GENERATING_DOXYGEN_OUTPUT
00795    };
00796 
00797 
00798 #undef LIBEXPORT
00799 
00800 //! INI_AUTO is a class designed to automatically handle reading and writing of
00801 //! data from an INI file and ensure that IniRead \ IniWrite pairs function
00802 //! together correctly.  The constructor calls IniRead and the assignment operator calls
00803 //! IniWrite.  The Write method allows the data to be written to the INI file
00804 //! at times other than assignment if necessary.
00805 //!
00806 //! Example:
00807 //! INI_AUTO<COLOR> m_Color;
00808 //! In container constructor's initializer list:
00809 //! m_Color(COLOR::RED),
00810 template <class _DT> class INI_AUTO {
00811 
00812    public:
00813 
00814       INI_AUTO (
00815          const char *field,            //!< Field that the data is to be stored under
00816          const char *group = NULL,     //!< Group to locate field in, uses GetAppName() if NULL
00817          bool copyfield = false,       //!< Keep internal copy
00818          bool copygroup = false        //!< Keep internal copy
00819          ) :
00820          m_Group(group),
00821          m_Field(field),
00822          m_CopyGroup(copygroup),
00823          m_CopyField(copyfield)
00824          {
00825          if (copyfield) m_Field = strdup(field);
00826          if (copygroup) m_Group = strdup(group);
00827          IniRead(NULL, m_Group, m_Field, m_Data);
00828          }
00829 
00830       INI_AUTO (
00831          const _DT &defaultdata,             //!< Default value
00832          const char *field,            //!< Field that the data is to be stored under
00833          const char *group = NULL,     //!< Group to locate field in, uses GetAppName() if NULL
00834          bool copyfield = false,       //!< Keep internal copy
00835          bool copygroup = false        //!< Keep internal copy
00836          ) :
00837          m_Data(defaultdata),
00838          m_Group(group),
00839          m_Field(field),
00840          m_CopyGroup(copygroup),
00841          m_CopyField(copyfield)
00842          {
00843          if (copyfield) m_Field = strdup(field);
00844          if (copygroup) m_Group = strdup(group);
00845          IniRead(NULL, m_Group, m_Field, m_Data);
00846          }
00847 
00848       ~INI_AUTO (
00849          ) {
00850          if (m_CopyField) free(const_cast<char*>(m_Field));
00851          if (m_CopyGroup) free(const_cast<char*>(m_Group));
00852          }
00853 
00854       operator const _DT& (
00855          ) const { return (m_Data); }
00856 
00857       const _DT& operator= (
00858          const _DT& dt
00859          ) {
00860          m_Data = dt;
00861          Write();
00862          return (m_Data);
00863          }
00864 
00865       //! Alternative to assignment - allows setting of
00866       //! data without writing to file
00867       void Set (
00868          const _DT& dt,
00869          bool write = true
00870          ) {
00871          m_Data = dt;
00872          if (write)
00873             Write();
00874          }
00875 
00876       //! Force write to file
00877       void Write (
00878          INIHANDLE inihandle = NULL
00879          ) const { IniWrite(inihandle, m_Group, m_Field, m_Data); }           
00880 
00881    private:
00882       #ifndef GENERATING_DOXYGEN_OUTPUT
00883       _DT m_Data;
00884       const char *m_Group;             //!< Group to locate field in, uses GetAppName() if NULL
00885       const char *m_Field;             //!< Field that the data is to be stored under
00886       bool m_CopyGroup;                //!< Internal copy (free m_Group)
00887       bool m_CopyField;                //!< Internal copy (free m_Field)
00888       #endif // GENERATING_DOXYGEN_OUTPUT
00889    };
00890 
00891 //! INI_AUTO_ENUM is a class designed to automatically handle reading and writing of
00892 //! enum data from an INI file and ensure that IniReadEnum \ IniWrite pairs function
00893 //! together correctly.  The constructor calls IniReadEnum and the assignment operator calls
00894 //! IniWrite.  The Write method allows the data to be written to the INI file
00895 //! at times other than assignment.
00896 //!
00897 //! Example:
00898 //!   enum COLORTYPE {...};
00899 //! INI_AUTO_ENUM<COLORTYPE> m_ColorType;
00900 //! In container constructor's initializer list:
00901 //! m_ColorType(COLORTYPE_Default),
00902 template <class _DT> class INI_AUTO_ENUM {
00903 
00904    public:
00905 
00906       INI_AUTO_ENUM (
00907          const char *field,            //!< Field that the data is to be stored under
00908          const char *group = NULL,     //!< Group to locate field in, uses GetAppName() if NULL
00909          bool copyfield = false,       //!< Keep internal copy
00910          bool copygroup = false        //!< Keep internal copy
00911          ) :
00912          m_Data(data),
00913          m_Group(group),
00914          m_Field(field),
00915          m_CopyGroup(copygroup),
00916          m_CopyField(copyfield)
00917          {
00918          if (copyfield) m_Field = strdup(field);
00919          if (copygroup) m_Group = strdup(group);
00920          IniReadEnum(NULL, m_Group, m_Field, m_Data);
00921          }
00922 
00923       INI_AUTO_ENUM (
00924          const _DT &defaultdata,             //!< Default value
00925          const char *field,            //!< Field that the data is to be stored under
00926          const char *group = NULL,     //!< Group to locate field in, uses GetAppName() if NULL
00927          bool copyfield = false,       //!< Keep internal copy
00928          bool copygroup = false        //!< Keep internal copy
00929          ) :
00930          m_Data(defaultdata),
00931          m_Group(group),
00932          m_Field(field),
00933          m_CopyGroup(copygroup),
00934          m_CopyField(copyfield)
00935          {
00936          if (copyfield) m_Field = strdup(field);
00937          if (copygroup) m_Group = strdup(group);
00938          IniReadEnum(NULL, m_Group, m_Field, m_Data);
00939          }
00940 
00941       ~INI_AUTO_ENUM (
00942          ) {
00943          if (m_CopyField) free(const_cast<char*>(m_Field));
00944          if (m_CopyGroup) free(const_cast<char*>(m_Group));
00945          }
00946 
00947       operator const _DT& (
00948          ) const { return (m_Data); }
00949 
00950       const _DT& operator= (
00951          const _DT& dt
00952          ) {
00953          m_Data = dt;
00954          Write();
00955          return (m_Data);
00956          }
00957 
00958       //! Alternative to assignment - allows setting of
00959       //! data without writing to file
00960       void Set (
00961          const _DT& dt,
00962          bool write = true
00963          ) {
00964          m_Data = dt;
00965          if (write)
00966             Write();
00967          }
00968 
00969       //! Force write to file
00970       void Write (
00971          INIHANDLE inihandle = NULL
00972          ) const { IniWrite(inihandle, m_Group, m_Field, m_Data); }           
00973 
00974    private:
00975       #ifndef GENERATING_DOXYGEN_OUTPUT
00976 
00977       _DT m_Data;
00978       const char *m_Group;             //!< Group to locate field in, uses GetAppName() if NULL
00979       const char *m_Field;             //!< Field that the data is to be stored under
00980       bool m_CopyGroup;                //!< Internal copy (free m_Group)
00981       bool