Add new config parser
The current config parser, parses the ini file and pulls out the values
specified by the struct config_section passed to parse_config_file() and
then throw the rest away. This means that every place we want to get
info out of the ini file, we have to parse the whole thing again. It's not
a big overhead, but it's also not a convenient API.
This patch adds a parser that parses the ini file to a data structure and
puts that in weston_compositor->config along with API to query comfig
keys from the data structure. The old parser is still available, but
we'll transition to the new approach over the next few commits.
diff --git a/shared/config-parser.h b/shared/config-parser.h
index b4347d7..949f4d6 100644
--- a/shared/config-parser.h
+++ b/shared/config-parser.h
@@ -73,6 +73,35 @@
parse_options(const struct weston_option *options,
int count, int *argc, char *argv[]);
+struct weston_config_section;
+struct weston_config;
+
+struct weston_config_section *
+weston_config_get_section(struct weston_config *config, const char *section,
+ const char *key, const char *value);
+int
+weston_config_section_get_int(struct weston_config_section *section,
+ const char *key,
+ int32_t *value, int32_t default_value);
+int
+weston_config_section_get_uint(struct weston_config_section *section,
+ const char *key,
+ uint32_t *value, uint32_t default_value);
+int
+weston_config_section_get_string(struct weston_config_section *section,
+ const char *key,
+ char **value,
+ const char *default_value);
+int
+weston_config_section_get_bool(struct weston_config_section *section,
+ const char *key,
+ int *value, int default_value);
+struct weston_config *
+weston_config_parse(int fd);
+
+void
+weston_config_destroy(struct weston_config *config);
+
#ifdef __cplusplus
}
#endif