]> Dogcows Code - chaz/openbox/blob - parser/parse.h
off by one error
[chaz/openbox] / parser / parse.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 parse.h for the Openbox window manager
4 Copyright (c) 2003 Ben 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 __parse_h
20 #define __parse_h
21
22 #include <libxml/parser.h>
23 #include <glib.h>
24
25 typedef struct _ObParseInst ObParseInst;
26
27 typedef void (*ParseCallback)(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
28 gpointer data);
29
30 ObParseInst* parse_startup();
31 void parse_shutdown(ObParseInst *inst);
32
33 /* Loads Openbox's rc, from the normal paths */
34 gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root);
35 /* Loads an Openbox menu, from the normal paths */
36 gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root);
37
38 void parse_register(ObParseInst *inst, const char *tag,
39 ParseCallback func, gpointer data);
40 void parse_tree(ObParseInst *inst, xmlDocPtr doc, xmlNodePtr node);
41
42
43 /* open/close */
44
45 gboolean parse_load(const char *path, const char *rootname,
46 xmlDocPtr *doc, xmlNodePtr *root);
47 gboolean parse_load_mem(gpointer data, guint len, const char *rootname,
48 xmlDocPtr *doc, xmlNodePtr *root);
49 void parse_close(xmlDocPtr doc);
50
51
52 /* helpers */
53
54 xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node);
55
56 char *parse_string(xmlDocPtr doc, xmlNodePtr node);
57 int parse_int(xmlDocPtr doc, xmlNodePtr node);
58 gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node);
59
60 gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node);
61 gboolean parse_attr_contains(const char *val, xmlNodePtr node,
62 const char *name);
63
64 gboolean parse_attr_string(const char *name, xmlNodePtr node, char **value);
65 gboolean parse_attr_int(const char *name, xmlNodePtr node, int *value);
66
67 /* paths */
68
69 void parse_paths_startup();
70 void parse_paths_shutdown();
71
72 const gchar* parse_xdg_config_home_path();
73 const gchar* parse_xdg_data_home_path();
74 GSList* parse_xdg_config_dir_paths();
75 GSList* parse_xdg_data_dir_paths();
76
77 /*! Expands the ~ character to the home directory throughout the given
78 string */
79 gchar *parse_expand_tilde(const gchar *f);
80 /*! Makes a directory and all its parents */
81 void parse_mkdir_path(const gchar *path, gint mode);
82
83 #endif
This page took 0.038125 seconds and 4 git commands to generate.