New function, to get the stack of open elements. (#452887, Ryan Lortie)
authorMatthias Clasen <mclasen@redhat.com>
Thu, 8 Nov 2007 03:28:09 +0000 (03:28 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 8 Nov 2007 03:28:09 +0000 (03:28 +0000)
2007-11-07  Matthias Clasen <mclasen@redhat.com>

        * glib/glib.symbols:
        * glib/gmarkup.[hc] (g_markup_parse_context_get_element_stack):
        New function, to get the stack of open elements.  (#452887,
        Ryan Lortie)

svn path=/trunk/; revision=5816

ChangeLog
docs/reference/ChangeLog
docs/reference/glib/glib-sections.txt
glib/glib.symbols
glib/gmarkup.c
glib/gmarkup.h

index fd57c2d835de41ff92c1ede57cc161ce5f76305c..26fd61051ae1eeda605485af19cb2227ce495cfa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-07  Matthias Clasen <mclasen@redhat.com>
+
+       * glib/glib.symbols:
+       * glib/gmarkup.[hc] (g_markup_parse_context_get_element_stack): 
+       New function, to get the stack of open elements.  (#452887,
+       Ryan Lortie)
+
 2007-11-07  Matthias Clasen <mclasen@redhat.com>
 
        * glib/gkeyfile.[hc]: Make some functions that take
index e11df929d4dc85ae7cbb0d3368ad216df1b674f3..38975c66acba35d7a94099e6222b3a09e19e8b80 100644 (file)
@@ -1,5 +1,8 @@
 2007-11-07  Matthias Clasen <mclasen@redhat.com>
 
+       * glib/glib-sections.txt: Add g_markup_parse_context_get_element_stack
+2007-11-07  Matthias Clasen <mclasen@redhat.com>
+
        * glib/building.sgml: Fix a typo
 
 2007-11-07  Matthias Clasen <mclasen@redhat.com>
index b815824aa0d2f3bc37e64565d401798a74ae5c10..d07ae531fd6f70b6092c00efbc814b9744159bbd 100644 (file)
@@ -994,6 +994,7 @@ g_markup_parse_context_end_parse
 g_markup_parse_context_free
 g_markup_parse_context_get_position
 g_markup_parse_context_get_element
+g_markup_parse_context_get_element_stack
 g_markup_parse_context_new
 g_markup_parse_context_parse
 <SUBSECTION Private>
index ac0907f59342bb0c69a24e4d5e24c27872a15ca4..6e4e7876d60502ca71993e0727fcba7642215867 100644 (file)
@@ -644,6 +644,7 @@ g_markup_escape_text
 g_markup_parse_context_end_parse
 g_markup_parse_context_free
 g_markup_parse_context_get_element
+g_markup_parse_context_get_element_stack
 g_markup_parse_context_get_position
 g_markup_parse_context_new
 g_markup_parse_context_parse
index 4c941590f403885b93e1d249fe6c8d8c56700e8a..35c37f595cdb8f18bdf933835a95fd71ba56b297 100644 (file)
@@ -1856,6 +1856,10 @@ g_markup_parse_context_end_parse (GMarkupParseContext *context,
  *
  * Retrieves the name of the currently open element.
  *
+ * If called from the start_element or end_element handlers this will
+ * give the element_name as passed to those functions. For the parent
+ * elements, see g_markup_parse_context_get_element_stack().
+ *
  * Since: 2.2
  **/
 G_CONST_RETURN gchar *
@@ -1869,6 +1873,33 @@ g_markup_parse_context_get_element (GMarkupParseContext *context)
     return current_element (context);
 } 
 
+/**
+ * g_markup_parse_context_get_element_stack:
+ * @context: a #GMarkupParseContext
+ *
+ * Retrieves the element stack from the internal state of the parser.
+ * The returned #GSList is a list of strings where the first item is
+ * the currently open tag (as would be returned by
+ * g_markup_parse_context_get_element()) and the next item is its
+ * immediate parent.
+ *
+ * This function is intended to be used in the start_element and
+ * end_element handlers where g_markup_parse_context_get_element()
+ * would merely return the name of the element that is being
+ * processed.
+ *
+ * Returns: the element stack, which must not be modified
+ *
+ * Since 2.16
+ **/
+G_CONST_RETURN GSList *
+g_markup_parse_context_get_element_stack (GMarkupParseContext *context)
+{
+  g_return_val_if_fail (context != NULL, NULL);
+
+  return context->tag_stack;
+}
+
 /**
  * g_markup_parse_context_get_position:
  * @context: a #GMarkupParseContext
index b272d5ca7653eb43395d7d1c92cfd3d829fa6e11..d6bb8a1fdf30b14e74ccc6e92ad03053c0d82cc0 100644 (file)
@@ -109,6 +109,7 @@ gboolean             g_markup_parse_context_parse (GMarkupParseContext *context,
 gboolean             g_markup_parse_context_end_parse (GMarkupParseContext *context,
                                                        GError             **error);
 G_CONST_RETURN gchar *g_markup_parse_context_get_element (GMarkupParseContext *context);
+G_CONST_RETURN GSList *g_markup_parse_context_get_element_stack (GMarkupParseContext *context);
 
 /* For user-constructed error messages, has no precise semantics */
 void                 g_markup_parse_context_get_position (GMarkupParseContext *context,