[librest/gwagner/deprecated: 12/14] xml: modernized
- From: Günther Wagner <gwagner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest/gwagner/deprecated: 12/14] xml: modernized
- Date: Wed, 12 Jan 2022 19:05:07 +0000 (UTC)
commit b71c932a64e4060c2cbce05aac040e1c6d7dc43f
Author: Günther Wagner <info gunibert de>
Date: Wed Dec 22 23:19:17 2021 +0100
xml: modernized
rest/rest-xml-node.h | 34 ++++++++++++++++++----------------
rest/rest-xml-parser.h | 19 +++++++++++--------
2 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/rest/rest-xml-node.h b/rest/rest-xml-node.h
index 335bd64..05a4056 100644
--- a/rest/rest-xml-node.h
+++ b/rest/rest-xml-node.h
@@ -21,8 +21,7 @@
*
*/
-#ifndef _REST_XML_NODE
-#define _REST_XML_NODE
+#pragma once
#include <glib-object.h>
@@ -39,6 +38,8 @@ G_BEGIN_DECLS
* @attrs: a #GHashTable of string name to string values for the attributes of
* the element.
* @next: the sibling #RestXmlNode with the same name
+ *
+ * The #RestXmlNode contains a parsed XmlNode for easy consumption
*/
typedef struct _RestXmlNode RestXmlNode;
struct _RestXmlNode {
@@ -54,20 +55,21 @@ struct _RestXmlNode {
GType rest_xml_node_get_type (void);
-RestXmlNode *rest_xml_node_ref (RestXmlNode *node);
-void rest_xml_node_unref (RestXmlNode *node);
-const gchar *rest_xml_node_get_attr (RestXmlNode *node,
- const gchar *attr_name);
-RestXmlNode *rest_xml_node_find (RestXmlNode *start,
- const gchar *tag);
+RestXmlNode *rest_xml_node_ref (RestXmlNode *node);
+void rest_xml_node_unref (RestXmlNode *node);
+const gchar *rest_xml_node_get_attr (RestXmlNode *node,
+ const gchar *attr_name);
+RestXmlNode *rest_xml_node_find (RestXmlNode *start,
+ const gchar *tag);
+RestXmlNode *rest_xml_node_add_child (RestXmlNode *parent,
+ const char *tag);
+char *rest_xml_node_print (RestXmlNode *node);
+void rest_xml_node_add_attr (RestXmlNode *node,
+ const char *attribute,
+ const char *value);
+void rest_xml_node_set_content (RestXmlNode *node,
+ const char *value);
-RestXmlNode *rest_xml_node_add_child (RestXmlNode *parent, const char *tag);
-char *rest_xml_node_print (RestXmlNode *node);
-void rest_xml_node_add_attr (RestXmlNode *node,
- const char *attribute,
- const char *value);
-void rest_xml_node_set_content (RestXmlNode *node, const char *value);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (RestXmlNode, rest_xml_node_unref)
G_END_DECLS
-
-#endif /* _REST_XML_NODE */
diff --git a/rest/rest-xml-parser.h b/rest/rest-xml-parser.h
index cceda02..cee2570 100644
--- a/rest/rest-xml-parser.h
+++ b/rest/rest-xml-parser.h
@@ -20,8 +20,7 @@
*
*/
-#ifndef _REST_XML_PARSER
-#define _REST_XML_PARSER
+#pragma once
#include <glib-object.h>
#include <rest/rest-xml-node.h>
@@ -31,15 +30,19 @@ G_BEGIN_DECLS
#define REST_TYPE_XML_PARSER rest_xml_parser_get_type()
G_DECLARE_DERIVABLE_TYPE (RestXmlParser, rest_xml_parser, REST, XML_PARSER, GObject)
+/**
+ * RestXmlParser:
+ *
+ * A Xml Parser for Rest Responses
+ */
+
struct _RestXmlParserClass {
GObjectClass parent_class;
};
-RestXmlParser *rest_xml_parser_new (void);
-RestXmlNode *rest_xml_parser_parse_from_data (RestXmlParser *parser,
- const gchar *data,
- goffset len);
+RestXmlParser *rest_xml_parser_new (void);
+RestXmlNode *rest_xml_parser_parse_from_data (RestXmlParser *parser,
+ const gchar *data,
+ goffset len);
G_END_DECLS
-
-#endif /* _REST_XML_PARSER */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]