Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
configitem.h
Go to the documentation of this file.
1 /*
2  CONFIGITEM.h - generalised hierarchy of configuration items
3 
4  Copyright (C) Lumiera.org
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
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. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
54 #ifndef COMMON_CONFIGITEM_H
55 #define COMMON_CONFIGITEM_H
56 
57 
58 #include "lib/llist.h"
59 
60 /* Forward declarations */
61 typedef struct lumiera_configitem_struct lumiera_configitem;
62 typedef lumiera_configitem* LumieraConfigitem;
63 
65 
66 #include "common/config-lookup.h"
67 
68 #include <nobug.h>
69 
70 
71 
73 {
76 };
77 
79 {
80  llist link; // all lines on the same hierarchy level are linked here (see children)
81  LumieraConfigitem parent; // parent section
82  llist children; // root node for all lines below this hierarchy
83 
84  llist lookup; // all lines with the same key are stacked up on the lookup
85 
86  char* line; // raw line as read in allocated here trailing \n will be replaced with \0
87  char* key; // pointer into line to start of key
88  size_t key_size;
89  char* delim; // delimiter, value starts at delim+1
90  struct lumiera_configitem_vtable* vtable; // functiontable for subclassing
91 };
92 
93 
96 
99 
101 lumiera_configitem_new (const char* line);
102 
103 void
105 
107 lumiera_configitem_set_value (LumieraConfigitem self, const char* delim_value);
108 
110 lumiera_configitem_parse (LumieraConfigitem self, const char* line);
111 
114 
115 
116 #endif /*COMMON_CONFIGITEM_H*/
117 /*
118 // Local Variables:
119 // mode: C
120 // c-file-style: "gnu"
121 // indent-tabs-mode: nil
122 // End:
123 */
LumieraConfigitem lumiera_configitem_new(const char *line)
Definition: configitem.c:105
LumieraConfigitem lumiera_configitem_set_value(LumieraConfigitem self, const char *delim_value)
Definition: configitem.c:131
lumiera_configitem * LumieraConfigitem
Definition: configitem.h:62
LumieraConfigitem parent
Definition: configitem.h:81
void lumiera_configitem_delete(LumieraConfigitem self, LumieraConfigLookup lookup)
Definition: configitem.c:123
LumieraConfigitem lumiera_configitem_destroy(LumieraConfigitem self, LumieraConfigLookup lookup)
Definition: configitem.c:79
LumieraConfigitem(* newitem)(LumieraConfigitem)
Definition: configitem.h:74
lumiera_config_lookup * LumieraConfigLookup
Definition: config-lookup.h:45
LumieraConfigitem lumiera_configitem_init(LumieraConfigitem self)
Definition: configitem.c:56
Lookup of configuration keys in a low-level configuration system.
LumieraConfigitem lumiera_configitem_parse(LumieraConfigitem self, const char *line)
Definition: configitem.c:174
struct lumiera_configitem_vtable * vtable
Definition: configitem.h:90
LumieraConfigitem lumiera_configitem_move(LumieraConfigitem self, LumieraConfigitem dest)
Definition: configitem.c:144
Intrusive cyclic double linked list There is only one node type which contains a forward and a backwa...
LumieraConfigitem(* destroy)(LumieraConfigitem)
Definition: configitem.h:75