Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

inifile.h

Go to the documentation of this file.
00001 #ifndef INIFILE_H
00002 #define INIFILE_H
00003 
00004 /*
00005    inifile.h
00006 
00007    Decls for INI file format functions
00008 
00009    Modification history:
00010 
00011    24-Feb-1998  FMP replaced __CPLUSPLUS__ with __cplusplus
00012    18-Dec-1997  FMP set up as C/C++ split for emcnml directory
00013    24-Apr-1997  FMP split into C and C++ parts
00014 */
00015 
00016 #include "rcs_defs.hh"
00017 
00018 #if (!defined(MSDOS) || defined(WIN32)) && !defined(linux)
00019 #ifdef UNDER_CE
00020 #define INIFILE_USE_INET_FILES
00021 #endif
00022 #ifdef INIFILE_USE_INET_FILES
00023 #include "inetfile.hh"          // internet file reading functions inet_file_*
00024 #endif
00025 #endif
00026 
00027 #ifdef __cplusplus
00028 extern "C"
00029 {
00030 #endif
00031 
00032 #ifndef NO_STDIO
00033 #include <stdio.h>              /* FILE, NULL */
00034 #endif
00035 
00036 #define INIFILE_MAX_LINELEN 256 /* max number of chars in a line */
00037 
00038 #define COMMENT_CHAR ';'        /* signifies a comment */
00039 
00040   typedef struct
00041   {
00042     char tag[INIFILE_MAX_LINELEN];
00043     char rest[INIFILE_MAX_LINELEN];
00044   }
00045   INIFILE_ENTRY;
00046 
00047   extern const char *iniFind (void *fp, /* already opened file ptr */
00048                               const char *tag,  /* string to find */
00049                               const char *section);     /* section it's in */
00050 
00051   extern int iniSection (void *fp,      /* already opened file ptr */
00052                          const char *section,   /* section you want */
00053                          INIFILE_ENTRY array[], /* entries to fill */
00054                          int max);      /* how many you can hold */
00055 
00056 #ifdef __cplusplus
00057 }
00058 #endif
00059 
00060 #ifdef __cplusplus
00061 
00062 class INIFILE
00063 {
00064 public:
00065   INIFILE ();
00066   INIFILE (const char *path);
00067    ~INIFILE ();
00068 
00069   const int open (const char *path);
00070   const int close ();
00071   const char *find (const char *tag, const char *section = NULL);
00072   int section (const char *section, INIFILE_ENTRY array[], int max);
00073   const int valid ();
00074 
00075 private:
00076 #ifndef NO_STDIO
00077     FILE * fp;
00078 #endif
00079 
00080 #ifdef INIFILE_USE_INET_FILES
00081   INET_FILE *ifp;
00082 #endif
00083 };
00084 
00085 #endif /* C++ part */
00086 
00087 #endif /* INIFILE_H */

Generated on Sun Dec 2 15:56:50 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001