1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/parse.h for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
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.
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.
16 See the COPYING file for a copy of the GNU General Public License.
24 #include <libxml/parser.h>
29 typedef struct _ObtParseInst ObtParseInst
;
31 typedef void (*ObtParseCallback
)(ObtParseInst
*i
, xmlDocPtr doc
,
32 xmlNodePtr node
, gpointer data
);
34 ObtParseInst
* obt_parse_instance_new();
35 void obt_parse_instance_ref(ObtParseInst
*inst
);
36 void obt_parse_instance_unref(ObtParseInst
*inst
);
38 gboolean
obt_parse_load_config_file(ObtParseInst
*inst
,
40 const gchar
*filename
,
41 const gchar
*root_node
);
42 gboolean
obt_parse_load_data_file(ObtParseInst
*inst
,
44 const gchar
*filename
,
45 const gchar
*root_node
);
46 gboolean
obt_parse_load_theme_file(ObtParseInst
*inst
,
49 const gchar
*filename
,
50 const gchar
*root_node
);
51 gboolean
obt_parse_load_mem(ObtParseInst
*inst
,
52 gpointer data
, guint len
, const gchar
*root_node
);
54 void obt_parse_close(ObtParseInst
*inst
);
56 void obt_parse_register(ObtParseInst
*inst
, const gchar
*tag
,
57 ObtParseCallback func
, gpointer data
);
58 void obt_parse_tree(ObtParseInst
*i
, xmlNodePtr node
);
63 xmlNodePtr
obt_parse_find_node(xmlNodePtr node
, const gchar
*tag
);
65 gboolean
obt_parse_node_contains (xmlNodePtr node
, const gchar
*val
);
66 gchar
*obt_parse_node_string (xmlNodePtr node
);
67 gint
obt_parse_node_int (xmlNodePtr node
);
68 gboolean
obt_parse_node_bool (xmlNodePtr node
);
70 gboolean
obt_parse_attr_contains (xmlNodePtr node
, const gchar
*name
,
72 gboolean
obt_parse_attr_string (xmlNodePtr node
, const gchar
*name
,
74 gboolean
obt_parse_attr_int (xmlNodePtr node
, const gchar
*name
,
76 gboolean
obt_parse_attr_bool (xmlNodePtr node
, const gchar
*name
,
81 void parse_paths_startup();
82 void parse_paths_shutdown();
84 const gchar
* parse_xdg_config_home_path();
85 const gchar
* parse_xdg_data_home_path();
86 GSList
* parse_xdg_config_dir_paths();
87 GSList
* parse_xdg_data_dir_paths();
89 /*! Expands the ~ character to the home directory throughout the given
91 gchar
*parse_expand_tilde(const gchar
*f
);
92 /*! Makes a directory */
93 gboolean
parse_mkdir(const gchar
*path
, gint mode
);
94 /*! Makes a directory and all its parents */
95 gboolean
parse_mkdir_path(const gchar
*path
, gint mode
);