Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

conf.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: conf.h,v $
00003                              -------------------
00004     cvs         : $Id: conf.h,v 1.7 2003/02/17 04:17:47 aquamaniac Exp $
00005     begin       : Mon Dec 02 2002
00006     copyright   : (C) 2002 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00034 #ifndef CHAMELEON_CONF_H
00035 #define CHAMELEON_CONF_H
00036 
00037 #include <stdio.h>
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 
00044 #define CONFIGMODE_PATHMUSTEXIST          0x000001
00045 #define CONFIGMODE_PATHMUSTNOTEXIST       0x000002
00046 #define CONFIGMODE_PATHCREATE             0x000004
00047 
00048 #define CONFIGMODE_NAMEMUSTEXIST          0x000008
00049 #define CONFIGMODE_NAMEMUSTNOTEXIST       0x000010
00050 #define CONFIGMODE_NAMECREATE_GROUP       0x000020
00051 #define CONFIGMODE_NAMECREATE_VARIABLE    0x000040
00052 
00053 #define CONFIGMODE_VARIABLE               0x000080
00054 #define CONFIGMODE_OVERWRITE_VARS         0x000100
00055 #define CONFIGMODE_OVERWRITE_GROUPS       0x000200
00056 #define CONFIGMODE_REMOVE_QUOTES          0x000400
00057 #define CONFIGMODE_REMOVE_STARTING_BLANKS 0x000800
00058 #define CONFIGMODE_REMOVE_TRAILING_BLANKS 0x001000
00059 #define CONFIGMODE_ALLOW_PATH_IN_VARS     0x002000
00060 #define CONFIGMODE_ALLOW_GROUPS           0x004000
00061 #define CONFIGMODE_EMPTY_GROUPS           0x008000
00062 
00063 
00064 CHIPCARD_API typedef struct CONFIGVALUESTRUCT CONFIGVALUE;
00065 CHIPCARD_API typedef struct CONFIGVARIABLESTRUCT CONFIGVARIABLE;
00066 CHIPCARD_API typedef struct CONFIGGROUPSTRUCT CONFIGGROUP;
00067 
00068 
00071 CHIPCARD_API struct CONFIGVALUESTRUCT {
00072   CONFIGVALUE *next;
00073   char *value;
00074 };
00075 
00076 
00079 CHIPCARD_API struct CONFIGVARIABLESTRUCT {
00080   CONFIGVARIABLE *next;
00081   char *name;
00082   CONFIGGROUP *parent;
00083   CONFIGVALUE *values;
00084 };
00085 
00086 
00089 CHIPCARD_API struct CONFIGGROUPSTRUCT {
00090   CONFIGGROUP *next;
00091   char *name;
00092   CONFIGGROUP *parent;
00093   CONFIGGROUP *groups;
00094   CONFIGVARIABLE *variables;
00095 };
00096 
00097 
00102 CHIPCARD_API CONFIGGROUP *Config_new();
00103 
00107 CHIPCARD_API void Config_free(CONFIGGROUP *g);
00108 
00109 
00120 CHIPCARD_API const char *Config_GetValue(CONFIGGROUP *root,
00121                                          const char *path,
00122                                          const char *defaultValue,
00123                                          int idx);
00124 
00129 CHIPCARD_API int Config_GetIntValue(CONFIGGROUP *root,
00130                                     const char *path,
00131                                     int defaultValue,
00132                                     int idx);
00133 
00142 CHIPCARD_API int Config_SetValue(CONFIGGROUP *root,
00143                                  unsigned int mode,
00144                                  const char *path,
00145                                  const char *value);
00146 
00151 CHIPCARD_API int Config_SetIntValue(CONFIGGROUP *root,
00152                                     unsigned int mode,
00153                                     const char *path,
00154                                     int value);
00155 
00164 CHIPCARD_API int Config_AddValue(CONFIGGROUP *root,
00165                                  unsigned int mode,
00166                                  const char *path,
00167                                  const char *value);
00168 
00172 CHIPCARD_API int Config_ClearVariable(CONFIGGROUP *root,
00173                                       unsigned int mode,
00174                                       const char *path);
00175 
00189 CHIPCARD_API CONFIGGROUP *Config_ParseLine(CONFIGGROUP *root,
00190                                            CONFIGGROUP *group,
00191                                            const char *s,
00192                                            int mode);
00193 
00201 CHIPCARD_API int Config_ReadFile(CONFIGGROUP *root,
00202                                  const char *fname,
00203                                  int mode);
00204 
00212 CHIPCARD_API int Config_WriteFile(CONFIGGROUP *root,
00213                                   const char *fname,
00214                                   int mode);
00215 
00219 CHIPCARD_API void Config_AddVariable(CONFIGGROUP *p, CONFIGVARIABLE *v);
00220 
00221 
00230 CHIPCARD_API int Config_DumpGroup(FILE *f, CONFIGGROUP *root,
00231                                   int ins);
00232 
00236 CHIPCARD_API CONFIGGROUP *Config_GetGroup(CONFIGGROUP *root,
00237                                           const char *path,
00238                                           unsigned int mode);
00239 
00240 
00247 CHIPCARD_API void Config_AddGroup(CONFIGGROUP *p, CONFIGGROUP *w);
00248 
00253 void Config_ImportTreeChildren(CONFIGGROUP *p, CONFIGGROUP *g);
00254 
00261 CHIPCARD_API void Config_UnlinkGroup(CONFIGGROUP *p, CONFIGGROUP *w);
00262 
00266 CHIPCARD_API void Config_ClearGroup(CONFIGGROUP *g);
00267 
00268 
00272 CHIPCARD_API CONFIGGROUP *Config_Duplicate(CONFIGGROUP *root);
00273 
00278 CHIPCARD_API void Config_ImportGroup(CONFIGGROUP *root, CONFIGGROUP *g);
00279 
00280 
00286 CHIPCARD_API int Config_Compare(const char *s1, const char *s2);
00287 
00288 #ifdef __cplusplus
00289 }
00290 #endif
00291 
00292 
00293 #endif
00294 
00295 
00296 
00297 

Generated on Mon Jun 6 18:17:40 2005 for libchipcard by  doxygen 1.4.2