[gnome-builder/wip/slaf/xml-pack: 246/254] xml-pack: store more infos in IdeXmlPosition
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/xml-pack: 246/254] xml-pack: store more infos in IdeXmlPosition
- Date: Thu, 13 Jul 2017 09:09:53 +0000 (UTC)
commit 55983b3223023f025ca50f57b5dd63d56129b724
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun Jul 9 15:57:13 2017 +0200
xml-pack: store more infos in IdeXmlPosition
We now have detail_name and detail_value
like in attribute name and value.
We also have 'quote' to indicate the attribute value
quoting style ( ' or " )
plugins/xml-pack/ide-xml-position.c | 44 +++++++++++++++++++++++++++++++---
plugins/xml-pack/ide-xml-position.h | 10 +++++++-
2 files changed, 49 insertions(+), 5 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-position.c b/plugins/xml-pack/ide-xml-position.c
index 70824b1..bcd95ae 100644
--- a/plugins/xml-pack/ide-xml-position.c
+++ b/plugins/xml-pack/ide-xml-position.c
@@ -24,7 +24,10 @@ IdeXmlPosition *
ide_xml_position_new (IdeXmlSymbolNode *node,
const gchar *prefix,
IdeXmlPositionKind kind,
- IdeXmlPositionDetail detail)
+ IdeXmlPositionDetail detail,
+ const gchar *detail_name,
+ const gchar *detail_value,
+ gchar quote)
{
IdeXmlPosition *self;
@@ -34,12 +37,20 @@ ide_xml_position_new (IdeXmlSymbolNode *node,
self->ref_count = 1;
self->node = (IDE_IS_XML_SYMBOL_NODE (node)) ? g_object_ref (node) : NULL;
+
if (!ide_str_empty0 (prefix))
self->prefix = g_strdup (prefix);
+ if (!ide_str_empty0 (detail_name))
+ self->detail_name = g_strdup (detail_name);
+
+ if (!ide_str_empty0 (detail_value))
+ self->detail_value = g_strdup (detail_value);
+
self->kind = kind;
self->detail = detail;
self->child_pos = -1;
+ self->quote = quote;
return self;
}
@@ -55,7 +66,10 @@ ide_xml_position_copy (IdeXmlPosition *self)
copy = ide_xml_position_new (self->node,
self->prefix,
self->kind,
- self->detail);
+ self->detail,
+ self->detail_name,
+ self->detail_value,
+ self->quote);
if (self->analysis != NULL)
copy->analysis = ide_xml_analysis_ref (self->analysis);
@@ -81,6 +95,8 @@ ide_xml_position_free (IdeXmlPosition *self)
ide_xml_analysis_unref (self->analysis);
g_clear_pointer (&self->prefix, g_free);
+ g_clear_pointer (&self->detail_name, g_free);
+ g_clear_pointer (&self->detail_value, g_free);
g_clear_object (&self->node);
g_clear_object (&self->child_node);
@@ -241,12 +257,16 @@ ide_xml_position_print (IdeXmlPosition *self)
detail_str = ide_xml_position_detail_get_str (self->detail);
parent_node = ide_xml_symbol_node_get_parent (self->node);
- printf ("POSITION: parent: %s node: %s kind:%s detail:'%s' prefix:'%s'\n",
+ printf ("POSITION: parent: %s node: %s kind:%s detail:'%s'\n \
+ prefix:'%s' detail name:'%s' detail value:'%s' quote:'%c'\n",
(parent_node != NULL) ? ide_xml_symbol_node_get_element_name (parent_node) : "none",
(self->node != NULL) ? ide_xml_symbol_node_get_element_name (self->node) : "none",
kind_str,
detail_str,
- self->prefix);
+ self->prefix,
+ self->detail_name,
+ self->detail_value,
+ self->quote);
if (self->child_pos != -1)
{
@@ -331,6 +351,22 @@ ide_xml_position_get_prefix (IdeXmlPosition *self)
return self->prefix;
}
+const gchar *
+ide_xml_position_get_detail_name (IdeXmlPosition *self)
+{
+ g_return_val_if_fail (self, NULL);
+
+ return self->detail_name;
+}
+
+const gchar *
+ide_xml_position_get_detail_value (IdeXmlPosition *self)
+{
+ g_return_val_if_fail (self, NULL);
+
+ return self->detail_value;
+}
+
gint
ide_xml_position_get_child_pos (IdeXmlPosition *self)
{
diff --git a/plugins/xml-pack/ide-xml-position.h b/plugins/xml-pack/ide-xml-position.h
index d5f48de..5ca78e9 100644
--- a/plugins/xml-pack/ide-xml-position.h
+++ b/plugins/xml-pack/ide-xml-position.h
@@ -39,9 +39,12 @@ struct _IdeXmlPosition
IdeXmlSymbolNode *previous_sibling_node;
IdeXmlSymbolNode *next_sibling_node;
gchar *prefix;
+ gchar *detail_name;
+ gchar *detail_value;
IdeXmlPositionKind kind;
IdeXmlPositionDetail detail;
gint child_pos;
+ gchar quote;
guint ref_count;
};
@@ -49,13 +52,18 @@ struct _IdeXmlPosition
IdeXmlPosition *ide_xml_position_new (IdeXmlSymbolNode *node,
const gchar *prefix,
IdeXmlPositionKind kind,
- IdeXmlPositionDetail detail);
+ IdeXmlPositionDetail detail,
+ const gchar *detail_name,
+ const gchar *detail_value,
+ gchar quote);
IdeXmlPosition *ide_xml_position_copy (IdeXmlPosition *self);
IdeXmlPosition *ide_xml_position_ref (IdeXmlPosition *self);
void ide_xml_position_unref (IdeXmlPosition *self);
IdeXmlAnalysis *ide_xml_position_get_analysis (IdeXmlPosition *self);
gint ide_xml_position_get_child_pos (IdeXmlPosition *self);
IdeXmlPositionDetail ide_xml_position_get_detail (IdeXmlPosition *self);
+const gchar *ide_xml_position_get_detail_name (IdeXmlPosition *self);
+const gchar *ide_xml_position_get_detail_value (IdeXmlPosition *self);
IdeXmlPositionKind ide_xml_position_get_kind (IdeXmlPosition *self);
IdeXmlSymbolNode *ide_xml_position_get_next_sibling (IdeXmlPosition *self);
IdeXmlSymbolNode *ide_xml_position_get_child_node (IdeXmlPosition *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]