[gnome-builder] libide: add ide_diagnostic_severity_to_string()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: add ide_diagnostic_severity_to_string()
- Date: Mon, 23 Mar 2015 23:43:19 +0000 (UTC)
commit 1cad6bc8c1a6a4860e3e37174092de0005d4aeab
Author: Christian Hergert <christian hergert me>
Date: Wed Feb 25 19:13:05 2015 -0800
libide: add ide_diagnostic_severity_to_string()
This is a small helper to convert the severity enum to a string.
libide/ide-diagnostic.c | 24 ++++++++++++++++++++++++
libide/ide-diagnostic.h | 1 +
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-diagnostic.c b/libide/ide-diagnostic.c
index 20055fa..11b0c89 100644
--- a/libide/ide-diagnostic.c
+++ b/libide/ide-diagnostic.c
@@ -191,3 +191,27 @@ ide_diagnostic_severity_get_type (void)
return type_id;
}
+
+const gchar *
+ide_diagnostic_severity_to_string (IdeDiagnosticSeverity severity)
+{
+ switch (severity)
+ {
+ case IDE_DIAGNOSTIC_IGNORED:
+ return "ignored";
+
+ case IDE_DIAGNOSTIC_NOTE:
+
+ case IDE_DIAGNOSTIC_WARNING:
+ return "warning";
+
+ case IDE_DIAGNOSTIC_ERROR:
+ return "error";
+
+ case IDE_DIAGNOSTIC_FATAL:
+ return "fatal";
+
+ default:
+ return "unknown";
+ }
+}
diff --git a/libide/ide-diagnostic.h b/libide/ide-diagnostic.h
index 811f78f..04d4b2b 100644
--- a/libide/ide-diagnostic.h
+++ b/libide/ide-diagnostic.h
@@ -46,6 +46,7 @@ IdeDiagnostic *ide_diagnostic_ref (IdeDiagnostic *self)
void ide_diagnostic_unref (IdeDiagnostic *self);
GType ide_diagnostic_severity_get_type (void);
+const gchar *ide_diagnostic_severity_to_string (IdeDiagnosticSeverity severity);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeDiagnostic, ide_diagnostic_unref)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]