[gnome-builder/wip/slaf/xml-pack: 5/56] xml-pack: add end-tag location informations



commit 29081f11a97d75c793dbd1f75e371765b7b34f74
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Sat Apr 1 23:51:15 2017 +0200

    xml-pack: add end-tag location informations

 plugins/xml-pack/ide-xml-symbol-node.c |   47 ++++++++++++++++++++++++++++++++
 plugins/xml-pack/ide-xml-symbol-node.h |    9 ++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-symbol-node.c b/plugins/xml-pack/ide-xml-symbol-node.c
index ce47604..f64ccb6 100644
--- a/plugins/xml-pack/ide-xml-symbol-node.c
+++ b/plugins/xml-pack/ide-xml-symbol-node.c
@@ -39,6 +39,12 @@ struct _IdeXmlSymbolNode
   gint                      line;
   gint                      line_offset;
   gsize                     size;
+
+  gint                      end_line;
+  gint                      end_line_offset;
+  gsize                     end_size;
+
+  guint                     has_end_tag : 1;
 };
 
 G_DEFINE_TYPE (IdeXmlSymbolNode, ide_xml_symbol_node, IDE_TYPE_SYMBOL_NODE)
@@ -391,6 +397,47 @@ ide_xml_symbol_node_get_location (IdeXmlSymbolNode *self,
   return self->file;
 }
 
+void
+ide_xml_symbol_node_get_end_tag_location (IdeXmlSymbolNode *self,
+                                          gint             *end_line,
+                                          gint             *end_line_offset,
+                                          gsize            *end_size)
+{
+  g_return_if_fail (IDE_IS_XML_SYMBOL_NODE (self));
+
+  if (end_line != NULL)
+    *end_line = self->end_line;
+
+  if (end_line_offset != NULL)
+    *end_line_offset = self->end_line_offset;
+
+  if (end_size != NULL)
+    *end_size = self->end_size;
+}
+
+void
+ide_xml_symbol_node_set_end_tag_location (IdeXmlSymbolNode *self,
+                                          gint              end_line,
+                                          gint              end_line_offset,
+                                          gsize             end_size)
+{
+  g_return_if_fail (IDE_IS_XML_SYMBOL_NODE (self));
+
+  self->end_line = end_line;
+  self->end_line_offset = end_line_offset;
+  self->end_size = end_size;
+
+  self->has_end_tag = TRUE;
+}
+
+gboolean
+ide_xml_symbol_node_has_end_tag (IdeXmlSymbolNode *self)
+{
+  g_return_val_if_fail (IDE_IS_XML_SYMBOL_NODE (self), FALSE);
+
+  return self->has_end_tag;
+}
+
 const gchar *
 ide_xml_symbol_node_get_element_name (IdeXmlSymbolNode *self)
 {
diff --git a/plugins/xml-pack/ide-xml-symbol-node.h b/plugins/xml-pack/ide-xml-symbol-node.h
index d1130c4..fedd3a4 100644
--- a/plugins/xml-pack/ide-xml-symbol-node.h
+++ b/plugins/xml-pack/ide-xml-symbol-node.h
@@ -46,6 +46,10 @@ GFile *                   ide_xml_symbol_node_get_location                  (Ide
                                                                              gint                   *line,
                                                                              gint                   
*line_offset,
                                                                              gsize                  *size);
+void                      ide_xml_symbol_node_get_end_tag_location          (IdeXmlSymbolNode       *self,
+                                                                             gint                   
*end_line,
+                                                                             gint                   
*end_line_offset,
+                                                                             gsize                  
*end_size);
 guint                     ide_xml_symbol_node_get_n_children                (IdeXmlSymbolNode       *self);
 guint                     ide_xml_symbol_node_get_n_internal_children       (IdeXmlSymbolNode       *self);
 IdeSymbolNode            *ide_xml_symbol_node_get_nth_child                 (IdeXmlSymbolNode       *self,
@@ -56,11 +60,16 @@ IdeSymbolNode            *ide_xml_symbol_node_get_nth_child_deep            (Ide
 IdeSymbolNode            *ide_xml_symbol_node_get_nth_internal_child        (IdeXmlSymbolNode       *self,
                                                                              guint                   
nth_child);
 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_set_location                  (IdeXmlSymbolNode       *self,
                                                                              GFile                  *file,
                                                                              gint                    line,
                                                                              gint                    
line_offset,
                                                                              gsize                   size);
+void                      ide_xml_symbol_node_set_end_tag_location          (IdeXmlSymbolNode       *self,
+                                                                             gint                    
end_line,
+                                                                             gint                    
end_line_offset,
+                                                                             gsize                   
end_size);
 void                      ide_xml_symbol_node_set_element_name              (IdeXmlSymbolNode       *self,
                                                                              const gchar            
*element_name);
 void                      ide_xml_symbol_node_set_value                     (IdeXmlSymbolNode       *self,


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