Lumiera  0.pre.03
»edit your freedom«
configitem.h
Go to the documentation of this file.
1 /*
2  CONFIGITEM.h - generalised hierarchy of configuration items
3 
4  Copyright (C)
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
45 #ifndef COMMON_CONFIGITEM_H
46 #define COMMON_CONFIGITEM_H
47 
48 
49 #include "lib/llist.h"
50 
51 /* Forward declarations */
52 typedef struct lumiera_configitem_struct lumiera_configitem;
53 typedef lumiera_configitem* LumieraConfigitem;
54 
56 
57 #include "common/config-lookup.h"
58 
59 #include <nobug.h>
60 
61 
62 
64 {
65  LumieraConfigitem (*newitem)(LumieraConfigitem);
66  LumieraConfigitem (*destroy)(LumieraConfigitem);
67 };
68 
70 {
71  llist link; // all lines on the same hierarchy level are linked here (see children)
72  LumieraConfigitem parent; // parent section
73  llist children; // root node for all lines below this hierarchy
74 
75  llist lookup; // all lines with the same key are stacked up on the lookup
76 
77  char* line; // raw line as read in allocated here trailing \n will be replaced with \0
78  char* key; // pointer into line to start of key
79  size_t key_size;
80  char* delim; // delimiter, value starts at delim+1
81  struct lumiera_configitem_vtable* vtable; // functiontable for subclassing
82 };
83 
84 
85 LumieraConfigitem
86 lumiera_configitem_init (LumieraConfigitem self);
87 
88 LumieraConfigitem
89 lumiera_configitem_destroy (LumieraConfigitem self, LumieraConfigLookup lookup);
90 
91 LumieraConfigitem
92 lumiera_configitem_new (const char* line);
93 
94 void
95 lumiera_configitem_delete (LumieraConfigitem self, LumieraConfigLookup lookup);
96 
97 LumieraConfigitem
98 lumiera_configitem_set_value (LumieraConfigitem self, const char* delim_value);
99 
100 LumieraConfigitem
101 lumiera_configitem_parse (LumieraConfigitem self, const char* line);
102 
103 LumieraConfigitem
104 lumiera_configitem_move (LumieraConfigitem self, LumieraConfigitem dest);
105 
106 
107 #endif /*COMMON_CONFIGITEM_H*/
108 /*
109 // Local Variables:
110 // mode: C
111 // c-file-style: "gnu"
112 // indent-tabs-mode: nil
113 // End:
114 */
Lookup of configuration keys in a low-level configuration system.
Intrusive cyclic double linked list There is only one node type which contains a forward and a backwa...