The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
configcontext.c File Reference

Implements the ConfigContext class class. More...

#include <configcontext.h>
#include <memory.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for configcontext.c:

Go to the source code of this file.

Macros

#define BROKEN_G_SLIST_FREE_FULL   1
 
#define g_slist_free_full   assim_slist_free_full
 
#define JSONREPLACES   "\\\"\b\f\n\r\t"
 
#define JSONREPLACEMENTS   "\\\"bfnrt"
 
#define TOKEN_COLON   ':'
 
#define GULP   (void)g_scanner_get_next_token(scan)
 
#define SYNERROR(scan, token, symbol, msg)   {g_warning("In Function %s line %d", __FUNCTION__, __LINE__);g_scanner_unexp_token(scan, token, "keyword", "keyword", symbol, msg, TRUE);}
 

Functions

FSTATIC void _configcontext_finalize (AssimObj *aself)
 Finalize (free) a ConfigContext object. More...
 
FSTATIC enum ConfigValType _configcontext_gettype (const ConfigContext *self, const char *name)
 Return a the type of value associated with a given name. More...
 
FSTATIC ConfigValue_configcontext_getvalue (const ConfigContext *self, const char *name)
 Return a the value structure associated with a given name. More...
 
FSTATIC GSList * _configcontext_keys (const ConfigContext *cfg)
 Return a GSList of all the keys in a ConfigContext object. More...
 
FSTATIC guint _configcontext_keycount (const ConfigContext *cfg)
 Return the number of keys in a ConfigContext object. More...
 
FSTATIC gint64 _configcontext_getint (const ConfigContext *self, const char *name)
 Get an integer value. More...
 
FSTATIC void _configcontext_setint (ConfigContext *self, const char *name, gint value)
 Set a name to an integer value. More...
 
FSTATIC gboolean _configcontext_getbool (const ConfigContext *self, const char *name)
 Get an boolean value. More...
 
FSTATIC void _configcontext_setbool (ConfigContext *, const char *name, gboolean value)
 
FSTATIC const char * _configcontext_getstring (const ConfigContext *self, const char *name)
 Return the value of a string name. More...
 
FSTATIC void _configcontext_setstring (ConfigContext *self,const char *name,const char *value)
 Set a name to a string value. More...
 
FSTATIC GSList * _configcontext_getarray (const ConfigContext *, const char *name)
 
FSTATIC void _configcontext_setarray (ConfigContext *, const char *name, GSList *value)
 
FSTATIC NetAddr_configcontext_getaddr (const ConfigContext *self, const char *name)
 Return the NetAddr value of a name. More...
 
FSTATIC void _configcontext_setaddr (ConfigContext *self, const char *name, NetAddr *addr)
 Set the NetAddr value of a name. More...
 
FSTATIC Frame_configcontext_getframe (const ConfigContext *self, const char *name)
 Return the Frame class value of a name. More...
 
FSTATIC void _configcontext_setframe (ConfigContext *self, const char *name, Frame *frame)
 Set the signature frame to the given SignFrame. More...
 
FSTATIC ConfigContext_configcontext_getconfig (const ConfigContext *self, const char *name)
 Return a the a ConfigContext value associated with a given name. More...
 
FSTATIC char * _configcontext_getstr (const ConfigContext *self, const char *name)
 Return a string value (toString) associated with a given name. More...
 
FSTATIC void _configcontext_setconfig (ConfigContext *self, const char *name, ConfigContext *value)
 Save/Set a ConfigContext value associated with a given name. More...
 
FSTATIC gint _configcontext_key_compare (gconstpointer a, gconstpointer b)
 Compare two string keys (for GSList sorting) More...
 
FSTATIC char * _configcontext_toString (gconstpointer aself)
 Convert a ConfigContext to a printable string (in JSON notation) More...
 
FSTATIC char * _configcontext_elem_toString (ConfigValue *val)
 Convert a ConfigContext element (ConfigValue) to a String. More...
 
FSTATIC char * JSONquotestring (char *s)
 Escape characters in a string according to JSON conventions... More...
 
FSTATIC ConfigContext_configcontext_JSON_parse_string (const char *json)
 
FSTATIC GScanner * _configcontext_JSON_GScanner_new (void)
 Create a GScanner object that is set up to scan JSON text. More...
 
FSTATIC ConfigContext_configcontext_JSON_parse_objandEOF (GScanner *scan)
 Parse complete JSON object followed by EOF. More...
 
FSTATIC ConfigContext_configcontext_JSON_parse_object (GScanner *scan)
 Parse a JSON object. More...
 
FSTATIC ConfigContext_configcontext_JSON_parse_members (GScanner *scan, ConfigContext *cfg)
 Parse a JSON (object) members (a list of "name" : "value" pairs) More...
 
FSTATIC ConfigContext_configcontext_JSON_parse_pair (GScanner *scan, ConfigContext *cfg)
 
FSTATIC ConfigValue_configcontext_JSON_parse_value (GScanner *scan)
 
FSTATIC gboolean _configcontext_JSON_parse_array (GScanner *scan, GSList **retval)
 
FSTATIC ConfigValue_configcontext_value_new (enum ConfigValType t)
 Create a ConfigValue object (containing an object and its type) More...
 
FSTATIC void _configcontext_value_vfinalize (gpointer vself)
 
FSTATIC void _configcontext_value_finalize (AssimObj *aself)
 
FSTATIC void _key_free (gpointer vself)
 
void assim_slist_free_full (GSList *list, void(*)(gpointer))
 
ConfigContextconfigcontext_new (gsize objsize)
 Construct a new ConfigContext object - with no values defaulted. More...
 
FSTATIC void _configcontext_setbool (ConfigContext *self, const char *name, gint value)
 Set a name to an integer value. More...
 
FSTATIC void _configcontext_value_vfinalize (void *vself)
 Finalize (free) a ConfigValue object. More...
 
ConfigContextconfigcontext_new_JSON_string (const char *jsontext)
 Construct a ConfigContext object from the given JSON string. More...
 

Detailed Description

Implements the ConfigContext class class.

This file provides a place to remember and pass configuration values around.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file configcontext.c.

Macro Definition Documentation

#define BROKEN_G_SLIST_FREE_FULL   1

Definition at line 29 of file configcontext.c.

#define g_slist_free_full   assim_slist_free_full

Function Documentation

FSTATIC ConfigContext* _configcontext_JSON_parse_string ( const char *  json)
FSTATIC void _configcontext_setbool ( ConfigContext ,
const char *  name,
gboolean  value 
)

Referenced by configcontext_new().

Here is the caller graph for this function:

FSTATIC void _configcontext_value_vfinalize ( gpointer  vself)

Referenced by _configcontext_JSON_parse_array(), _configcontext_value_finalize(), and configcontext_new().

Here is the caller graph for this function: