aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmltree.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xmltree.h')
-rw-r--r--lib/xmltree.h80
1 files changed, 37 insertions, 43 deletions
diff --git a/lib/xmltree.h b/lib/xmltree.h
index af13b859..85b10983 100644
--- a/lib/xmltree.h
+++ b/lib/xmltree.h
@@ -24,79 +24,73 @@
#ifndef _XMLTREE_H
#define _XMLTREE_H
-typedef enum
-{
- XT_COMPLETE = 1, /* </tag> reached */
- XT_SEEN = 2, /* Handler called (or not defined) */
+typedef enum {
+ XT_COMPLETE = 1, /* </tag> reached */
+ XT_SEEN = 2, /* Handler called (or not defined) */
} xt_flags;
-typedef enum
-{
- XT_ABORT, /* Abort, don't handle the rest anymore */
- XT_HANDLED, /* Handled this tag properly, go to the next one */
- XT_NEXT /* Try if there's another matching handler */
+typedef enum {
+ XT_ABORT, /* Abort, don't handle the rest anymore */
+ XT_HANDLED, /* Handled this tag properly, go to the next one */
+ XT_NEXT /* Try if there's another matching handler */
} xt_status;
-struct xt_attr
-{
+struct xt_attr {
char *key, *value;
};
-struct xt_node
-{
+struct xt_node {
struct xt_node *parent;
struct xt_node *children;
-
+
char *name;
struct xt_attr *attr;
char *text;
int text_len;
-
+
struct xt_node *next;
xt_flags flags;
};
-typedef xt_status (*xt_handler_func) ( struct xt_node *node, gpointer data );
+typedef xt_status (*xt_handler_func) (struct xt_node *node, gpointer data);
-struct xt_handler_entry
-{
+struct xt_handler_entry {
char *name, *parent;
xt_handler_func func;
};
-struct xt_parser
-{
+struct xt_parser {
GMarkupParseContext *parser;
struct xt_node *root;
struct xt_node *cur;
-
+
const struct xt_handler_entry *handlers;
gpointer data;
-
+
GError *gerr;
};
-struct xt_parser *xt_new( const struct xt_handler_entry *handlers, gpointer data );
-void xt_reset( struct xt_parser *xt );
-int xt_feed( struct xt_parser *xt, const char *text, int text_len );
-int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth );
-void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth );
-struct xt_node *xt_from_string( const char *in, int text_len );
-char *xt_to_string( struct xt_node *node );
-char *xt_to_string_i( struct xt_node *node );
-void xt_print( struct xt_node *node );
-struct xt_node *xt_dup( struct xt_node *node );
-void xt_free_node( struct xt_node *node );
-void xt_free( struct xt_parser *xt );
-struct xt_node *xt_find_node( struct xt_node *node, const char *name );
-struct xt_node *xt_find_path( struct xt_node *node, const char *name );
-char *xt_find_attr( struct xt_node *node, const char *key );
-struct xt_node *xt_find_node_by_attr( struct xt_node *xt, const char *tag, const char *key, const char *value );
+struct xt_parser *xt_new(const struct xt_handler_entry *handlers, gpointer data);
+void xt_reset(struct xt_parser *xt);
+int xt_feed(struct xt_parser *xt, const char *text, int text_len);
+int xt_handle(struct xt_parser *xt, struct xt_node *node, int depth);
+void xt_cleanup(struct xt_parser *xt, struct xt_node *node, int depth);
+struct xt_node *xt_from_string(const char *in, int text_len);
+char *xt_to_string(struct xt_node *node);
+char *xt_to_string_i(struct xt_node *node);
+void xt_print(struct xt_node *node);
+struct xt_node *xt_dup(struct xt_node *node);
+void xt_free_node(struct xt_node *node);
+void xt_free(struct xt_parser *xt);
+struct xt_node *xt_find_node(struct xt_node *node, const char *name);
+struct xt_node *xt_find_path(struct xt_node *node, const char *name);
+char *xt_find_attr(struct xt_node *node, const char *key);
+struct xt_node *xt_find_node_by_attr(struct xt_node *xt, const char *tag, const char *key, const char *value);
-struct xt_node *xt_new_node( char *name, const char *text, struct xt_node *children );
-void xt_add_child( struct xt_node *parent, struct xt_node *child );
-void xt_insert_child( struct xt_node *parent, struct xt_node *child );
-void xt_add_attr( struct xt_node *node, const char *key, const char *value );
-int xt_remove_attr( struct xt_node *node, const char *key );
+struct xt_node *xt_new_node(char *name, const char *text, struct xt_node *children);
+void xt_add_child(struct xt_node *parent, struct xt_node *child);
+void xt_insert_child(struct xt_node *parent, struct xt_node *child);
+void xt_add_attr(struct xt_node *node, const char *key, const char *value);
+int xt_remove_attr(struct xt_node *node, const char *key);
#endif