[gnome-builder/wip/libide] libide: add getters for source ranges
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide] libide: add getters for source ranges
- Date: Fri, 13 Feb 2015 01:50:15 +0000 (UTC)
commit 7a604b5013aa2d5303e01c2b92f6b776d4d64e3a
Author: Christian Hergert <christian hergert me>
Date: Thu Feb 12 16:34:14 2015 -0800
libide: add getters for source ranges
libide/ide-diagnostic.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-diagnostic.c b/libide/ide-diagnostic.c
index d401392..d3c5868 100644
--- a/libide/ide-diagnostic.c
+++ b/libide/ide-diagnostic.c
@@ -72,6 +72,37 @@ ide_diagnostic_get_text (IdeDiagnostic *self)
return self->text;
}
+guint
+ide_diagnostic_get_num_ranges (IdeDiagnostic *self)
+{
+ g_return_val_if_fail (self, 0);
+
+ return self->ranges ? self->ranges->len : 0;
+}
+
+/**
+ * ide_diagnostic_get_range:
+ *
+ * Retrieves the range found at @index. It is a programming error to call this
+ * function with a value greater or equal to ide_diagnostic_get_num_ranges().
+ *
+ * Returns: (transfer none) (nullable): An #IdeSourceRange
+ */
+IdeSourceRange *
+ide_diagnostic_get_range (IdeDiagnostic *self,
+ guint index)
+{
+ g_return_val_if_fail (self, NULL);
+
+ if (self->ranges)
+ {
+ if (index < self->ranges->len)
+ return g_ptr_array_index (self->ranges, index);
+ }
+
+ return NULL;
+}
+
IdeDiagnostic *
_ide_diagnostic_new (IdeDiagnosticSeverity severity,
const gchar *text)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]