]> Dogcows Code - chaz/openbox/blob - obt/parse.h
add obt_parse_tree_from_root and use it, cuz it's nice
[chaz/openbox] / obt / parse.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 obt/parse.h for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __obt_parse_h
20 #define __obt_parse_h
21
22 #include "version.h"
23
24 #include <libxml/parser.h>
25 #include <glib.h>
26
27 G_BEGIN_DECLS
28
29 typedef struct _ObtParseInst ObtParseInst;
30
31 typedef void (*ObtParseCallback)(xmlNodePtr node, gpointer data);
32
33 ObtParseInst* obt_parse_instance_new();
34 void obt_parse_instance_ref(ObtParseInst *inst);
35 void obt_parse_instance_unref(ObtParseInst *inst);
36
37 gboolean obt_parse_load_file(ObtParseInst *inst,
38 const gchar *path,
39 const gchar *root_node);
40 gboolean obt_parse_load_config_file(ObtParseInst *inst,
41 const gchar *domain,
42 const gchar *filename,
43 const gchar *root_node);
44 gboolean obt_parse_load_data_file(ObtParseInst *inst,
45 const gchar *domain,
46 const gchar *filename,
47 const gchar *root_node);
48 gboolean obt_parse_load_theme_file(ObtParseInst *inst,
49 const gchar *theme,
50 const gchar *domain,
51 const gchar *filename,
52 const gchar *root_node);
53 gboolean obt_parse_load_mem(ObtParseInst *inst,
54 gpointer data, guint len, const gchar *root_node);
55
56 xmlDocPtr obt_parse_instance_doc(ObtParseInst *inst);
57 xmlNodePtr obt_parse_instance_root(ObtParseInst *inst);
58
59 void obt_parse_close(ObtParseInst *inst);
60
61 void obt_parse_register(ObtParseInst *inst, const gchar *tag,
62 ObtParseCallback func, gpointer data);
63 void obt_parse_tree(ObtParseInst *i, xmlNodePtr node);
64 void obt_parse_tree_from_root(ObtParseInst *i);
65
66
67 /* helpers */
68
69 xmlNodePtr obt_parse_find_node(xmlNodePtr node, const gchar *name);
70
71 gboolean obt_parse_node_contains (xmlNodePtr node, const gchar *val);
72 gchar *obt_parse_node_string (xmlNodePtr node);
73 gint obt_parse_node_int (xmlNodePtr node);
74 gboolean obt_parse_node_bool (xmlNodePtr node);
75
76 gboolean obt_parse_attr_contains (xmlNodePtr node, const gchar *name,
77 const gchar *val);
78 gboolean obt_parse_attr_string (xmlNodePtr node, const gchar *name,
79 gchar **value);
80 gboolean obt_parse_attr_int (xmlNodePtr node, const gchar *name,
81 gint *value);
82 gboolean obt_parse_attr_bool (xmlNodePtr node, const gchar *name,
83 gboolean *value);
84
85 /* paths */
86
87 void parse_paths_startup();
88 void parse_paths_shutdown();
89
90 const gchar* parse_xdg_config_home_path();
91 const gchar* parse_xdg_data_home_path();
92 GSList* parse_xdg_config_dir_paths();
93 GSList* parse_xdg_data_dir_paths();
94
95 /*! Expands the ~ character to the home directory throughout the given
96 string */
97 gchar *parse_expand_tilde(const gchar *f);
98 /*! Makes a directory */
99 gboolean parse_mkdir(const gchar *path, gint mode);
100 /*! Makes a directory and all its parents */
101 gboolean parse_mkdir_path(const gchar *path, gint mode);
102
103 G_END_DECLS
104
105 #endif
This page took 0.043153 seconds and 5 git commands to generate.