config_db.h

Go to the documentation of this file.
00001 // This component takes care of the initialization and cleanup of the
00002 // configuration database (ConfigDb), and provides an API for
00003 // modifying and querying it. The NO_THREAD_SAFETY option controls
00004 // whether the query/modification API is thread safe.
00005 
00006 #ifndef __config_db_h__
00007 #define __config_db_h__
00008 
00009 #include "er_errors.h" // is_not_found_error
00010 
00011 #include <glib.h>
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016 
00017   typedef struct _ConfigDb ConfigDb;
00018 
00019   ConfigDb* ConfigDb_new(GError** error);
00020   
00021   void ConfigDb_destroy(ConfigDb* self);
00022 
00023   // If a setter returns an error, that typically means that there has
00024   // been a validation error, i.e. that the setting was not changed
00025   // due to the specified (new) value failing to validate. That said,
00026   // the only validation that really can be done is to check the (Lua)
00027   // syntax of the specified value.
00028 
00029   // The caller takes ownership of the returned UTF-8 string. NULL is
00030   // returned if a matching value is not found or for some other
00031   // reason cannot be retrieved. Any error can optionally be set to
00032   // "error". You may use is_not_found_error to check for the not
00033   // found error case.
00034   gchar* ConfigDb_get_generic(ConfigDb* self, 
00035             const gchar* name,
00036             GError** error);
00037 
00038   // The "value" must be a UTF-8 string, and it should be a valid Lua
00039   // expression.
00040   gboolean ConfigDb_set_generic(ConfigDb* self, 
00041         const gchar* name, 
00042         const gchar* value, 
00043         GError** error);
00044 
00045 #ifdef __cplusplus
00046 } /* extern "C" */
00047 #endif
00048 
00049 #endif /* __config_db_h__ */
00050 
00051 /**
00052 
00053 config_db.h
00054 
00055 Copyright 2009 Helsinki Institute for Information Technology (HIIT)
00056 and the authors. All rights reserved.
00057 
00058 Authors: Tero Hasu <tero.hasu@hut.fi>
00059 
00060 Permission is hereby granted, free of charge, to any person
00061 obtaining a copy of this software and associated documentation files
00062 (the "Software"), to deal in the Software without restriction,
00063 including without limitation the rights to use, copy, modify, merge,
00064 publish, distribute, sublicense, and/or sell copies of the Software,
00065 and to permit persons to whom the Software is furnished to do so,
00066 subject to the following conditions:
00067 
00068 The above copyright notice and this permission notice shall be
00069 included in all copies or substantial portions of the Software.
00070 
00071 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00072 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00073 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00074 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00075 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00076 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00077 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00078 SOFTWARE.
00079 
00080  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1