[libshumate] vector: Add ShumateStyleError



commit 1696a4495fff91e85229f819c13c0644a56af080
Author: James Westman <james jwestman net>
Date:   Thu Aug 26 23:58:48 2021 -0500

    vector: Add ShumateStyleError
    
    This error domain is used for errors during style parsing.

 shumate/shumate-vector-style.c |  6 ++++++
 shumate/shumate-vector-style.h | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
---
diff --git a/shumate/shumate-vector-style.c b/shumate/shumate-vector-style.c
index 841cde9..8cc14a6 100644
--- a/shumate/shumate-vector-style.c
+++ b/shumate/shumate-vector-style.c
@@ -206,3 +206,9 @@ shumate_vector_style_render (ShumateVectorStyle *self, int size)
   return texture;
 }
 
+/**
+ * shumate_style_error_quark:
+ *
+ * Returns: a #GQuark
+ */
+G_DEFINE_QUARK (shumate-style-error-quark, shumate_style_error);
diff --git a/shumate/shumate-vector-style.h b/shumate/shumate-vector-style.h
index ac0d66f..9249903 100644
--- a/shumate/shumate-vector-style.h
+++ b/shumate/shumate-vector-style.h
@@ -21,6 +21,33 @@
 
 G_BEGIN_DECLS
 
+
+/**
+ * SHUMATE_STYLE_ERROR:
+ *
+ * Error domain for errors that may occur when parsing a map style. Errors in
+ * this domain will be from the [enum@StyleError] enum.
+ */
+#define SHUMATE_STYLE_ERROR shumate_style_error_quark ()
+GQuark shumate_style_error_quark (void);
+
+/**
+ * ShumateStyleError:
+ * @SHUMATE_STYLE_ERROR_FAILED: An unspecified error occurred during the operation.
+ * @SHUMATE_STYLE_ERROR_MALFORMED_STYLE: A JSON node in the style has the wrong type (e.g. an object where 
there should be an array).
+ * @SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER: An unsupported layer type was encountered.
+ * @SHUMATE_STYLE_ERROR_INVALID_EXPRESSION: An invalid or unrecognized expression was encountered.
+ *
+ * Error codes in the [error@StyleError] domain.
+ */
+typedef enum {
+  SHUMATE_STYLE_ERROR_FAILED,
+  SHUMATE_STYLE_ERROR_MALFORMED_STYLE,
+  SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER,
+  SHUMATE_STYLE_ERROR_INVALID_EXPRESSION,
+} ShumateStyleError;
+
+
 #define SHUMATE_TYPE_VECTOR_STYLE (shumate_vector_style_get_type())
 
 G_DECLARE_FINAL_TYPE (ShumateVectorStyle, shumate_vector_style, SHUMATE, VECTOR_STYLE, GObject)


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