2003-04-02 07:46:46 +00:00
|
|
|
#ifndef __parse_h
|
|
|
|
#define __parse_h
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
#include <libxml/parser.h>
|
2003-04-02 07:46:46 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
typedef void (*ParseCallback)(xmlDocPtr doc, xmlNodePtr node, void *data);
|
2003-04-02 07:46:46 +00:00
|
|
|
|
|
|
|
void parse_startup();
|
|
|
|
void parse_shutdown();
|
|
|
|
|
2003-05-24 21:47:06 +00:00
|
|
|
/* Loads Openbox's rc, from $HOME or $PREFIX as a fallback */
|
|
|
|
gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root);
|
2003-05-24 15:35:26 +00:00
|
|
|
|
2003-05-24 21:47:06 +00:00
|
|
|
/* callbacks - must call parse_startup to use these */
|
2003-05-24 15:35:26 +00:00
|
|
|
|
2003-05-24 21:47:06 +00:00
|
|
|
void parse_register(const char *tag, ParseCallback func, void *data);
|
2003-05-24 15:35:26 +00:00
|
|
|
void parse_tree(xmlDocPtr doc, xmlNodePtr node, void *nothing);
|
|
|
|
|
|
|
|
|
2003-05-24 21:47:06 +00:00
|
|
|
/* open/close */
|
|
|
|
|
|
|
|
gboolean parse_load(const char *path, const char *rootname,
|
|
|
|
xmlDocPtr *doc, xmlNodePtr *root);
|
|
|
|
void parse_close(xmlDocPtr doc);
|
|
|
|
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
/* helpers */
|
|
|
|
|
|
|
|
xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node);
|
2003-04-02 07:46:46 +00:00
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
char *parse_string(xmlDocPtr doc, xmlNodePtr node);
|
|
|
|
int parse_int(xmlDocPtr doc, xmlNodePtr node);
|
|
|
|
gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node);
|
2003-04-02 07:46:46 +00:00
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node);
|
|
|
|
gboolean parse_attr_contains(const char *val, xmlNodePtr node,
|
|
|
|
const char *name);
|
2003-04-02 07:46:46 +00:00
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
gboolean parse_attr_string(const char *name, xmlNodePtr node, char **value);
|
|
|
|
gboolean parse_attr_int(const char *name, xmlNodePtr node, int *value);
|
2003-04-02 07:46:46 +00:00
|
|
|
|
|
|
|
#endif
|