#include "eina_lock.h"
#include "eina_file.h"
#include "eina_rectangle.h"
+#include "eina_binbuf.h"
/* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */
#include "eina_safety_checks.h"
return tmp.value.ptr; /* steal value */
}
+EAPI Eina_Binbuf *
+eina_value_to_binbuf(Eina_Value *value)
+{
+ Eina_Value tmp = EINA_VALUE_EMPTY;
+ Eina_Value_Blob out;
+ Eina_Binbuf *buf;
+
+ if (value->type != EINA_VALUE_TYPE_BLOB)
+ {
+ eina_value_setup(&tmp, EINA_VALUE_TYPE_BLOB);
+
+ if (!eina_value_convert(value, &tmp))
+ return NULL;
+
+ value = &tmp;
+ }
+
+ eina_value_get(value, &out);
+ if (!out.memory) return NULL;
+
+ buf = eina_binbuf_new();
+ eina_binbuf_append_length(buf, out.memory, out.size);
+
+ eina_value_flush(&tmp);
+
+ return buf;
+}
+
EAPI Eina_Value *
eina_value_array_new(const Eina_Value_Type *subtype, unsigned int step)
{
#include "eina_list.h"
#include "eina_hash.h"
#include "eina_rectangle.h"
+#include "eina_binbuf.h"
/**
* @page eina_value_example_01_page Eina_Value usage
EAPI Eina_Bool eina_value_convert(const Eina_Value *value,
Eina_Value *convert) EINA_ARG_NONNULL(1, 2);
+/**
+ * @brief Converts one value to Eina_Binbuf.
+ * @param value Source value object.
+ * @return @c NULL if it failed to get a memory content, a valid Eina_Binbuf otherwise.
+ *
+ * Converts one value to EINA_TYPE_VALUE_BLOB if necessary by calling
+ * @c eina_value_convert() function.
+ *
+ * @note You are responsible for destroying the Eina_Binbuf returned.
+ *
+ * @see eina_value_to_string()
+ * @see eina_value_convert()
+ *
+ * @since 1.20
+ */
+EAPI Eina_Binbuf *eina_value_to_binbuf(Eina_Value *value);
/**
* @brief Converts value to string.
* @return newly allocated memory or @c NULL on failure.
*
* @see eina_value_convert()
+ * @see eina_value_to_binbuf()
* @since 1.2
*/
EAPI char *eina_value_to_string(const Eina_Value *value) EINA_ARG_NONNULL(1);