summaryrefslogtreecommitdiff
path: root/src/lib/efreet/efreet_ini.h
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-29 23:04:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-29 23:04:40 +0000
commit4bc0210bd31ed1de6554441562bd93ea863ee9d9 (patch)
tree5d83be12538f8c8d3816bbf65916ce383d050c2e /src/lib/efreet/efreet_ini.h
parent727ddbeaf0c53f31cd62c254fdebe26823d537eb (diff)
efl: merge efreet.
seems to be fine, pass distcheck and friends. please report. changes: - documentation hierarchy fixes - replaced __UNUSED__ with EINA_UNUSED - replaced PKG_DATA_DIR with PACKAGE_DATA_DIR"/efreet" SVN revision: 81889
Diffstat (limited to 'src/lib/efreet/efreet_ini.h')
-rw-r--r--src/lib/efreet/efreet_ini.h182
1 files changed, 182 insertions, 0 deletions
diff --git a/src/lib/efreet/efreet_ini.h b/src/lib/efreet/efreet_ini.h
new file mode 100644
index 0000000..2dec08a
--- /dev/null
+++ b/src/lib/efreet/efreet_ini.h
@@ -0,0 +1,182 @@
1#ifndef EFREET_INI_H
2#define EFREET_INI_H
3
4/**
5 * @internal
6 * @file efreet_ini.h
7 * @brief A simple and fast INI parser
8 * @addtogroup Efreet_Ini Efreet_Ini: An INI parser
9 * @ingroup Efreet
10 *
11 * @{
12 */
13
14/**
15 * Efreet_Ini
16 */
17typedef struct Efreet_Ini Efreet_Ini;
18
19/**
20 * Efreet_Ini
21 * @brief Contains all the information about an ini file.
22 */
23struct Efreet_Ini
24{
25 Eina_Hash *data; /**< Hash of string => (Hash of string => string) */
26 Eina_Hash *section; /**< currently selected section */
27};
28
29
30/**
31 * @param file The file to parse
32 * @return Returns a new Efreet_Ini structure initialized with the contents
33 * of @a file, or NULL on memory allocation failure
34 * @brief Creates and initializes a new Ini structure with the contents of
35 * @a file, or NULL on failure
36 */
37EAPI Efreet_Ini *efreet_ini_new(const char *file);
38
39/**
40 * @param ini The Efreet_Ini to work with
41 * @return Returns no value
42 * @brief Frees the given Efree_Ini structure.
43 */
44EAPI void efreet_ini_free(Efreet_Ini *ini);
45
46/**
47 * @param ini The Efreet_Ini to work with
48 * @param file The file to load
49 * @return Returns no value
50 * @brief Saves the given Efree_Ini structure.
51 */
52EAPI int efreet_ini_save(Efreet_Ini *ini, const char *path);
53
54
55/**
56 * @param ini The Efreet_Ini to work with
57 * @param section The section of the ini file we want to get values from
58 * @return Returns 1 if the section exists, otherwise 0
59 * @brief Sets the current working section of the ini file to @a section
60 */
61EAPI int efreet_ini_section_set(Efreet_Ini *ini, const char *section);
62
63/**
64 * @param ini The Efreet_Ini to work with
65 * @param section The section of the ini file we want to add
66 * @return Returns no value
67 * @brief Adds a new working section of the ini file to @a section
68 */
69EAPI void efreet_ini_section_add(Efreet_Ini *ini, const char *section);
70
71
72/**
73 * @param ini The Efree_Ini to work with
74 * @param key The key to lookup
75 * @return Returns the string associated with the given key or NULL if not
76 * found.
77 * @brief Retrieves the value for the given key or NULL if none found.
78 */
79EAPI const char *efreet_ini_string_get(Efreet_Ini *ini, const char *key);
80
81/**
82 * @param ini The Efree_Ini to work with
83 * @param key The key to use
84 * @param value The value to set
85 * @return Returns no value
86 * @brief Sets the value for the given key
87 */
88EAPI void efreet_ini_string_set(Efreet_Ini *ini, const char *key,
89 const char *value);
90
91
92/**
93 * @param ini The ini struct to work with
94 * @param key The key to search for
95 * @return Returns the utf8 encoded string associated with @a key, or NULL
96 * if none found
97 * @brief Retrieves the utf8 encoded string associated with @a key in the current locale or NULL if none found
98 */
99EAPI const char *efreet_ini_localestring_get(Efreet_Ini *ini, const char *key);
100
101/**
102 * @param ini The ini struct to work with
103 * @param key The key to use
104 * @param value The value to set
105 * @return Returns no value
106 * @brief Sets the value for the given key
107 */
108EAPI void efreet_ini_localestring_set(Efreet_Ini *ini, const char *key,
109 const char *value);
110
111
112/**
113 * @param ini The ini struct to work with
114 * @param key The key to search for
115 * @return Returns 1 if the boolean is true, 0 otherwise
116 * @brief Retrieves the boolean value at key @a key from the ini @a ini
117 */
118EAPI unsigned int efreet_ini_boolean_get(Efreet_Ini *ini, const char *key);
119
120/**
121 * @param ini The ini struct to work with
122 * @param key The key to use
123 * @param value The value to set
124 * @return Returns no value
125 * @brief Sets the value for the given key
126 */
127EAPI void efreet_ini_boolean_set(Efreet_Ini *ini, const char *key,
128 unsigned int value);
129
130
131/**
132 * @param ini The Efree_Ini to work with
133 * @param key The key to lookup
134 * @return Returns the integer associated with the given key or -1 if not
135 * found.
136 * @brief Retrieves the value for the given key or -1 if none found.
137 */
138EAPI int efreet_ini_int_get(Efreet_Ini *ini, const char *key);
139
140/**
141 * @param ini The Efree_Ini to work with
142 * @param key The key to use
143 * @param value The value to set
144 * @return Returns no value
145 * @brief Sets the value for the given key
146 */
147EAPI void efreet_ini_int_set(Efreet_Ini *ini, const char *key, int value);
148
149
150/**
151 * @param ini The Efree_Ini to work with
152 * @param key The key to lookup
153 * @return Returns the double associated with the given key or -1 if not
154 * found.
155 * @brief Retrieves the value for the given key or -1 if none found.
156 */
157EAPI double efreet_ini_double_get(Efreet_Ini *ini, const char *key);
158
159/**
160 * @param ini The Efree_Ini to work with
161 * @param key The key to use
162 * @param value The value to set
163 * @return Returns no value
164 * @brief Sets the value for the given key
165 */
166EAPI void efreet_ini_double_set(Efreet_Ini *ini, const char *key,
167 double value);
168
169
170/**
171 * @param ini The ini struct to work with
172 * @param key The key to remove
173 * @return Returns no value
174 * @brief Remove the given key from the ini struct
175 */
176EAPI void efreet_ini_key_unset(Efreet_Ini *ini, const char *key);
177
178/**
179 * @}
180 */
181
182#endif