aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eina/eina_inline_value_util.x
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/eina/eina_inline_value_util.x306
1 files changed, 306 insertions, 0 deletions
diff --git a/src/lib/eina/eina_inline_value_util.x b/src/lib/eina/eina_inline_value_util.x
index 8a09f4cdea..3beca713fb 100644
--- a/src/lib/eina/eina_inline_value_util.x
+++ b/src/lib/eina/eina_inline_value_util.x
@@ -672,6 +672,312 @@ eina_value_error_init(Eina_Error err)
}
/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param c Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_uchar_get(const Eina_Value *v, unsigned char *c)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(c, EINA_FALSE);
+ *c = 0;
+ if (v && v->type == EINA_VALUE_TYPE_UCHAR)
+ return eina_value_get(v, c);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param s Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_ushort_get(const Eina_Value *v, unsigned short *s)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(s, EINA_FALSE);
+ *s = 0;
+ if (v && v->type == EINA_VALUE_TYPE_USHORT)
+ return eina_value_get(v, s);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param i Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_uint_get(const Eina_Value *v, unsigned int *i)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(i, EINA_FALSE);
+ *i = 0;
+ if (v && v->type == EINA_VALUE_TYPE_UINT)
+ return eina_value_get(v, i);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param l Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_ulong_get(const Eina_Value *v, unsigned long *l)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(l, EINA_FALSE);
+ *l = 0;
+ if (v && v->type == EINA_VALUE_TYPE_ULONG)
+ return eina_value_get(v, l);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param i Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_uint64_get(const Eina_Value *v, uint64_t *i)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(i, EINA_FALSE);
+ *i = 0;
+ if (v && v->type == EINA_VALUE_TYPE_UINT64)
+ return eina_value_get(v, i);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param c Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_char_get(const Eina_Value *v, char *c)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(c, EINA_FALSE);
+ *c = 0;
+ if (v && v->type == EINA_VALUE_TYPE_CHAR)
+ return eina_value_get(v, c);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param s Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_short_get(const Eina_Value *v, short *s)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(s, EINA_FALSE);
+ *s = 0;
+ if (v && v->type == EINA_VALUE_TYPE_SHORT)
+ return eina_value_get(v, s);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param i Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_int_get(const Eina_Value *v, int *i)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(i, EINA_FALSE);
+ *i = 0;
+ if (v && v->type == EINA_VALUE_TYPE_INT)
+ return eina_value_get(v, i);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param l Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_long_get(const Eina_Value *v, long *l)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(l, EINA_FALSE);
+ *l = 0;
+ if (v && v->type == EINA_VALUE_TYPE_LONG)
+ return eina_value_get(v, l);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param i Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_int64_get(const Eina_Value *v, int64_t *i)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(i, EINA_FALSE);
+ *i = 0;
+ if (v && v->type == EINA_VALUE_TYPE_INT64)
+ return eina_value_get(v, i);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param f Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_float_get(const Eina_Value *v, float *f)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE);
+ *f = 0.0f;
+ if (v && v->type == EINA_VALUE_TYPE_FLOAT)
+ return eina_value_get(v, f);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param d Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_double_get(const Eina_Value *v, double *d)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(d, EINA_FALSE);
+ *d = 0.0;
+ if (v && v->type == EINA_VALUE_TYPE_DOUBLE)
+ return eina_value_get(v, d);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param b Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_bool_get(const Eina_Value *v, Eina_Bool *b)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(b, EINA_FALSE);
+ *b = EINA_FALSE;
+ if (v && v->type == EINA_VALUE_TYPE_UCHAR)
+ return eina_value_get(v, b);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param str Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_string_get(const Eina_Value *v, const char **str)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
+ *str = NULL;
+ if (v && v->type == EINA_VALUE_TYPE_STRING)
+ return eina_value_get(v, str);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param str Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_stringshare_get(const Eina_Value *v, const char **str)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
+ *str = NULL;
+ if (v && v->type == EINA_VALUE_TYPE_STRINGSHARE)
+ return eina_value_get(v, str);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param t Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_time_get(const Eina_Value *v, time_t *t)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(t, EINA_FALSE);
+ *t = 0;
+ if (v && v->type == EINA_VALUE_TYPE_TIMESTAMP)
+ return eina_value_get(v, t);
+ return EINA_FALSE;
+}
+
+/**
+ * @brief Check value type and get contents.
+ * @param v The value to check type and get contents.
+ * @param err Where to store the value contents.
+ * @return #EINA_TRUE if type matches and fetched contents,
+ * #EINA_FALSE on different type or failures.
+ * @since 1.21
+ */
+static inline Eina_Bool
+eina_value_error_get(const Eina_Value *v, Eina_Error *err)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(err, EINA_FALSE);
+ *err = 0;
+ if (v && v->type == EINA_VALUE_TYPE_ERROR)
+ return eina_value_get(v, err);
+ return EINA_FALSE;
+}
+
+/**
* @brief Create a new #Eina_Value containing the passed parameter
* @param val The value to use
* @return The #Eina_Value