TaPAS  0.2
ccl-config-table.h
Go to the documentation of this file.
1 /*
2  * ccl-config-table.h -- Configuration table
3  *
4  * This file is a part of the C Common Library (CCL) project.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Université Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the AltaRica Public License that comes with this
10  * package.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  */
16 
29 #ifndef __CCL_CONFIG_TABLE_H__
30 # define __CCL_CONFIG_TABLE_H__
31 
32 # include <ccl/ccl-common.h>
33 # include <ccl/ccl-list.h>
34 
35 BEGIN_C_DECLS
36 
40 typedef struct ccl_config_table_st ccl_config_table;
41 
45 # define ccl_config_table_create() ccl_config_table_inherits (NULL)
46 
55 extern ccl_config_table *
57 
66 extern void
68 
75 extern ccl_config_table *
77 
90 extern int
92 
105 extern void
106 ccl_config_table_set (ccl_config_table *conf, const char *name,
107  const char *value);
108 
117 extern int
118 ccl_config_table_has (ccl_config_table *conf, const char * name);
119 
133 extern const char *
134 ccl_config_table_set_if_null (ccl_config_table *conf, const char *name,
135  const char *value);
136 
145 extern void
147 
160 extern const char *
161 ccl_config_table_get (ccl_config_table *conf, const char * name);
162 
173 extern int
174 ccl_config_table_get_integer (ccl_config_table *conf, const char * name);
175 
186 extern int
187 ccl_config_table_get_boolean (ccl_config_table *conf, const char * name);
188 
200 extern ccl_list *
202 
211 extern void
212 ccl_config_table_save (ccl_config_table *conf, FILE *output);
213 
226 extern void
227 ccl_config_table_load (ccl_config_table *conf, FILE *input);
228 
235 extern void
237 
238 END_C_DECLS
239 
240 #endif /* ! __CCL_CONFIG_TABLE_H__ */
void ccl_config_table_del_reference(ccl_config_table *conf)
Removes one reference to conf.
void ccl_config_table_save(ccl_config_table *conf, FILE *output)
Writes the content of conf onto the output stream.
void ccl_config_table_display(ccl_config_table *conf)
Display on the CCL_LOG_DISPLAY stream the entries of conf.
Generic simple linked list.
ccl_config_table * ccl_config_table_inherits(ccl_config_table *parent)
Builds a locally empty table but inherits content from parent.
int ccl_config_table_has(ccl_config_table *conf, const char *name)
Checks if the table conf contains an entry for the option name.
int ccl_config_table_get_boolean(ccl_config_table *conf, const char *name)
Returns the value for the configuration option name but the value is interpreted as a Boolean value...
ccl_list * ccl_config_table_get_names(ccl_config_table *conf)
Returns the list of valued options.
const char * ccl_config_table_get(ccl_config_table *conf, const char *name)
Returns the value for the configuration option name.
void ccl_config_table_add(ccl_config_table *conf, ccl_config_table *others)
Adds all (local) preferences of others to conf.
int ccl_config_table_is_changed(ccl_config_table *conf)
Checks if the content of the table has changed.
struct ccl_config_table_st ccl_config_table
Abstract type for &quot;preferences&quot; table.
struct ccl_list_st ccl_list
Type of a generic list.
Definition: ccl-list.h:33
const char * ccl_config_table_set_if_null(ccl_config_table *conf, const char *name, const char *value)
Add the couple (name, value) if the entry does not exist.
Some useful and common macros.
void ccl_config_table_load(ccl_config_table *conf, FILE *input)
Reads configuration options from the input stream and adds them into the conf table.
void ccl_config_table_set(ccl_config_table *conf, const char *name, const char *value)
Adds the couple (name, value) into conf.
int ccl_config_table_get_integer(ccl_config_table *conf, const char *name)
Returns the value for the configuration option name but the value is interpreted as an integer...
ccl_config_table * ccl_config_table_add_reference(ccl_config_table *conf)
Adds one reference to conf.