[gnome-builder/wip/slaf/xml-pack: 217/254] xml-pack: IdeXmlPosition additions
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/xml-pack: 217/254] xml-pack: IdeXmlPosition additions
- Date: Thu, 13 Jul 2017 09:07:26 +0000 (UTC)
commit c570eeef99e68efe526a502eac965f7ef564dd62
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun May 14 22:47:18 2017 +0200
xml-pack: IdeXmlPosition additions
- better construction
- set_siblings method
plugins/xml-pack/ide-xml-position.c | 21 +++++++++++++++++++--
plugins/xml-pack/ide-xml-position.h | 7 ++++++-
2 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-position.c b/plugins/xml-pack/ide-xml-position.c
index 819f206..fd23266 100644
--- a/plugins/xml-pack/ide-xml-position.c
+++ b/plugins/xml-pack/ide-xml-position.c
@@ -21,13 +21,19 @@
G_DEFINE_BOXED_TYPE (IdeXmlPosition, ide_xml_position, ide_xml_position_ref, ide_xml_position_unref)
IdeXmlPosition *
-ide_xml_position_new (void)
+ide_xml_position_new (IdeXmlSymbolNode *node,
+ IdeXmlPositionKind kind)
{
IdeXmlPosition *self;
+ g_return_val_if_fail (IDE_IS_XML_SYMBOL_NODE (node), NULL);
+
self = g_slice_new0 (IdeXmlPosition);
self->ref_count = 1;
+ self->node = node;
+ self->kind = kind;
+
return self;
}
@@ -39,7 +45,8 @@ ide_xml_position_copy (IdeXmlPosition *self)
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (self->ref_count, NULL);
- copy = ide_xml_position_new ();
+ copy = ide_xml_position_new (self->node,
+ self->kind);
return copy;
}
@@ -73,6 +80,16 @@ ide_xml_position_unref (IdeXmlPosition *self)
if (g_atomic_int_dec_and_test (&self->ref_count))
ide_xml_position_free (self);
}
+
+void
+ide_xml_position_set_siblings (IdeXmlPosition *self,
+ IdeXmlSymbolNode *previous_sibling_node,
+ IdeXmlSymbolNode *next_sibling_node)
+{
+ self->previous_sibling_node = previous_sibling_node;
+ self->next_sibling_node = next_sibling_node;
+}
+
const gchar *
ide_xml_position_kind_get_str (IdeXmlPositionKind kind)
{
diff --git a/plugins/xml-pack/ide-xml-position.h b/plugins/xml-pack/ide-xml-position.h
index 8b6eda3..e323985 100644
--- a/plugins/xml-pack/ide-xml-position.h
+++ b/plugins/xml-pack/ide-xml-position.h
@@ -34,7 +34,8 @@ struct _IdeXmlPosition
{
IdeXmlSymbolNode *root_node;
IdeXmlSymbolNode *node;
- IdeXmlSymbolNode *parent_node;
+ IdeXmlSymbolNode *previous_sibling_node;
+ IdeXmlSymbolNode *next_sibling_node;
IdeXmlPositionKind kind;
guint ref_count;
@@ -46,6 +47,10 @@ IdeXmlPosition *ide_xml_position_copy (IdeXmlPosition *self);
IdeXmlPosition *ide_xml_position_ref (IdeXmlPosition *self);
void ide_xml_position_unref (IdeXmlPosition *self);
+void ide_xml_position_set_siblings (IdeXmlPosition *self,
+ IdeXmlSymbolNode *previous_sibling_node,
+ IdeXmlSymbolNode *next_sibling_node);
+
void ide_xml_position_print (IdeXmlPosition *self);
const gchar *ide_xml_position_kind_get_str (IdeXmlPositionKind kind);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]