From 517e0fb9dfd1fddd57ee62b9bb64efb0d29a0834 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 23 May 2014 15:21:56 +0100 Subject: Add as_node_get_comment() Comments are stored as internal attributes to avoid growing the size of AsNodeData beyond 32 bits, although there is a performance penalty for this. As comments are not often encountered in documents (and not at all in the AppStream metadata fast path) this is probably okay. By default comments are not loaded from the document, use %AS_NODE_FROM_XML_FLAG_KEEP_COMMENTS when loading to enable this. --- libappstream-glib/as-node.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libappstream-glib/as-node.h') diff --git a/libappstream-glib/as-node.h b/libappstream-glib/as-node.h index 693905d..fa45356 100644 --- a/libappstream-glib/as-node.h +++ b/libappstream-glib/as-node.h @@ -58,12 +58,14 @@ typedef enum { * AsNodeFromXmlFlags: * @AS_NODE_FROM_XML_FLAG_NONE: No extra flags to use * @AS_NODE_FROM_XML_FLAG_LITERAL_TEXT: Treat the text as an exact string + * @AS_NODE_FROM_XML_FLAG_KEEP_COMMENTS: Retain comments in the XML file * * The flags for converting from XML. **/ typedef enum { AS_NODE_FROM_XML_FLAG_NONE = 0, /* Since: 0.1.0 */ AS_NODE_FROM_XML_FLAG_LITERAL_TEXT = 1, /* Since: 0.1.3 */ + AS_NODE_FROM_XML_FLAG_KEEP_COMMENTS = 2, /* Since: 0.1.6 */ /*< private >*/ AS_NODE_FROM_XML_FLAG_LAST } AsNodeFromXmlFlags; @@ -108,6 +110,7 @@ void as_node_unref (GNode *node); const gchar *as_node_get_name (const GNode *node); const gchar *as_node_get_data (const GNode *node); +const gchar *as_node_get_comment (const GNode *node); AsTag as_node_get_tag (const GNode *node); const gchar *as_node_get_attribute (const GNode *node, const gchar *key); -- cgit v1.2.1