2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 * @brief Initializes config module.
25 * @return 0 on success, other value on error.
27 * @note config module reads/writes configuration stored in
28 * application's "data" directory in "config.ini" file.
33 * @brief Flush config to disk.
35 * @return 0 on success, other value on error.
40 * @brief Shutdowns config module.
42 void config_shutdown();
45 * @brief Get string value
47 * @param[in] group configuration group to which @key belongs
48 * @param[in] key configuration key name.
49 * @param[out] out value stored in configuration for given group and key.
51 * @return 0 on success, other if value for given group with key do not exist.
53 * @note @config_init should be called before using this function
54 * @note @out should be released with @free
56 int config_get_string(const char *group, const char *key, char **out);
59 * @brief Sets string value
61 * @param[in] group configuration group to which @key belongs
62 * @param[in] key configuration key name.
63 * @param[in] value to be stored in configuration for given group and key.
65 * @note @config_init should be called before using this function
67 void config_set_string(const char *group, const char *key, const char *value);
70 * @brief Get integer value
72 * @param[in] group configuration group to which @key belongs
73 * @param[in] key configuration key name.
74 * @param[out] out value stored in configuration for given group and key.
76 * @return 0 on success, other if value for given group with key do not exist.
78 * @note @config_init should be called before using this function
80 int config_get_int(const char *group, const char *key, int *out);
83 * @brief Set integer value
85 * @param[in] group configuration group to which @key belongs
86 * @param[in] key configuration key name.
87 * @param[in] value to be stored in configuration for given group and key.
89 * @note @config_init should be called before using this function
91 void config_set_int(const char *group, const char *key, int value);
94 * @brief Get double value
96 * @param[in] group configuration group to which @key belongs
97 * @param[in] key configuration key name.
98 * @param[out] out value stored in configuration for given group and key.
100 * @return 0 on success, other if value for given group with key do not exist.
102 * @note @config_init should be called before using this function
104 int config_get_double(const char *group, const char *key, double *out);
107 * @brief Set double value
109 * @param[in] group configuration group to which @key belongs
110 * @param[in] key configuration key name.
111 * @param[in] value to be stored in configuration for given group and key.
113 * @note @config_init should be called before using this function
115 void config_set_double(const char *group, const char *key, double value);
118 * @brief Get boolean value
120 * @param[in] group configuration group to which @key belongs
121 * @param[in] key configuration key name.
122 * @param[out] out value stored in configuration for given group and key.
124 * @return 0 on success, other if value for given group with key do not exist.
126 * @note @config_init should be called before using this function
128 int config_get_bool(const char *group, const char *key, bool *out);
131 * @brief Set boolean value
133 * @param[in] group configuration group to which @key belongs
134 * @param[in] key configuration key name.
135 * @param[in] value to be stored in configuration for given group and key.
137 * @note @config_init should be called before using this function
139 void config_set_bool(const char *group, const char *key, bool value);
142 * @brief Remove key from config.
144 * @param[in] group configuration group to which @key belongs
145 * @param[in] key configuration key name.
147 * @note @config_init should be called before using this function
149 int config_remove_key(const char *group, const char *key);
152 * @brief Remove group from config. Removes all keys assigned to this group.
154 * @param[in] group configuration group name.
156 * @note @config_init should be called before using this function
158 int config_remove_group(const char *group);
160 #endif /* end of include guard: CONFIG_H */