diff options
author | Richard Hughes <richard@hughsie.com> | 2014-06-18 09:35:01 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-06-18 09:35:01 +0100 |
commit | 49a50b120251d441aa7dcf3c9d87dbf33f6b3891 (patch) | |
tree | a2f8ee023020698e2ef921bc2c54b838766e5498 | |
parent | 00419672224b0385e223a5339771f578cb547b7e (diff) | |
download | appstream-glib-49a50b120251d441aa7dcf3c9d87dbf33f6b3891.tar.gz |
trivial: Export some more useful API from AsNode
-rw-r--r-- | libappstream-glib/as-node-private.h | 15 | ||||
-rw-r--r-- | libappstream-glib/as-node.c | 1 | ||||
-rw-r--r-- | libappstream-glib/as-node.h | 16 | ||||
-rw-r--r-- | libappstream-glib/as-self-test.c | 1 |
4 files changed, 17 insertions, 16 deletions
diff --git a/libappstream-glib/as-node-private.h b/libappstream-glib/as-node-private.h index 8cd742f..29ed29b 100644 --- a/libappstream-glib/as-node-private.h +++ b/libappstream-glib/as-node-private.h @@ -33,21 +33,6 @@ G_BEGIN_DECLS gchar *as_node_take_data (const GNode *node); gchar *as_node_take_attribute (const GNode *node, const gchar *key); -void as_node_set_name (GNode *node, - const gchar *name); -void as_node_set_data (GNode *node, - const gchar *cdata, - gssize cdata_len, - AsNodeInsertFlags insert_flags); -void as_node_set_comment (GNode *node, - const gchar *comment, - gssize comment_len); -gint as_node_get_attribute_as_int (const GNode *node, - const gchar *key); -void as_node_add_attribute (GNode *node, - const gchar *key, - const gchar *value, - gssize value_len); gchar *as_node_reflow_text (const gchar *text, gssize text_len); diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c index ff36802..a85059b 100644 --- a/libappstream-glib/as-node.c +++ b/libappstream-glib/as-node.c @@ -988,7 +988,6 @@ as_node_set_data (GNode *node, * @node: a #GNode * @comment: new comment * @comment_len: length of @data, or -1 if NULL terminated - * @insert_flags: any %AsNodeInsertFlags. * * Sets new comment for the node. * diff --git a/libappstream-glib/as-node.h b/libappstream-glib/as-node.h index 5fdbdbc..ca306ea 100644 --- a/libappstream-glib/as-node.h +++ b/libappstream-glib/as-node.h @@ -114,6 +114,8 @@ 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); +gint as_node_get_attribute_as_int (const GNode *node, + const gchar *key); GHashTable *as_node_get_localized (const GNode *node, const gchar *key); const gchar *as_node_get_localized_best (const GNode *node, @@ -121,6 +123,20 @@ const gchar *as_node_get_localized_best (const GNode *node, GHashTable *as_node_get_localized_unwrap (const GNode *node, GError **error); +void as_node_set_name (GNode *node, + const gchar *name); +void as_node_set_data (GNode *node, + const gchar *cdata, + gssize cdata_len, + AsNodeInsertFlags insert_flags); +void as_node_set_comment (GNode *node, + const gchar *comment, + gssize comment_len); +void as_node_add_attribute (GNode *node, + const gchar *key, + const gchar *value, + gssize value_len); + GString *as_node_to_xml (const GNode *node, AsNodeToXmlFlags flags); GNode *as_node_from_xml (const gchar *data, diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index b98d4db..8b1540e 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -859,6 +859,7 @@ ch_test_node_func (void) g_assert_cmpstr (as_node_get_name (n1), ==, "apps"); g_assert_cmpstr (as_node_get_data (n1), ==, NULL); g_assert_cmpstr (as_node_get_attribute (n1, "version"), ==, "2"); + g_assert_cmpint (as_node_get_attribute_as_int (n1, "version"), ==, 2); g_assert_cmpstr (as_node_get_attribute (n1, "xxx"), ==, NULL); n2 = as_node_insert (n1, "id", "hal", 0, NULL); g_assert (n2 != NULL); |