|
Flutter Linux Embedder
|
|
Go to the documentation of this file.
113 g_string_append_printf(
buffer,
"%" G_GINT64_FORMAT,
value);
122 for (
int i =
buffer->len - 1;
i >= 0;
i--) {
125 zero_count = zero_count == 0 ? 0 : zero_count - 1;
137 switch (
value->type) {
139 g_string_append(
buffer,
"null");
143 g_string_append(
buffer,
"true");
145 g_string_append(
buffer,
"false");
159 g_string_append(
buffer,
"[");
163 g_string_append(
buffer,
", ");
167 g_string_append(
buffer,
"]");
171 g_string_append(
buffer,
"[");
175 g_string_append(
buffer,
", ");
179 g_string_append(
buffer,
"]");
183 g_string_append(
buffer,
"[");
187 g_string_append(
buffer,
", ");
191 g_string_append(
buffer,
"]");
195 g_string_append(
buffer,
"[");
199 g_string_append(
buffer,
", ");
203 g_string_append(
buffer,
"]");
207 g_string_append(
buffer,
"[");
211 g_string_append(
buffer,
", ");
215 g_string_append(
buffer,
"]");
219 g_string_append(
buffer,
"[");
222 g_string_append(
buffer,
", ");
226 g_string_append(
buffer,
"]");
230 g_string_append(
buffer,
"{");
233 g_string_append(
buffer,
", ");
236 g_string_append(
buffer,
": ");
239 g_string_append(
buffer,
"}");
243 g_string_append_printf(
buffer,
"(custom %d)",
247 g_string_append_printf(
buffer,
"<unknown type %d>",
value->type);
259 return reinterpret_cast<FlValue*
>(
self);
266 return reinterpret_cast<FlValue*
>(
self);
273 return reinterpret_cast<FlValue*
>(
self);
280 return reinterpret_cast<FlValue*
>(
self);
284 size_t value_length) {
288 value_length == 0 ? g_strdup(
"") : g_strndup(
value, value_length);
289 return reinterpret_cast<FlValue*
>(
self);
293 size_t data_length) {
297 self->values =
static_cast<uint8_t*
>(g_malloc(
sizeof(uint8_t) * data_length));
298 memcpy(self->values, data,
sizeof(uint8_t) * data_length);
299 return reinterpret_cast<FlValue*
>(
self);
305 static_cast<const uint8_t*
>(g_bytes_get_data(data, &
length));
310 size_t data_length) {
314 self->values =
static_cast<int32_t*
>(g_malloc(
sizeof(int32_t) * data_length));
315 memcpy(self->values, data,
sizeof(int32_t) * data_length);
316 return reinterpret_cast<FlValue*
>(
self);
320 size_t data_length) {
324 self->values =
static_cast<int64_t*
>(g_malloc(
sizeof(int64_t) * data_length));
325 memcpy(self->values, data,
sizeof(int64_t) * data_length);
326 return reinterpret_cast<FlValue*
>(
self);
330 size_t data_length) {
334 self->values =
static_cast<float*
>(g_malloc(
sizeof(
float) * data_length));
335 memcpy(self->values, data,
sizeof(
float) * data_length);
336 return reinterpret_cast<FlValue*
>(
self);
340 size_t data_length) {
344 self->values =
static_cast<double*
>(g_malloc(
sizeof(
double) * data_length));
345 memcpy(self->values, data,
sizeof(
double) * data_length);
346 return reinterpret_cast<FlValue*
>(
self);
353 return reinterpret_cast<FlValue*
>(
self);
357 const gchar*
const* str_array) {
358 g_return_val_if_fail(str_array !=
nullptr,
nullptr);
360 for (
int i = 0; str_array[
i] !=
nullptr;
i++) {
371 return reinterpret_cast<FlValue*
>(
self);
376 GDestroyNotify destroy_notify) {
381 self->destroy_notify = destroy_notify;
382 return reinterpret_cast<FlValue*
>(
self);
395 g_return_val_if_fail(
self !=
nullptr,
nullptr);
401 g_return_if_fail(
self !=
nullptr);
402 g_return_if_fail(self->ref_count > 0);
404 if (self->ref_count != 0) {
408 switch (self->type) {
441 g_ptr_array_unref(v->
values);
446 g_ptr_array_unref(v->
keys);
447 g_ptr_array_unref(v->
values);
472 g_return_val_if_fail(a !=
nullptr,
false);
473 g_return_val_if_fail(b !=
nullptr,
false);
475 if (a->type != b->type) {
500 if (values_a[
i] != values_b[
i]) {
513 if (values_a[
i] != values_b[
i]) {
526 if (values_a[
i] != values_b[
i]) {
539 if (values_a[
i] != values_b[
i]) {
552 if (values_a[
i] != values_b[
i]) {
577 if (value_b ==
nullptr) {
593 g_return_if_fail(
self !=
nullptr);
595 g_return_if_fail(
value !=
nullptr);
601 g_return_if_fail(
self !=
nullptr);
603 g_return_if_fail(
value !=
nullptr);
610 g_return_if_fail(
self !=
nullptr);
612 g_return_if_fail(key !=
nullptr);
613 g_return_if_fail(
value !=
nullptr);
621 g_return_if_fail(
self !=
nullptr);
623 g_return_if_fail(key !=
nullptr);
624 g_return_if_fail(
value !=
nullptr);
629 g_ptr_array_add(v->
keys, key);
633 v->
keys->pdata[index] = key;
642 g_return_if_fail(
self !=
nullptr);
644 g_return_if_fail(key !=
nullptr);
645 g_return_if_fail(
value !=
nullptr);
653 g_return_if_fail(
self !=
nullptr);
655 g_return_if_fail(key !=
nullptr);
656 g_return_if_fail(
value !=
nullptr);
662 g_return_val_if_fail(
self !=
nullptr, FALSE);
669 g_return_val_if_fail(
self !=
nullptr, 0);
676 g_return_val_if_fail(
self !=
nullptr, 0.0);
683 g_return_val_if_fail(
self !=
nullptr,
nullptr);
690 g_return_val_if_fail(
self !=
nullptr,
nullptr);
697 g_return_val_if_fail(
self !=
nullptr,
nullptr);
704 g_return_val_if_fail(
self !=
nullptr,
nullptr);
711 g_return_val_if_fail(
self !=
nullptr,
nullptr);
718 g_return_val_if_fail(
self !=
nullptr,
nullptr);
725 g_return_val_if_fail(
self !=
nullptr, 0);
735 switch (self->type) {
777 g_return_val_if_fail(
self !=
nullptr,
nullptr);
781 return static_cast<FlValue*
>(g_ptr_array_index(v->
values, index));
785 g_return_val_if_fail(
self !=
nullptr,
nullptr);
789 return static_cast<FlValue*
>(g_ptr_array_index(v->
keys, index));
793 g_return_val_if_fail(
self !=
nullptr,
nullptr);
797 return static_cast<FlValue*
>(g_ptr_array_index(v->
values, index));
801 g_return_val_if_fail(
self !=
nullptr,
nullptr);
813 g_return_val_if_fail(
self !=
nullptr,
nullptr);
823 g_return_val_if_fail(
self !=
nullptr, -1);
831 g_return_val_if_fail(
self !=
nullptr,
nullptr);
839 g_return_val_if_fail(
self !=
nullptr,
nullptr);
843 return G_OBJECT(v->
value);
847 GString*
buffer = g_string_new(
"");
849 return g_string_free(
buffer, FALSE);
const G_MODULE_EXPORT int32_t * fl_value_get_int32_list(FlValue *self)
@ FL_VALUE_TYPE_UINT8_LIST
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
static void int_to_string(int64_t value, GString *buffer)
static FlValue * fl_value_new(FlValueType type, size_t size)
G_MODULE_EXPORT GObject * fl_value_get_custom_value_object(FlValue *self)
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
static void fl_value_destroy(gpointer value)
G_MODULE_EXPORT FlValue * fl_value_new_list()
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
const G_MODULE_EXPORT double * fl_value_get_float_list(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
typedefG_BEGIN_DECLS struct _FlValue FlValue
G_MODULE_EXPORT FlValue * fl_value_new_custom_object(int type, GObject *object)
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_custom(int type, gconstpointer value, GDestroyNotify destroy_notify)
G_MODULE_EXPORT FlValue * fl_value_new_null()
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
const G_MODULE_EXPORT uint8_t * fl_value_get_uint8_list(FlValue *self)
GDestroyNotify destroy_notify
G_MODULE_EXPORT void fl_value_set(FlValue *self, FlValue *key, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
const G_MODULE_EXPORT float * fl_value_get_float32_list(FlValue *self)
static void value_to_string(FlValue *value, GString *buffer)
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_map()
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
G_MODULE_EXPORT FlValue * fl_value_new_custom_object_take(int type, GObject *object)
@ FL_VALUE_TYPE_FLOAT32_LIST
G_MODULE_EXPORT gconstpointer fl_value_get_custom_value(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
static void float_to_string(double value, GString *buffer)
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
@ FL_VALUE_TYPE_INT64_LIST
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list_from_bytes(GBytes *data)
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
G_MODULE_EXPORT FlValue * fl_value_new_list_from_strv(const gchar *const *str_array)
G_MODULE_EXPORT int fl_value_get_custom_type(FlValue *self)
@ FL_VALUE_TYPE_FLOAT_LIST
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
static const uint8_t buffer[]
@ FL_VALUE_TYPE_INT32_LIST
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
static ssize_t fl_value_lookup_index(FlValue *self, FlValue *key)
G_MODULE_EXPORT FlValue * fl_value_lookup(FlValue *self, FlValue *key)
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
const G_MODULE_EXPORT int64_t * fl_value_get_int64_list(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
G_MODULE_EXPORT gchar * fl_value_to_string(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)