util/Properties.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------
00002 Name:      Properties.h
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Hold environment and command line properties. 
00006 Author:    "Marcel Ruff" <xmlBlaster@marcelruff.info>
00007 Date:      06/2003
00008 See:       http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.c.socket.html
00009 -----------------------------------------------------------------------------*/
00010 #ifndef XMLBLASTER_Properties_H
00011 #define XMLBLASTER_Properties_H
00012 
00013 #include <util/basicDefs.h>
00014 
00015 #ifdef __cplusplus
00016 #ifndef XMLBLASTER_C_COMPILE_AS_CPP /* 'g++ -DXMLBLASTER_C_COMPILE_AS_CPP ...' allows to compile the lib as C++ code */
00017 extern "C" {
00018 #endif
00019 #endif
00020 
00021 struct PropertiesStruct;
00022 typedef struct PropertiesStruct Properties;
00023 
00024 /* Declare function pointers to use in struct to simulate object oriented access */
00025 typedef const char *( * XmlBlasterPropertiesGetString)(Properties *xb, const char * key, const char *defaultValue);
00026 typedef bool ( * XmlBlasterPropertiesGetBool)(Properties *xb, const char * key, bool defaultValue);
00027 typedef int ( * XmlBlasterPropertiesGetInt)(Properties *xb, const char * key, int defaultValue);
00028 typedef long ( * XmlBlasterPropertiesGetLong)(Properties *xb, const char * key, long defaultValue);
00029 typedef int64_t ( * XmlBlasterPropertiesGetInt64)(Properties *xb, const char * key, int64_t defaultValue);
00030 
00034 struct PropertiesStruct {
00035    int argc;             
00036    char **argv;          
00037    const char *execName; 
00046    XmlBlasterPropertiesGetString getString; 
00047    XmlBlasterPropertiesGetBool getBool;     
00048    XmlBlasterPropertiesGetInt getInt;       
00049    XmlBlasterPropertiesGetLong getLong;     
00050    XmlBlasterPropertiesGetInt64 getInt64;   
00051 };
00052 
00061 Dll_Export extern Properties *createProperties(int argc, const char* const* argv);
00062 
00066 Dll_Export extern void freeProperties(Properties *props);
00067 
00071 Dll_Export extern void dumpProperties(Properties *props);
00072 
00073 #ifdef __cplusplus
00074 #ifndef XMLBLASTER_C_COMPILE_AS_CPP
00075 }
00076 #endif
00077 #endif
00078 
00079 #endif /* XMLBLASTER_Properties_H */
00080