[gnome-builder/wip/slaf/xml-pack] xml-pack: add print node to IdeXmlSymbolNode



commit 817a4de579c3fde523ca83e7329ae905b74c32c0
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Wed May 17 19:56:45 2017 +0200

    xml-pack: add print node to IdeXmlSymbolNode

 plugins/xml-pack/ide-xml-symbol-node.c |   25 +++++++++++++++++++++++++
 plugins/xml-pack/ide-xml-symbol-node.h |    3 +++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-symbol-node.c b/plugins/xml-pack/ide-xml-symbol-node.c
index 873d419..d1fc4cc 100644
--- a/plugins/xml-pack/ide-xml-symbol-node.c
+++ b/plugins/xml-pack/ide-xml-symbol-node.c
@@ -661,3 +661,28 @@ ide_xml_symbol_node_get_attributes_names (IdeXmlSymbolNode  *self)
 
   return (const gchar **)self->attributes_names;
 }
+
+void
+ide_xml_symbol_node_print (IdeXmlSymbolNode  *self,
+                           gboolean           show_value,
+                           gboolean           show_attributes)
+{
+  gchar **attributes = self->attributes_names;
+
+  g_return_if_fail (IDE_IS_XML_SYMBOL_NODE (self));
+
+  printf ("%s(%d:%d->%d:%d)\n",
+          self->element_name,
+          self->start_tag.start_line, self->start_tag.start_line_offset,
+          self->end_tag.start_line, self->end_tag.start_line_offset);
+
+  if (show_attributes && self->attributes_names != NULL)
+    while (*attributes != NULL)
+      {
+        printf ("%s\n", *attributes);
+        ++attributes;
+      }
+
+  if (show_value && self->value != NULL)
+    printf ("\t%s\n", self->value);
+}
diff --git a/plugins/xml-pack/ide-xml-symbol-node.h b/plugins/xml-pack/ide-xml-symbol-node.h
index 228e819..a776c57 100644
--- a/plugins/xml-pack/ide-xml-symbol-node.h
+++ b/plugins/xml-pack/ide-xml-symbol-node.h
@@ -69,6 +69,9 @@ IdeSymbolNode            *ide_xml_symbol_node_get_nth_internal_child        (Ide
 IdeXmlSymbolNode         *ide_xml_symbol_node_get_parent                    (IdeXmlSymbolNode       *self);
 const gchar              *ide_xml_symbol_node_get_value                     (IdeXmlSymbolNode       *self);
 gboolean                  ide_xml_symbol_node_has_end_tag                   (IdeXmlSymbolNode       *self);
+void                      ide_xml_symbol_node_print                         (IdeXmlSymbolNode       *self,
+                                                                             gboolean                
show_value,
+                                                                             gboolean                
show_attributes);
 void                      ide_xml_symbol_node_set_location                  (IdeXmlSymbolNode       *self,
                                                                              GFile                  *file,
                                                                              gint                    
start_line,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]