From 87475fa3c14b98b792259f25483954101d1ee76c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 6 Feb 2011 02:39:34 +0100 Subject: [PATCH] Fix usage of field named "new" in configitem.h This prevents including config.h into C++ code --- src/common/config.h | 6 +----- src/common/configentry.c | 2 +- src/common/configfacade.cpp | 15 ++------------- src/common/configitem.c | 4 ++-- src/common/configitem.h | 2 +- src/include/configfacade.hpp | 16 ++++++++-------- 6 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/common/config.h b/src/common/config.h index 4fa462f25..be8b47171 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -94,11 +94,8 @@ typedef lumiera_config* LumieraConfig; LUMIERA_CONFIG_TYPE(bool, int) -// * does only initialize the variables, so that they get valid values, but does not allocate them as they will be allocated before as they are singleton. -// * lumiera_config_init (const char* searchpath) searchpath is a builtin-default, can be changed via configure and can be appended and overridden by using a flag, e.g. {{{ --config-path-append="" }}} or {{{ --config-path="" }}} - /** - * Initialize the configuration subsystem. + * Initialise the configuration subsystem. * @param path search path for config files. * Must be called only once */ @@ -106,7 +103,6 @@ int lumiera_config_init (const char* path); -// * frees all space allocated by the ConfigLoader. /** * Destroys the configuration subsystem. diff --git a/src/common/configentry.c b/src/common/configentry.c index 495690c04..ef02f5149 100644 --- a/src/common/configentry.c +++ b/src/common/configentry.c @@ -59,7 +59,7 @@ lumiera_configentry_destroy (LumieraConfigitem self) struct lumiera_configitem_vtable lumiera_configentry_funcs = { - .new = lumiera_configentry_new, + .newitem = lumiera_configentry_new, .destroy = lumiera_configentry_destroy }; diff --git a/src/common/configfacade.cpp b/src/common/configfacade.cpp index 08aa04903..bb91d84a8 100644 --- a/src/common/configfacade.cpp +++ b/src/common/configfacade.cpp @@ -25,19 +25,8 @@ #include "include/lifecycle.h" #include "include/configfacade.hpp" -extern "C" { // TODO: can't include "lumiera/config.h" from C++ code, because it uses an identifier "new" - - /** Initialise the configuration subsystem. - * Must be called exactly once prior to any use - * @param path search path for config files. - */ - int lumiera_config_init (const char* path); - - /** Destroys the configuration subsystem. - * Subsequent calls are no-op. */ - void - lumiera_config_destroy (); - +extern "C" { + #include "common/config.h" } #ifndef LUMIERA_CONFIG_PATH diff --git a/src/common/configitem.c b/src/common/configitem.c index e2a22c98c..1a07ee820 100644 --- a/src/common/configitem.c +++ b/src/common/configitem.c @@ -109,8 +109,8 @@ lumiera_configitem_new (const char* line) lumiera_configitem_parse (&tmp, line); - LumieraConfigitem self = tmp.vtable && tmp.vtable->new - ? tmp.vtable->new (&tmp) + LumieraConfigitem self = tmp.vtable && tmp.vtable->newitem + ? tmp.vtable->newitem (&tmp) : lumiera_configitem_move (lumiera_malloc (sizeof (*self)), &tmp); return self; diff --git a/src/common/configitem.h b/src/common/configitem.h index 3c3823422..49ae8b62d 100644 --- a/src/common/configitem.h +++ b/src/common/configitem.h @@ -90,7 +90,7 @@ struct lumiera_configitem_vtable; struct lumiera_configitem_vtable { - LumieraConfigitem (*new)(LumieraConfigitem); + LumieraConfigitem (*newitem)(LumieraConfigitem); LumieraConfigitem (*destroy)(LumieraConfigitem); }; diff --git a/src/include/configfacade.hpp b/src/include/configfacade.hpp index 90a2528b2..850cc74d8 100644 --- a/src/include/configfacade.hpp +++ b/src/include/configfacade.hpp @@ -48,23 +48,23 @@ namespace lumiera { /********************************************************************* * C++ wrapper for convenient access to the Lumiera config system. + * + * @warning Config system not fully implemented yet. Thus for now + * this facade is wired with the setup.ini and will just + * fetch the values from there. */ - struct Config + class Config { - + public: static const string get (string const& key); - static lib::Singleton instance; + private: Config(); - ~Config(); - + ~Config(); friend class lib::singleton::StaticCreate; - - //////////////////TODO: define startup/shutdown and loading of the config interface - };