| Flutter Linux Embedder |

Typedefs | Enumerations | Functions
fl_value.h File Reference
`#include <glib-object.h>`
`#include <glib.h>`
`#include <stdbool.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Typedefs
typedef typedefG_BEGIN_DECLS struct _FlValue | FlValue

## Enumerations
enum | FlValueType { FL_VALUE_TYPE_NULL , FL_VALUE_TYPE_BOOL , FL_VALUE_TYPE_INT , FL_VALUE_TYPE_FLOAT , FL_VALUE_TYPE_STRING , FL_VALUE_TYPE_UINT8_LIST , FL_VALUE_TYPE_INT32_LIST , FL_VALUE_TYPE_INT64_LIST , FL_VALUE_TYPE_FLOAT_LIST , FL_VALUE_TYPE_LIST , FL_VALUE_TYPE_MAP , FL_VALUE_TYPE_FLOAT32_LIST , FL_VALUE_TYPE_CUSTOM }

## Functions
FlValue * | fl_value_new_null ()
FlValue * | fl_value_new_bool (bool value)
FlValue * | fl_value_new_int (int64_t value)
FlValue * | fl_value_new_float (double value)
FlValue * | fl_value_new_string (const gchar *value)
FlValue * | fl_value_new_string_sized (const gchar *value, size_t value_length)
FlValue * | fl_value_new_uint8_list (const uint8_t *value, size_t value_length)
FlValue * | fl_value_new_uint8_list_from_bytes (GBytes *value)
FlValue * | fl_value_new_int32_list (const int32_t *value, size_t value_length)
FlValue * | fl_value_new_int64_list (const int64_t *value, size_t value_length)
FlValue * | fl_value_new_float32_list (const float *value, size_t value_length)
FlValue * | fl_value_new_float_list (const double *value, size_t value_length)
FlValue * | fl_value_new_list ()
FlValue * | fl_value_new_list_from_strv (const gchar *const *value)
FlValue * | fl_value_new_map ()
FlValue * | fl_value_new_custom (int type, gconstpointer value, GDestroyNotify destroy_notify)
FlValue * | fl_value_new_custom_object (int type, GObject *object)
FlValue * | fl_value_new_custom_object_take (int type, GObject *object)
FlValue * | fl_value_ref (FlValue *value)
void | fl_value_unref (FlValue *value)
FlValueType | fl_value_get_type (FlValue *value)
bool | fl_value_equal (FlValue *a, FlValue *b)
void | fl_value_append (FlValue *value, FlValue *child)
void | fl_value_append_take (FlValue *value, FlValue *child)
void | fl_value_set (FlValue *value, FlValue *key, FlValue *child_value)
void | fl_value_set_take (FlValue *value, FlValue *key, FlValue *child_value)
void | fl_value_set_string (FlValue *value, const gchar *key, FlValue *child_value)
void | fl_value_set_string_take (FlValue *value, const gchar *key, FlValue *child_value)
bool | fl_value_get_bool (FlValue *value)
int64_t | fl_value_get_int (FlValue *value)
double | fl_value_get_float (FlValue *value)
const gchar * | fl_value_get_string (FlValue *value)
size_t | fl_value_get_length (FlValue *value)
const uint8_t * | fl_value_get_uint8_list (FlValue *value)
const int32_t * | fl_value_get_int32_list (FlValue *value)
const int64_t * | fl_value_get_int64_list (FlValue *value)
const float * | fl_value_get_float32_list (FlValue *value)
const double * | fl_value_get_float_list (FlValue *value)
FlValue * | fl_value_get_list_value (FlValue *value, size_t index)
FlValue * | fl_value_get_map_key (FlValue *value, size_t index)
FlValue * | fl_value_get_map_value (FlValue *value, size_t index)
FlValue * | fl_value_lookup (FlValue *value, FlValue *key)
FlValue * | fl_value_lookup_string (FlValue *value, const gchar *key)
int | fl_value_get_custom_type (FlValue *value)
gconstpointer | fl_value_get_custom_value (FlValue *value)
GObject * | fl_value_get_custom_value_object (FlValue *value)
gchar * | fl_value_to_string (FlValue *value)

## Typedef Documentation

## ◆ FlValue

typedef typedefG_BEGIN_DECLS struct _FlValue FlValue

FlValue:

FlValue is an object that contains the data types used in the platform channel used by Flutter.

In Dart the values are represented as follows:

- FL_VALUE_TYPE_NULL: Null
- FL_VALUE_TYPE_BOOL: bool
- FL_VALUE_TYPE_INT: num
- FL_VALUE_TYPE_FLOAT: num
- FL_VALUE_TYPE_STRING: String
- FL_VALUE_TYPE_UINT8_LIST: Uint8List
- FL_VALUE_TYPE_INT32_LIST: Int32List
- FL_VALUE_TYPE_INT64_LIST: Int64List
- FL_VALUE_TYPE_FLOAT32_LIST: Float32List
- FL_VALUE_TYPE_FLOAT_LIST: Float64List
- FL_VALUE_TYPE_LIST: List<dynamic>
- FL_VALUE_TYPE_MAP: Map<dynamic>
- FL_VALUE_TYPE_CUSTOM: (custom type)

See #FlMessageCodec to encode and decode these values.

Definition at line 17 of file fl_value.h.

## Enumeration Type Documentation

## ◆ FlValueType

enum FlValueType

FlValueType: @FL_VALUE_TYPE_NULL: The null value. @FL_VALUE_TYPE_BOOL: A boolean. @FL_VALUE_TYPE_INT: A 64 bit signed integer. @FL_VALUE_TYPE_FLOAT: A 64 bit floating point number. @FL_VALUE_TYPE_STRING: UTF-8 text. @FL_VALUE_TYPE_UINT8_LIST: An ordered list of unsigned 8 bit integers. @FL_VALUE_TYPE_INT32_LIST: An ordered list of 32 bit integers. @FL_VALUE_TYPE_INT64_LIST: An ordered list of 64 bit integers. @FL_VALUE_TYPE_FLOAT_LIST: An ordered list of floating point numbers. @FL_VALUE_TYPE_LIST: An ordered list of FlValue objects. @FL_VALUE_TYPE_MAP: A map of FlValue objects keyed by FlValue object. @FL_VALUE_TYPE_FLOAT32_LIST: An ordered list of 32bit floating point numbers. @FL_VALUE_TYPE_CUSTOM: A custom value.

Types of FlValue.

Enumerator
FL_VALUE_TYPE_NULL |
FL_VALUE_TYPE_BOOL |
FL_VALUE_TYPE_INT |
FL_VALUE_TYPE_FLOAT |
FL_VALUE_TYPE_STRING |
FL_VALUE_TYPE_UINT8_LIST |
FL_VALUE_TYPE_INT32_LIST |
FL_VALUE_TYPE_INT64_LIST |
FL_VALUE_TYPE_FLOAT_LIST |
FL_VALUE_TYPE_LIST |
FL_VALUE_TYPE_MAP |
FL_VALUE_TYPE_FLOAT32_LIST |
FL_VALUE_TYPE_CUSTOM |

Definition at line 62 of file fl_value.h.

62 {
63 // Parts of the public API, so fixing the names is a breaking change.
64 FL_VALUE_TYPE_NULL,
65 FL_VALUE_TYPE_BOOL,
66 FL_VALUE_TYPE_INT,
67 FL_VALUE_TYPE_FLOAT,
68 FL_VALUE_TYPE_STRING,
69 FL_VALUE_TYPE_UINT8_LIST,
70 FL_VALUE_TYPE_INT32_LIST,
71 FL_VALUE_TYPE_INT64_LIST,
72 FL_VALUE_TYPE_FLOAT_LIST,
73 FL_VALUE_TYPE_LIST,
74 FL_VALUE_TYPE_MAP,
75 FL_VALUE_TYPE_FLOAT32_LIST,
76 FL_VALUE_TYPE_CUSTOM,
77 } FlValueType;
FlValueType
FlValueType
Definition: fl_value.h:62
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:68
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:64
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:66
FL_VALUE_TYPE_BOOL
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:65
FL_VALUE_TYPE_FLOAT32_LIST
@ FL_VALUE_TYPE_FLOAT32_LIST
Definition: fl_value.h:75
FL_VALUE_TYPE_INT32_LIST
@ FL_VALUE_TYPE_INT32_LIST
Definition: fl_value.h:70
FL_VALUE_TYPE_UINT8_LIST
@ FL_VALUE_TYPE_UINT8_LIST
Definition: fl_value.h:69
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:73
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:74
FL_VALUE_TYPE_INT64_LIST
@ FL_VALUE_TYPE_INT64_LIST
Definition: fl_value.h:71
FL_VALUE_TYPE_FLOAT_LIST
@ FL_VALUE_TYPE_FLOAT_LIST
Definition: fl_value.h:72
FL_VALUE_TYPE_CUSTOM
@ FL_VALUE_TYPE_CUSTOM
Definition: fl_value.h:76
FL_VALUE_TYPE_FLOAT
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:67

## Function Documentation

## ◆ fl_value_append()

void fl_value_append | ( | FlValue * | value,
|  | FlValue * | child
| ) |  |

fl_value_append: @value: an FlValue of type FL_VALUE_TYPE_LIST. @child: an FlValue.

Adds @child to the end of @value. Calling this with an FlValue that is not of type FL_VALUE_TYPE_LIST is a programming error.

Definition at line 592 of file fl_value.cc.

592 {
593 g_return_if_fail(self != nullptr);
594 g_return_if_fail(self->type == FL_VALUE_TYPE_LIST);
595 g_return_if_fail(value != nullptr);
596
597 fl_value_append_take(self, fl_value_ref(value));
598 }
self
g_cond_signal & self
Definition: fl_compositor_software.cc:67
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600

References fl_value_append_take(), fl_value_ref(), FL_VALUE_TYPE_LIST, self, and value.

Referenced by FlValueHandler::add(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), read_list_value(), and TEST().

## ◆ fl_value_append_take()

void fl_value_append_take | ( | FlValue * | value,
|  | FlValue * | child
| ) |  |

fl_value_append_take: @value: an FlValue of type FL_VALUE_TYPE_LIST. @child: (transfer full): an FlValue.

Adds @child to the end of @value. Ownership of @child is taken by @value. Calling this with an FlValue that is not of type FL_VALUE_TYPE_LIST is a programming error.

Definition at line 600 of file fl_value.cc.

600 {
601 g_return_if_fail(self != nullptr);
602 g_return_if_fail(self->type == FL_VALUE_TYPE_LIST);
603 g_return_if_fail(value != nullptr);
604
605 FlValueList* v = reinterpret_cast<FlValueList*>(self);
606 g_ptr_array_add(v->values, value);
607 }
FlValueList
Definition: fl_value.cc:66
FlValueList::values
GPtrArray * values
Definition: fl_value.cc:68

References FL_VALUE_TYPE_LIST, self, value, and FlValueList::values.

Referenced by build_list(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_success_envelope(), fl_text_input_channel_perform_action(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), fl_value_append(), fl_value_new_list_from_strv(), fl_windowing_channel_make_create_regular_response(), resize_channel(), set_size_arg(), set_warns_on_channel_overflow(), and TEST().

## ◆ fl_value_equal()

bool fl_value_equal | ( | FlValue * | a,
|  | FlValue * | b
| ) |  |

fl_value_equal: : an FlValue. : an FlValue.

Compares two FlValue to see if they are equivalent. Two values are considered equivalent if they are of the same type and their data is the same including any child values. For values of type FL_VALUE_TYPE_MAP the order of the values does not matter.

Returns: TRUE if both values are equivalent.

Definition at line 471 of file fl_value.cc.

471 {
472 g_return_val_if_fail(a != nullptr, false);
473 g_return_val_if_fail(b != nullptr, false);
474
475 if (a->type != b->type) {
476 return false;
477 }
478
479 switch (a->type) {
480 case FL_VALUE_TYPE_NULL:
481 return true;
482 case FL_VALUE_TYPE_BOOL:
483 return fl_value_get_bool(a) == fl_value_get_bool(b);
484 case FL_VALUE_TYPE_INT:
485 return fl_value_get_int(a) == fl_value_get_int(b);
486 case FL_VALUE_TYPE_FLOAT:
487 return fl_value_get_float(a) == fl_value_get_float(b);
488 case FL_VALUE_TYPE_STRING: {
489 FlValueString* a_ = reinterpret_cast<FlValueString*>(a);
490 FlValueString* b_ = reinterpret_cast<FlValueString*>(b);
491 return g_strcmp0(a_->value, b_->value) == 0;
492 }
493 case FL_VALUE_TYPE_UINT8_LIST: {
494 if (fl_value_get_length(a) != fl_value_get_length(b)) {
495 return false;
496 }
497 const uint8_t* values_a = fl_value_get_uint8_list(a);
498 const uint8_t* values_b = fl_value_get_uint8_list(b);
499 for (size_t i = 0; i < fl_value_get_length(a); i++) {
500 if (values_a[i] != values_b[i]) {
501 return false;
502 }
503 }
504 return true;
505 }
506 case FL_VALUE_TYPE_INT32_LIST: {
507 if (fl_value_get_length(a) != fl_value_get_length(b)) {
508 return false;
509 }
510 const int32_t* values_a = fl_value_get_int32_list(a);
511 const int32_t* values_b = fl_value_get_int32_list(b);
512 for (size_t i = 0; i < fl_value_get_length(a); i++) {
513 if (values_a[i] != values_b[i]) {
514 return false;
515 }
516 }
517 return true;
518 }
519 case FL_VALUE_TYPE_INT64_LIST: {
520 if (fl_value_get_length(a) != fl_value_get_length(b)) {
521 return false;
522 }
523 const int64_t* values_a = fl_value_get_int64_list(a);
524 const int64_t* values_b = fl_value_get_int64_list(b);
525 for (size_t i = 0; i < fl_value_get_length(a); i++) {
526 if (values_a[i] != values_b[i]) {
527 return false;
528 }
529 }
530 return true;
531 }
532 case FL_VALUE_TYPE_FLOAT32_LIST: {
533 if (fl_value_get_length(a) != fl_value_get_length(b)) {
534 return false;
535 }
536 const float* values_a = fl_value_get_float32_list(a);
537 const float* values_b = fl_value_get_float32_list(b);
538 for (size_t i = 0; i < fl_value_get_length(a); i++) {
539 if (values_a[i] != values_b[i]) {
540 return false;
541 }
542 }
543 return true;
544 }
545 case FL_VALUE_TYPE_FLOAT_LIST: {
546 if (fl_value_get_length(a) != fl_value_get_length(b)) {
547 return false;
548 }
549 const double* values_a = fl_value_get_float_list(a);
550 const double* values_b = fl_value_get_float_list(b);
551 for (size_t i = 0; i < fl_value_get_length(a); i++) {
552 if (values_a[i] != values_b[i]) {
553 return false;
554 }
555 }
556 return true;
557 }
558 case FL_VALUE_TYPE_LIST: {
559 if (fl_value_get_length(a) != fl_value_get_length(b)) {
560 return false;
561 }
562 for (size_t i = 0; i < fl_value_get_length(a); i++) {
563 if (!fl_value_equal(fl_value_get_list_value(a, i),
564 fl_value_get_list_value(b, i))) {
565 return false;
566 }
567 }
568 return true;
569 }
570 case FL_VALUE_TYPE_MAP: {
571 if (fl_value_get_length(a) != fl_value_get_length(b)) {
572 return false;
573 }
574 for (size_t i = 0; i < fl_value_get_length(a); i++) {
575 FlValue* key = fl_value_get_map_key(a, i);
576 FlValue* value_b = fl_value_lookup(b, key);
577 if (value_b == nullptr) {
578 return false;
579 }
580 FlValue* value_a = fl_value_get_map_value(a, i);
581 if (!fl_value_equal(value_a, value_b)) {
582 return false;
583 }
584 }
585 return true;
586 }
587 case FL_VALUE_TYPE_CUSTOM:
588 return false;
589 }
590 }
i
int i
Definition: fl_socket_accessible.cc:18
fl_value_get_map_value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:792
fl_value_lookup
G_MODULE_EXPORT FlValue * fl_value_lookup(FlValue *self, FlValue *key)
Definition: fl_value.cc:800
fl_value_get_float_list
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:717
fl_value_get_list_value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:776
fl_value_get_uint8_list
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:689
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
fl_value_get_float32_list
G_MODULE_EXPORT const float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:710
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
fl_value_get_map_key
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:784
fl_value_get_int64_list
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:703
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
fl_value_get_int32_list
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:696
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
FlValueString
Definition: fl_value.cc:31
FlValueString::value
gchar * value
Definition: fl_value.cc:33

References fl_value_get_bool(), fl_value_get_float(), fl_value_get_float32_list(), fl_value_get_float_list(), fl_value_get_int(), fl_value_get_int32_list(), fl_value_get_int64_list(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_map_key(), fl_value_get_map_value(), fl_value_get_uint8_list(), fl_value_lookup(), FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_CUSTOM, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_FLOAT32_LIST, FL_VALUE_TYPE_FLOAT_LIST, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_INT32_LIST, FL_VALUE_TYPE_INT64_LIST, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, FL_VALUE_TYPE_UINT8_LIST, i, and FlValueString::value.

Referenced by decode_response_with_error(), decode_response_with_success(), fl_test_application_activate(), fl_value_lookup_index(), set_client(), set_editing_state(), and TEST().

## ◆ fl_value_get_bool()

bool fl_value_get_bool | ( | FlValue * | value | ) |

fl_value_get_bool: @value: an FlValue of type FL_VALUE_TYPE_BOOL.

Gets the boolean value of @value. Calling this with an FlValue that is not of type FL_VALUE_TYPE_BOOL is a programming error.

Returns: a boolean value.

Definition at line 661 of file fl_value.cc.

661 {
662 g_return_val_if_fail(self != nullptr, FALSE);
663 g_return_val_if_fail(self->type == FL_VALUE_TYPE_BOOL, FALSE);
664 FlValueBool* v = reinterpret_cast<FlValueBool*>(self);
665 return v->value;
666 }
FlValueBool
Definition: fl_value.cc:16
FlValueBool::value
bool value
Definition: fl_value.cc:18

References FL_VALUE_TYPE_BOOL, self, and FlValueBool::value.

Referenced by fl_key_event_channel_send_finish(), fl_standard_message_codec_real_write_value(), fl_value_equal(), G_DEFINE_TYPE(), set_client(), TEST(), and value_to_string().

## ◆ fl_value_get_custom_type()

int fl_value_get_custom_type | ( | FlValue * | value | ) |

fl_value_get_custom_type: @value: an FlValue of type FL_VALUE_TYPE_CUSTOM.

Gets the type ID for this custom type.

Returns: a type ID.

Definition at line 822 of file fl_value.cc.

822 {
823 g_return_val_if_fail(self != nullptr, -1);
824 g_return_val_if_fail(self->type == FL_VALUE_TYPE_CUSTOM, -1);
825
826 FlValueCustom* v = reinterpret_cast<FlValueCustom*>(self);
827 return v->type;
828 }
FlValueCustom
Definition: fl_value.cc:77
FlValueCustom::type
int type
Definition: fl_value.cc:79

References FL_VALUE_TYPE_CUSTOM, self, and FlValueCustom::type.

Referenced by fl_test_method_message_codec_write_value(), fl_test_standard_message_codec_write_value(), TEST(), and value_to_string().

## ◆ fl_value_get_custom_value()

gconstpointer fl_value_get_custom_value | ( | FlValue * | value | ) |

fl_value_get_custom_value: @value: an FlValue of type FL_VALUE_TYPE_CUSTOM.

Gets the address of the custom value.

Returns: a pointer to the custom value.

Definition at line 830 of file fl_value.cc.

830 {
831 g_return_val_if_fail(self != nullptr, nullptr);
832 g_return_val_if_fail(self->type == FL_VALUE_TYPE_CUSTOM, nullptr);
833
834 FlValueCustom* v = reinterpret_cast<FlValueCustom*>(self);
835 return v->value;
836 }
FlValueCustom::value
gconstpointer value
Definition: fl_value.cc:80

References FL_VALUE_TYPE_CUSTOM, self, and FlValueCustom::value.

Referenced by TEST().

## ◆ fl_value_get_custom_value_object()

GObject* fl_value_get_custom_value_object | ( | FlValue * | value | ) |

fl_value_get_custom_value_object: @value: an FlValue of type FL_VALUE_TYPE_CUSTOM.

Gets the custom value as an object.

Returns: an object.

Definition at line 838 of file fl_value.cc.

838 {
839 g_return_val_if_fail(self != nullptr, nullptr);
840 g_return_val_if_fail(self->type == FL_VALUE_TYPE_CUSTOM, nullptr);
841
842 FlValueCustom* v = reinterpret_cast<FlValueCustom*>(self);
843 return G_OBJECT(v->value);
844 }

References FL_VALUE_TYPE_CUSTOM, self, and FlValueCustom::value.

Referenced by TEST().

## ◆ fl_value_get_float()

double fl_value_get_float | ( | FlValue * | value | ) |

fl_value_get_float: @value: an FlValue of type FL_VALUE_TYPE_FLOAT.

Gets the floating point number of @value. Calling this with an FlValue that is not of type FL_VALUE_TYPE_FLOAT is a programming error.

Returns: a floating point number.

Definition at line 675 of file fl_value.cc.

675 {
676 g_return_val_if_fail(self != nullptr, 0.0);
677 g_return_val_if_fail(self->type == FL_VALUE_TYPE_FLOAT, 0.0);
678 FlValueDouble* v = reinterpret_cast<FlValueDouble*>(self);
679 return v->value;
680 }
FlValueDouble
Definition: fl_value.cc:26
FlValueDouble::value
double value
Definition: fl_value.cc:28

References FL_VALUE_TYPE_FLOAT, self, and FlValueDouble::value.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), G_DEFINE_TYPE(), parse_size_value(), set_editable_size_and_transform(), set_marked_text_rect(), TEST(), and value_to_string().

## ◆ fl_value_get_float32_list()

const float* fl_value_get_float32_list | ( | FlValue * | value | ) |

fl_value_get_float32_list: @value: an FlValue of type FL_VALUE_TYPE_FLOAT32_LIST.

Gets the array of floating point numbers @value contains. The data contains fl_value_get_length() elements. Calling this with an FlValue that is not of type FL_VALUE_TYPE_FLOAT32_LIST is a programming error.

Returns: an array of floating point numbers.

Definition at line 710 of file fl_value.cc.

710 {
711 g_return_val_if_fail(self != nullptr, nullptr);
712 g_return_val_if_fail(self->type == FL_VALUE_TYPE_FLOAT32_LIST, nullptr);
713 FlValueFloat32List* v = reinterpret_cast<FlValueFloat32List*>(self);
714 return v->values;
715 }
FlValueFloat32List
Definition: fl_value.cc:54
FlValueFloat32List::values
float * values
Definition: fl_value.cc:56

References FL_VALUE_TYPE_FLOAT32_LIST, self, and FlValueFloat32List::values.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), TEST(), and value_to_string().

## ◆ fl_value_get_float_list()

const double* fl_value_get_float_list | ( | FlValue * | value | ) |

fl_value_get_float_list: @value: an FlValue of type FL_VALUE_TYPE_FLOAT_LIST.

Gets the array of floating point numbers @value contains. The data contains fl_value_get_length() elements. Calling this with an FlValue that is not of type FL_VALUE_TYPE_FLOAT_LIST is a programming error.

Returns: an array of floating point numbers.

Definition at line 717 of file fl_value.cc.

717 {
718 g_return_val_if_fail(self != nullptr, nullptr);
719 g_return_val_if_fail(self->type == FL_VALUE_TYPE_FLOAT_LIST, nullptr);
720 FlValueFloatList* v = reinterpret_cast<FlValueFloatList*>(self);
721 return v->values;
722 }
FlValueFloatList
Definition: fl_value.cc:60
FlValueFloatList::values
double * values
Definition: fl_value.cc:62

References FL_VALUE_TYPE_FLOAT_LIST, self, and FlValueFloatList::values.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), G_DEFINE_TYPE(), TEST(), and value_to_string().

## ◆ fl_value_get_int()

int64_t fl_value_get_int | ( | FlValue * | value | ) |

fl_value_get_int: @value: an FlValue of type FL_VALUE_TYPE_INT.

Gets the integer number of @value. Calling this with an FlValue that is not of type FL_VALUE_TYPE_INT is a programming error.

Returns: an integer number.

Definition at line 668 of file fl_value.cc.

668 {
669 g_return_val_if_fail(self != nullptr, 0);
670 g_return_val_if_fail(self->type == FL_VALUE_TYPE_INT, 0);
671 FlValueInt* v = reinterpret_cast<FlValueInt*>(self);
672 return v->value;
673 }
FlValueInt
Definition: fl_value.cc:21
FlValueInt::value
int64_t value
Definition: fl_value.cc:23

References FL_VALUE_TYPE_INT, self, and FlValueInt::value.

Referenced by destroy_window(), fl_standard_message_codec_real_write_value(), fl_test_codec_encode_error_envelope(), fl_test_codec_encode_message(), fl_test_codec_encode_method_call(), fl_test_codec_encode_success_envelope(), fl_value_equal(), G_DEFINE_TYPE(), modify_regular(), parse_create_regular_response(), set_client(), set_editing_state(), TEST(), and value_to_string().

## ◆ fl_value_get_int32_list()

const int32_t* fl_value_get_int32_list | ( | FlValue * | value | ) |

fl_value_get_int32_list: @value: an FlValue of type FL_VALUE_TYPE_INT32_LIST.

Gets the array of 32 bit integers @value contains. The data contains fl_value_get_length() elements. Calling this with an FlValue that is not of type FL_VALUE_TYPE_INT32_LIST is a programming error.

Returns: an array of 32 bit integers.

Definition at line 696 of file fl_value.cc.

696 {
697 g_return_val_if_fail(self != nullptr, nullptr);
698 g_return_val_if_fail(self->type == FL_VALUE_TYPE_INT32_LIST, nullptr);
699 FlValueInt32List* v = reinterpret_cast<FlValueInt32List*>(self);
700 return v->values;
701 }
FlValueInt32List
Definition: fl_value.cc:42
FlValueInt32List::values
int32_t * values
Definition: fl_value.cc:44

References FL_VALUE_TYPE_INT32_LIST, self, and FlValueInt32List::values.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), fl_view_accessible_handle_update_semantics(), G_DEFINE_TYPE(), TEST(), and value_to_string().

## ◆ fl_value_get_int64_list()

const int64_t* fl_value_get_int64_list | ( | FlValue * | value | ) |

fl_value_get_int64_list: @value: an FlValue of type FL_VALUE_TYPE_INT64_LIST.

Gets the array of 64 bit integers @value contains. The data contains fl_value_get_length() elements. Calling this with an FlValue that is not of type FL_VALUE_TYPE_INT64_LIST is a programming error.

Returns: an array of 64 bit integers.

Definition at line 703 of file fl_value.cc.

703 {
704 g_return_val_if_fail(self != nullptr, nullptr);
705 g_return_val_if_fail(self->type == FL_VALUE_TYPE_INT64_LIST, nullptr);
706 FlValueInt64List* v = reinterpret_cast<FlValueInt64List*>(self);
707 return v->values;
708 }
FlValueInt64List
Definition: fl_value.cc:48
FlValueInt64List::values
int64_t * values
Definition: fl_value.cc:50

References FL_VALUE_TYPE_INT64_LIST, self, and FlValueInt64List::values.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), G_DEFINE_TYPE(), TEST(), and value_to_string().

## ◆ fl_value_get_length()

size_t fl_value_get_length | ( | FlValue * | value | ) |

fl_value_get_length: @value: an FlValue of type FL_VALUE_TYPE_UINT8_LIST, FL_VALUE_TYPE_INT32_LIST, FL_VALUE_TYPE_INT64_LIST, FL_VALUE_TYPE_FLOAT32_LIST, FL_VALUE_TYPE_FLOAT_LIST, FL_VALUE_TYPE_LIST or FL_VALUE_TYPE_MAP.

Gets the number of elements @value contains. This is only valid for list and map types. Calling this with other types is a programming error.

Returns: the number of elements inside @value.

Definition at line 724 of file fl_value.cc.

724 {
725 g_return_val_if_fail(self != nullptr, 0);
726 g_return_val_if_fail(self->type == FL_VALUE_TYPE_UINT8_LIST ||
727 self->type == FL_VALUE_TYPE_INT32_LIST ||
728 self->type == FL_VALUE_TYPE_INT64_LIST ||
729 self->type == FL_VALUE_TYPE_FLOAT32_LIST ||
730 self->type == FL_VALUE_TYPE_FLOAT_LIST ||
731 self->type == FL_VALUE_TYPE_LIST ||
732 self->type == FL_VALUE_TYPE_MAP,
733 0);
734
735 switch (self->type) {
736 case FL_VALUE_TYPE_UINT8_LIST: {
737 FlValueUint8List* v = reinterpret_cast<FlValueUint8List*>(self);
738 return v->values_length;
739 }
740 case FL_VALUE_TYPE_INT32_LIST: {
741 FlValueInt32List* v = reinterpret_cast<FlValueInt32List*>(self);
742 return v->values_length;
743 }
744 case FL_VALUE_TYPE_INT64_LIST: {
745 FlValueInt64List* v = reinterpret_cast<FlValueInt64List*>(self);
746 return v->values_length;
747 }
748 case FL_VALUE_TYPE_FLOAT32_LIST: {
749 FlValueFloat32List* v = reinterpret_cast<FlValueFloat32List*>(self);
750 return v->values_length;
751 }
752 case FL_VALUE_TYPE_FLOAT_LIST: {
753 FlValueFloatList* v = reinterpret_cast<FlValueFloatList*>(self);
754 return v->values_length;
755 }
756 case FL_VALUE_TYPE_LIST: {
757 FlValueList* v = reinterpret_cast<FlValueList*>(self);
758 return v->values->len;
759 }
760 case FL_VALUE_TYPE_MAP: {
761 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
762 return v->keys->len;
763 }
764 case FL_VALUE_TYPE_NULL:
765 case FL_VALUE_TYPE_BOOL:
766 case FL_VALUE_TYPE_INT:
767 case FL_VALUE_TYPE_FLOAT:
768 case FL_VALUE_TYPE_STRING:
769 case FL_VALUE_TYPE_CUSTOM:
770 return 0;
771 }
772
773 return 0;
774 }
FlValueFloat32List::values_length
size_t values_length
Definition: fl_value.cc:57
FlValueFloatList::values_length
size_t values_length
Definition: fl_value.cc:63
FlValueInt32List::values_length
size_t values_length
Definition: fl_value.cc:45
FlValueInt64List::values_length
size_t values_length
Definition: fl_value.cc:51
FlValueMap
Definition: fl_value.cc:71
FlValueMap::keys
GPtrArray * keys
Definition: fl_value.cc:73
FlValueUint8List
Definition: fl_value.cc:36
FlValueUint8List::values_length
size_t values_length
Definition: fl_value.cc:39

References FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_CUSTOM, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_FLOAT32_LIST, FL_VALUE_TYPE_FLOAT_LIST, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_INT32_LIST, FL_VALUE_TYPE_INT64_LIST, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, FL_VALUE_TYPE_UINT8_LIST, FlValueMap::keys, self, FlValueList::values, FlValueUint8List::values_length, FlValueInt32List::values_length, FlValueInt64List::values_length, FlValueFloat32List::values_length, and FlValueFloatList::values_length.

Referenced by fl_binary_codec_encode_message(), fl_json_method_codec_decode_response(), fl_standard_message_codec_real_write_value(), fl_value_equal(), fl_value_lookup_index(), fl_view_accessible_handle_update_semantics(), G_DEFINE_TYPE(), is_valid_size_argument(), parse_create_regular_response(), set_client(), set_editable_size_and_transform(), TEST(), and value_to_string().

## ◆ fl_value_get_list_value()

FlValue* fl_value_get_list_value | ( | FlValue * | value,
|  | size_t | index
| ) |  |

fl_value_get_list_value: @value: an FlValue of type FL_VALUE_TYPE_LIST. @index: an index in the list.

Gets a child element of the list. It is a programming error to request an index that is outside the size of the list as returned from fl_value_get_length(). Calling this with an FlValue that is not of type FL_VALUE_TYPE_LIST is a programming error.

Returns: an FlValue.

Definition at line 776 of file fl_value.cc.

776 {
777 g_return_val_if_fail(self != nullptr, nullptr);
778 g_return_val_if_fail(self->type == FL_VALUE_TYPE_LIST, nullptr);
779
780 FlValueList* v = reinterpret_cast<FlValueList*>(self);
781 return static_cast<FlValue*>(g_ptr_array_index(v->values, index));
782 }

References FL_VALUE_TYPE_LIST, self, and FlValueList::values.

Referenced by fl_json_method_codec_decode_response(), fl_standard_message_codec_real_write_value(), fl_value_equal(), G_DEFINE_TYPE(), is_valid_size_argument(), parse_create_regular_response(), parse_size_value(), set_client(), set_editable_size_and_transform(), TEST(), and value_to_string().

## ◆ fl_value_get_map_key()

FlValue* fl_value_get_map_key | ( | FlValue * | value,
|  | size_t | index
| ) |  |

fl_value_get_map_key: @value: an FlValue of type FL_VALUE_TYPE_MAP. @index: an index in the map.

Gets a key from the map. It is a programming error to request an index that is outside the size of the list as returned from fl_value_get_length(). Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Returns: an FlValue.

Definition at line 784 of file fl_value.cc.

784 {
785 g_return_val_if_fail(self != nullptr, nullptr);
786 g_return_val_if_fail(self->type == FL_VALUE_TYPE_MAP, nullptr);
787
788 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
789 return static_cast<FlValue*>(g_ptr_array_index(v->keys, index));
790 }

References FL_VALUE_TYPE_MAP, FlValueMap::keys, and self.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), fl_value_lookup_index(), G_DEFINE_TYPE(), TEST(), and value_to_string().

## ◆ fl_value_get_map_value()

FlValue* fl_value_get_map_value | ( | FlValue * | value,
|  | size_t | index
| ) |  |

fl_value_get_map_value: @value: an FlValue of type FL_VALUE_TYPE_MAP. @index: an index in the map.

Gets a value from the map. It is a programming error to request an index that is outside the size of the list as returned from fl_value_get_length(). Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Returns: an FlValue.

Definition at line 792 of file fl_value.cc.

792 {
793 g_return_val_if_fail(self != nullptr, nullptr);
794 g_return_val_if_fail(self->type == FL_VALUE_TYPE_MAP, nullptr);
795
796 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
797 return static_cast<FlValue*>(g_ptr_array_index(v->values, index));
798 }
FlValueMap::values
GPtrArray * values
Definition: fl_value.cc:74

References FL_VALUE_TYPE_MAP, self, and FlValueMap::values.

Referenced by fl_standard_message_codec_real_write_value(), fl_value_equal(), fl_value_lookup(), G_DEFINE_TYPE(), TEST(), and value_to_string().

## ◆ fl_value_get_string()

const gchar* fl_value_get_string | ( | FlValue * | value | ) |

fl_value_get_string: @value: an FlValue of type FL_VALUE_TYPE_STRING.

Gets the UTF-8 text contained in @value. Calling this with an FlValue that is not of type FL_VALUE_TYPE_STRING is a programming error.

Returns: a UTF-8 encoded string.

Definition at line 682 of file fl_value.cc.

682 {
683 g_return_val_if_fail(self != nullptr, nullptr);
684 g_return_val_if_fail(self->type == FL_VALUE_TYPE_STRING, nullptr);
685 FlValueString* v = reinterpret_cast<FlValueString*>(self);
686 return v->value;
687 }

References FL_VALUE_TYPE_STRING, self, and FlValueString::value.

Referenced by activate_system_cursor(), clipboard_get_data(), clipboard_set_data(), create_regular(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_standard_message_codec_real_write_value(), fl_standard_method_codec_decode_method_call(), fl_standard_method_codec_decode_response(), fl_string_codec_encode_message(), G_DEFINE_TYPE(), get_exit_response(), modify_regular(), parse_window_state_value(), set_client(), set_editing_state(), system_exit_application(), system_sound_play(), TEST(), and value_to_string().

## ◆ fl_value_get_type()

FlValueType fl_value_get_type | ( | FlValue * | value | ) |

fl_value_get_type: @value: an FlValue.

Gets the type of @value.

Returns: an FlValueType.

Definition at line 466 of file fl_value.cc.

466 {
467 g_return_val_if_fail(self != nullptr, FL_VALUE_TYPE_NULL);
468 return self->type;
469 }

References FL_VALUE_TYPE_NULL.

Referenced by activate_system_cursor(), FlValueHandler::add(), clipboard_get_data(), clipboard_set_data(), create_regular(), destroy_window(), fl_binary_codec_encode_message(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_standard_message_codec_real_write_value(), fl_standard_method_codec_decode_method_call(), fl_standard_method_codec_decode_response(), fl_string_codec_encode_message(), fl_test_codec_encode_error_envelope(), fl_test_codec_encode_message(), fl_test_codec_encode_method_call(), fl_test_codec_encode_success_envelope(), fl_test_method_message_codec_write_value(), fl_test_standard_message_codec_write_value(), G_DEFINE_TYPE(), get_exit_response(), is_valid_size_argument(), modify_regular(), parse_create_regular_response(), parse_window_state_value(), set_client(), system_exit_application(), system_sound_play(), and TEST().

## ◆ fl_value_get_uint8_list()

const uint8_t* fl_value_get_uint8_list | ( | FlValue * | value | ) |

fl_value_get_uint8_list: @value: an FlValue of type FL_VALUE_TYPE_UINT8_LIST.

Gets the array of unisigned 8 bit integers @value contains. The data contains fl_value_get_length() elements. Calling this with an FlValue that is not of type FL_VALUE_TYPE_UINT8_LIST is a programming error.

Returns: an array of unsigned 8 bit integers.

Definition at line 689 of file fl_value.cc.

689 {
690 g_return_val_if_fail(self != nullptr, nullptr);
691 g_return_val_if_fail(self->type == FL_VALUE_TYPE_UINT8_LIST, nullptr);
692 FlValueUint8List* v = reinterpret_cast<FlValueUint8List*>(self);
693 return v->values;
694 }
FlValueUint8List::values
uint8_t * values
Definition: fl_value.cc:38

References FL_VALUE_TYPE_UINT8_LIST, self, and FlValueUint8List::values.

Referenced by fl_binary_codec_encode_message(), fl_standard_message_codec_real_write_value(), fl_value_equal(), G_DEFINE_TYPE(), TEST(), and value_to_string().

## ◆ fl_value_lookup()

FlValue* fl_value_lookup | ( | FlValue * | value,
|  | FlValue * | key
| ) |  |

fl_value_lookup: @value: an FlValue of type FL_VALUE_TYPE_MAP. @key: a key value.

Gets the map entry that matches @key. Keys are checked using fl_value_equal(). Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Map lookups are not optimized for performance - if you have a large map or need frequent access you should copy the data into another structure, e.g. #GHashTable.

Returns: (allow-none): the value with this key or NULL if not one present.

Definition at line 800 of file fl_value.cc.

800 {
801 g_return_val_if_fail(self != nullptr, nullptr);
802 g_return_val_if_fail(self->type == FL_VALUE_TYPE_MAP, nullptr);
803
804 ssize_t index = fl_value_lookup_index(self, key);
805 if (index < 0) {
806 return nullptr;
807 }
808 return fl_value_get_map_value(self, index);
809 }
fl_value_lookup_index
static ssize_t fl_value_lookup_index(FlValue *self, FlValue *key)
Definition: fl_value.cc:99

References fl_value_get_map_value(), fl_value_lookup_index(), FL_VALUE_TYPE_MAP, and self.

Referenced by fl_value_equal(), fl_value_lookup_string(), and TEST().

## ◆ fl_value_lookup_string()

FlValue* fl_value_lookup_string | ( | FlValue * | value,
|  | const gchar * | key
| ) |  |

fl_value_lookup_string: @value: an FlValue of type FL_VALUE_TYPE_MAP. @key: a key value.

Gets the map entry that matches @key. Keys are checked using fl_value_equal(). Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Map lookups are not optimized for performance - if you have a large map or need frequent access you should copy the data into another structure, e.g. #GHashTable.

Returns: (allow-none): the value with this key or NULL if not one present.

Definition at line 811 of file fl_value.cc.

812 {
813 g_return_val_if_fail(self != nullptr, nullptr);
814 FlValue* string_key = fl_value_new_string(key);
815 FlValue* value = fl_value_lookup(self, string_key);
816 // Explicit unref used because the g_autoptr is triggering a false positive
817 // with clang-tidy.
818 fl_value_unref(string_key);
819 return value;
820 }
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
fl_value_unref
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
Definition: fl_value.cc:400

References fl_value_lookup(), fl_value_new_string(), fl_value_unref(), and value.

Referenced by activate_system_cursor(), clipboard_set_data(), create_regular(), destroy_window(), fl_json_method_codec_decode_method_call(), fl_key_event_channel_send_finish(), get_exit_response(), modify_regular(), parse_create_regular_response(), set_client(), set_editable_size_and_transform(), set_editing_state(), set_marked_text_rect(), system_exit_application(), and TEST().

## ◆ fl_value_new_bool()

FlValue* fl_value_new_bool | ( | bool | value | ) |

fl_value_new_bool: @value: the value.

Creates an FlValue that contains a boolean value. The equivalent Dart type is a bool.

Returns: a new FlValue.

Definition at line 255 of file fl_value.cc.

255 {
256 FlValueBool* self = reinterpret_cast<FlValueBool*>(
257 fl_value_new(FL_VALUE_TYPE_BOOL, sizeof(FlValueBool)));
258 self->value = value ? true : false;
259 return reinterpret_cast<FlValue*>(self);
260 }
fl_value_new
static FlValue * fl_value_new(FlValueType type, size_t size)
Definition: fl_value.cc:84

References fl_value_new(), FL_VALUE_TYPE_BOOL, value, and FlValueBool::value.

Referenced by FlValueHandler::Bool(), build_editing_delta(), build_editing_state(), build_input_config(), encode_bool(), fl_accessible_text_field_perform_action(), fl_platform_channel_respond_clipboard_has_strings(), fl_settings_channel_send(), fl_standard_message_codec_read_value_of_type(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), set_key_event_channel(), set_warns_on_channel_overflow(), and TEST().

## ◆ fl_value_new_custom()

FlValue* fl_value_new_custom | ( | int | type,
|  | gconstpointer | value,
|  | GDestroyNotify | destroy_notify
| ) |  |

fl_value_new_custom: @type: an ID for this type. @value: pointer to the custom value. @destroy_notify: function to call when @value is no longer required.

Creates a new custom data type. The Dart side of the channel must have equivalent custom code to access this object.

Returns: a new FlValue.

Definition at line 374 of file fl_value.cc.

376 {
377 FlValueCustom* self = reinterpret_cast<FlValueCustom*>(
378 fl_value_new(FL_VALUE_TYPE_CUSTOM, sizeof(FlValueCustom)));
379 self->type = type;
380 self->value = value;
381 self->destroy_notify = destroy_notify;
382 return reinterpret_cast<FlValue*>(self);
383 }
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1117

References fl_value_new(), FL_VALUE_TYPE_CUSTOM, type, FlValueCustom::type, and value.

Referenced by fl_value_new_custom_object(), fl_value_new_custom_object_take(), read_custom_value(), read_custom_value1(), read_custom_value2(), and TEST().

## ◆ fl_value_new_custom_object()

FlValue* fl_value_new_custom_object | ( | int | type,
|  | GObject * | object
| ) |  |

fl_value_new_custom_object: @type: an ID for this type. @object: the custom object.

Creates a new custom data type. The Dart side of the channel must have equivalent custom code to access this object.

Returns: a new FlValue.

Definition at line 385 of file fl_value.cc.

385 {
386 return fl_value_new_custom(type, g_object_ref(object), g_object_unref);
387 }
fl_value_new_custom
G_MODULE_EXPORT FlValue * fl_value_new_custom(int type, gconstpointer value, GDestroyNotify destroy_notify)
Definition: fl_value.cc:374

References fl_value_new_custom(), and type.

Referenced by TEST().

## ◆ fl_value_new_custom_object_take()

FlValue* fl_value_new_custom_object_take | ( | int | type,
|  | GObject * | object
| ) |  |

fl_value_new_custom_object_take: @type: an ID for this type. @object: (transfer full): the custom object.

Creates a new custom data type. The Dart side of the channel must have equivalent custom code to access this object. Ownership of @object is taken.

Returns: a new FlValue.

Definition at line 389 of file fl_value.cc.

390 {
391 return fl_value_new_custom(type, object, g_object_unref);
392 }

References fl_value_new_custom(), and type.

Referenced by TEST().

## ◆ fl_value_new_float()

FlValue* fl_value_new_float | ( | double | value | ) |

fl_value_new_float: @value: the value.

Creates an FlValue that contains a floating point number. The equivalent Dart type is a num.

Returns: a new FlValue.

Definition at line 269 of file fl_value.cc.

269 {
270 FlValueDouble* self = reinterpret_cast<FlValueDouble*>(
271 fl_value_new(FL_VALUE_TYPE_FLOAT, sizeof(FlValueDouble)));
272 self->value = value;
273 return reinterpret_cast<FlValue*>(self);
274 }

References fl_value_new(), FL_VALUE_TYPE_FLOAT, value, and FlValueDouble::value.

Referenced by FlValueHandler::Double(), encode_float(), fl_settings_channel_send(), fl_windowing_channel_make_create_regular_response(), read_float64_value(), set_size_arg(), TEST(), and FlValueHandler::Uint64().

## ◆ fl_value_new_float32_list()

FlValue* fl_value_new_float32_list | ( | const float * | value,
|  | size_t | value_length
| ) |  |

fl_value_new_float32_list: @value: an array of floating point numbers. @value_length: number of elements in @value.

Creates an ordered list containing 32 bit floating point numbers. The equivalent Dart type is a Float32List.

Returns: a new FlValue.

Definition at line 329 of file fl_value.cc.

330 {
331 FlValueFloat32List* self = reinterpret_cast<FlValueFloat32List*>(
332 fl_value_new(FL_VALUE_TYPE_FLOAT32_LIST, sizeof(FlValueFloat32List)));
333 self->values_length = 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);
337 }

References fl_value_new(), FL_VALUE_TYPE_FLOAT32_LIST, self, and FlValueFloat32List::values_length.

Referenced by read_float32_list_value(), and TEST().

## ◆ fl_value_new_float_list()

FlValue* fl_value_new_float_list | ( | const double * | value,
|  | size_t | value_length
| ) |  |

fl_value_new_float_list: @value: an array of floating point numbers. @value_length: number of elements in @value.

Creates an ordered list containing floating point numbers. The equivalent Dart type is a Float64List.

Returns: a new FlValue.

Definition at line 339 of file fl_value.cc.

340 {
341 FlValueFloatList* self = reinterpret_cast<FlValueFloatList*>(
342 fl_value_new(FL_VALUE_TYPE_FLOAT_LIST, sizeof(FlValueFloatList)));
343 self->values_length = 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);
347 }

References fl_value_new(), FL_VALUE_TYPE_FLOAT_LIST, self, and FlValueFloatList::values_length.

Referenced by read_float64_list_value(), and TEST().

## ◆ fl_value_new_int()

FlValue* fl_value_new_int | ( | int64_t | value | ) |

fl_value_new_int: @value: the value.

Creates an FlValue that contains an integer number. The equivalent Dart type is a num.

Returns: a new FlValue.

Definition at line 262 of file fl_value.cc.

262 {
263 FlValueInt* self = reinterpret_cast<FlValueInt*>(
264 fl_value_new(FL_VALUE_TYPE_INT, sizeof(FlValueInt)));
265 self->value = value;
266 return reinterpret_cast<FlValue*>(self);
267 }

References fl_value_new(), FL_VALUE_TYPE_INT, value, and FlValueInt::value.

Referenced by build_editing_delta(), build_editing_state(), build_input_config(), encode_int(), fl_key_event_channel_send(), fl_test_codec_decode_message(), fl_test_codec_decode_response(), fl_text_input_channel_perform_action(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), fl_windowing_channel_make_create_regular_response(), get_keyboard_state(), FlValueHandler::Int(), FlValueHandler::Int64(), make_destroy_window_args(), make_modify_regular_args(), perform_set_selection_action(), read_int32_value(), read_int64_value(), resize_channel(), TEST(), FlValueHandler::Uint(), and FlValueHandler::Uint64().

## ◆ fl_value_new_int32_list()

FlValue* fl_value_new_int32_list | ( | const int32_t * | value,
|  | size_t | value_length
| ) |  |

fl_value_new_int32_list: @value: an array of signed 32 bit integers. @value_length: number of elements in @value.

Creates an ordered list containing 32 bit integers. The equivalent Dart type is a Int32List.

Returns: a new FlValue.

Definition at line 309 of file fl_value.cc.

310 {
311 FlValueInt32List* self = reinterpret_cast<FlValueInt32List*>(
312 fl_value_new(FL_VALUE_TYPE_INT32_LIST, sizeof(FlValueInt32List)));
313 self->values_length = 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);
317 }

References fl_value_new(), FL_VALUE_TYPE_INT32_LIST, self, and FlValueInt32List::values_length.

Referenced by fl_view_accessible_handle_update_semantics(), read_int32_list_value(), and TEST().

## ◆ fl_value_new_int64_list()

FlValue* fl_value_new_int64_list | ( | const int64_t * | value,
|  | size_t | value_length
| ) |  |

fl_value_new_int64_list: @value: an array of signed 64 bit integers. @value_length: number of elements in @value.

Creates an ordered list containing 64 bit integers. The equivalent Dart type is a Int64List.

Returns: a new FlValue.

Definition at line 319 of file fl_value.cc.

320 {
321 FlValueInt64List* self = reinterpret_cast<FlValueInt64List*>(
322 fl_value_new(FL_VALUE_TYPE_INT64_LIST, sizeof(FlValueInt64List)));
323 self->values_length = 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);
327 }

References fl_value_new(), FL_VALUE_TYPE_INT64_LIST, self, and FlValueInt64List::values_length.

Referenced by read_int64_list_value(), and TEST().

## ◆ fl_value_new_list()

FlValue* fl_value_new_list | ( |  | ) |

fl_value_new_list:

Creates an ordered list. Children can be added to the list using fl_value_append(). The children are accessed using fl_value_get_length() and fl_value_get_list_value(). The equivalent Dart type is a List<dynamic>.

The following example shows a simple list of values:

|[ g_autoptr(FlValue) value = fl_value_new_list (); fl_value_append_take (value, fl_value_new_string ("one"); fl_value_append_take (value, fl_value_new_int (2); fl_value_append_take (value, fl_value_new_float (3.0); ]|

This value can be decoded using:

|[ g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_LIST); for (size_t i = 0; i < fl_value_get_length (value); i++) { FlValue *child = fl_value_get_list_value (value, i); process_value (child); } ]|

Returns: a new FlValue.

Definition at line 349 of file fl_value.cc.

349 {
350 FlValueList* self = reinterpret_cast<FlValueList*>(
351 fl_value_new(FL_VALUE_TYPE_LIST, sizeof(FlValueList)));
352 self->values = g_ptr_array_new_with_free_func(fl_value_destroy);
353 return reinterpret_cast<FlValue*>(self);
354 }
fl_value_destroy
static void fl_value_destroy(gpointer value)
Definition: fl_value.cc:92

References fl_value_destroy(), fl_value_new(), FL_VALUE_TYPE_LIST, and FlValueList::values.

Referenced by build_list(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_success_envelope(), fl_text_input_channel_perform_action(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), fl_value_new_list_from_strv(), fl_windowing_channel_make_create_regular_response(), read_list_value(), resize_channel(), set_size_arg(), set_warns_on_channel_overflow(), FlValueHandler::StartArray(), and TEST().

## ◆ fl_value_new_list_from_strv()

FlValue* fl_value_new_list_from_strv | ( | const gchar *const * | value | ) |

fl_value_new_list_from_strv: @value: a NULL-terminated array of strings.

Creates an ordered list containing #FlString values.

Returns: a new FlValue.

Definition at line 356 of file fl_value.cc.

357 {
358 g_return_val_if_fail(str_array != nullptr, nullptr);
359 g_autoptr(FlValue) value = fl_value_new_list();
360 for (int i = 0; str_array[i] != nullptr; i++) {
361 fl_value_append_take(value, fl_value_new_string(str_array[i]));
362 }
363 return fl_value_ref(value);
364 }
g_autoptr
g_autoptr(GMutexLocker) locker
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349

References fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), fl_value_ref(), g_autoptr(), i, and value.

Referenced by TEST().

## ◆ fl_value_new_map()

FlValue* fl_value_new_map | ( |  | ) |

fl_value_new_map:

Creates an ordered associative array. Children can be added to the map using fl_value_set(), fl_value_set_take(), fl_value_set_string(), fl_value_set_string_take(). The children are accessed using fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(), fl_value_lookup() and fl_value_lookup_string(). The equivalent Dart type is a Map<dynamic>.

The following example shows how to create a map of values keyed by strings:

|[ g_autoptr(FlValue) value = fl_value_new_map (); fl_value_set_string_take (value, "name", fl_value_new_string ("Gandalf")); fl_value_set_string_take (value, "occupation", fl_value_new_string ("Wizard")); fl_value_set_string_take (value, "age", fl_value_new_int (2019)); ]|

This value can be decoded using: |[ g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_MAP); FlValue *name = fl_value_lookup_string (value, "name"); g_assert (fl_value_get_type (name) == FL_VALUE_TYPE_STRING); FlValue *age = fl_value_lookup_string (value, "age"); g_assert (fl_value_get_type (age) == FL_VALUE_TYPE_INT); g_message ("Next customer is %s (%d years old)", fl_value_get_string (name), fl_value_get_int (age)); ]|

Returns: a new FlValue.

Definition at line 366 of file fl_value.cc.

366 {
367 FlValueMap* self = reinterpret_cast<FlValueMap*>(
368 fl_value_new(FL_VALUE_TYPE_MAP, sizeof(FlValueMap)));
369 self->keys = g_ptr_array_new_with_free_func(fl_value_destroy);
370 self->values = g_ptr_array_new_with_free_func(fl_value_destroy);
371 return reinterpret_cast<FlValue*>(self);
372 }

References fl_value_destroy(), fl_value_new(), FL_VALUE_TYPE_MAP, and FlValueMap::keys.

Referenced by build_map(), fl_json_method_codec_encode_method_call(), fl_key_event_channel_send(), fl_platform_channel_make_system_request_app_exit_response(), fl_platform_channel_respond_clipboard_get_data(), fl_platform_channel_respond_clipboard_has_strings(), fl_platform_channel_system_request_app_exit(), fl_settings_channel_send(), fl_test_application_activate(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), fl_windowing_channel_make_create_regular_response(), get_keyboard_state(), make_create_regular_args(), make_destroy_window_args(), make_modify_regular_args(), perform_set_selection_action(), read_map_value(), set_key_event_channel(), FlValueHandler::StartObject(), and TEST().

## ◆ fl_value_new_null()

FlValue* fl_value_new_null | ( |  | ) |

fl_value_new_null:

Creates an FlValue that contains a null value. The equivalent Dart type is null.

Returns: a new FlValue.

Definition at line 251 of file fl_value.cc.

251 {
252 return fl_value_new(FL_VALUE_TYPE_NULL, sizeof(FlValue));
253 }

References fl_value_new(), and FL_VALUE_TYPE_NULL.

Referenced by fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_json_method_codec_encode_success_envelope(), fl_message_codec_encode_message(), fl_standard_message_codec_decode_message(), fl_standard_message_codec_read_value_of_type(), fl_test_codec_decode_method_call(), FlValueHandler::Null(), set_client(), set_editing_state(), and TEST().

## ◆ fl_value_new_string()

FlValue* fl_value_new_string | ( | const gchar * | value | ) |

fl_value_new_string: @value: a NULL-terminated UTF-8 string.

Creates an FlValue that contains UTF-8 text. The equivalent Dart type is a String.

Returns: a new FlValue.

Definition at line 276 of file fl_value.cc.

276 {
277 FlValueString* self = reinterpret_cast<FlValueString*>(
278 fl_value_new(FL_VALUE_TYPE_STRING, sizeof(FlValueString)));
279 self->value = g_strdup(value);
280 return reinterpret_cast<FlValue*>(self);
281 }

References fl_value_new(), FL_VALUE_TYPE_STRING, value, and FlValueString::value.

Referenced by build_editing_delta(), build_editing_state(), build_input_config(), encode_string(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_key_event_channel_send(), fl_platform_channel_make_system_request_app_exit_response(), fl_platform_channel_respond_clipboard_get_data(), fl_platform_channel_system_request_app_exit(), fl_settings_channel_send(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_method_call(), fl_test_application_activate(), fl_test_codec_decode_response(), fl_text_input_channel_perform_action(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), fl_value_lookup_string(), fl_value_new_list_from_strv(), fl_value_set_string(), fl_value_set_string_take(), fl_windowing_channel_make_create_regular_response(), perform_set_text_action(), resize_channel(), send_lifecycle_state(), set_warns_on_channel_overflow(), and TEST().

## ◆ fl_value_new_string_sized()

FlValue* fl_value_new_string_sized | ( | const gchar * | value,
|  | size_t | value_length
| ) |  |

fl_value_new_string_sized: @value: a buffer containing UTF-8 text. It does not require a nul terminator. @value_length: the number of bytes to use from @value.

Creates an FlValue that contains UTF-8 text. The equivalent Dart type is a String.

Returns: a new FlValue.

Definition at line 283 of file fl_value.cc.

284 {
285 FlValueString* self = reinterpret_cast<FlValueString*>(
286 fl_value_new(FL_VALUE_TYPE_STRING, sizeof(FlValueString)));
287 self->value =
288 value_length == 0 ? g_strdup("") : g_strndup(value, value_length);
289 return reinterpret_cast<FlValue*>(self);
290 }

References fl_value_new(), FL_VALUE_TYPE_STRING, value, and FlValueString::value.

Referenced by fl_string_codec_decode_message(), FlValueHandler::Key(), read_string_value(), FlValueHandler::String(), and TEST().

## ◆ fl_value_new_uint8_list()

FlValue* fl_value_new_uint8_list | ( | const uint8_t * | value,
|  | size_t | value_length
| ) |  |

fl_value_new_uint8_list: @value: an array of unsigned 8 bit integers. @value_length: number of elements in @value.

Creates an ordered list containing 8 bit unsigned integers. The data is copied. The equivalent Dart type is a Uint8List.

Returns: a new FlValue.

Definition at line 292 of file fl_value.cc.

293 {
294 FlValueUint8List* self = reinterpret_cast<FlValueUint8List*>(
295 fl_value_new(FL_VALUE_TYPE_UINT8_LIST, sizeof(FlValueUint8List)));
296 self->values_length = 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);
300 }

References fl_value_new(), FL_VALUE_TYPE_UINT8_LIST, self, and FlValueUint8List::values_length.

Referenced by fl_binary_codec_decode_message(), fl_value_new_uint8_list_from_bytes(), read_uint8_list_value(), and TEST().

## ◆ fl_value_new_uint8_list_from_bytes()

FlValue* fl_value_new_uint8_list_from_bytes | ( | GBytes * | value | ) |

fl_value_new_uint8_list_from_bytes: @value: a #GBytes.

Creates an ordered list containing 8 bit unsigned integers. The data is copied. The equivalent Dart type is a Uint8List.

Returns: a new FlValue.

Definition at line 302 of file fl_value.cc.

302 {
303 gsize length;
304 const uint8_t* d =
305 static_cast<const uint8_t*>(g_bytes_get_data(data, &length));
306 return fl_value_new_uint8_list(d, length);
307 }
length
size_t length
Definition: fl_standard_message_codec_test.cc:1115
fl_value_new_uint8_list
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:292

References fl_value_new_uint8_list(), and length.

## ◆ fl_value_ref()

FlValue* fl_value_ref | ( | FlValue * | value | ) |

fl_value_ref: @value: an FlValue.

Increases the reference count of an FlValue.

Returns: the value that was referenced.

Definition at line 394 of file fl_value.cc.

394 {
395 g_return_val_if_fail(self != nullptr, nullptr);
396 self->ref_count++;
397 return self;
398 }

Referenced by FlValueHandler::add(), decode_message(), decode_message_with_codec(), fl_json_message_codec_decode(), fl_json_message_codec_decode_message(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_json_method_codec_encode_success_envelope(), fl_method_call_new(), fl_method_error_response_new(), fl_method_success_response_new(), fl_standard_message_codec_decode_message(), fl_standard_message_codec_read_value_of_type(), fl_standard_method_codec_decode_method_call(), fl_value_append(), fl_value_new_list_from_strv(), fl_value_set(), fl_value_set_string(), FlValueHandler::push(), read_list_value(), and read_map_value().

## ◆ fl_value_set()

void fl_value_set | ( | FlValue * | value,
|  | FlValue * | key,
|  | FlValue * | child_value
| ) |  |

fl_value_set: @value: an FlValue of type FL_VALUE_TYPE_MAP. @key: an FlValue. @child_value: an FlValue.

Sets @key in @value to @child_value. If an existing value was in the map with the same key it is replaced. Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Definition at line 609 of file fl_value.cc.

609 {
610 g_return_if_fail(self != nullptr);
611 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
612 g_return_if_fail(key != nullptr);
613 g_return_if_fail(value != nullptr);
614
615 fl_value_set_take(self, fl_value_ref(key), fl_value_ref(value));
616 }
fl_value_set_take
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:618

References fl_value_ref(), fl_value_set_take(), FL_VALUE_TYPE_MAP, self, and value.

Referenced by read_map_value(), and TEST().

## ◆ fl_value_set_string()

void fl_value_set_string | ( | FlValue * | value,
|  | const gchar * | key,
|  | FlValue * | child_value
| ) |  |

fl_value_set_string: @value: an FlValue of type FL_VALUE_TYPE_MAP. @key: a UTF-8 text key. @child_value: an FlValue.

Sets a value in the map with a text key. If an existing value was in the map with the same key it is replaced. Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Definition at line 639 of file fl_value.cc.

641 {
642 g_return_if_fail(self != nullptr);
643 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
644 g_return_if_fail(key != nullptr);
645 g_return_if_fail(value != nullptr);
646
647 fl_value_set_take(self, fl_value_new_string(key), fl_value_ref(value));
648 }

References fl_value_new_string(), fl_value_ref(), fl_value_set_take(), FL_VALUE_TYPE_MAP, self, and value.

Referenced by fl_text_input_channel_update_editing_state_with_deltas(), fl_windowing_channel_make_create_regular_response(), set_size_arg(), and TEST().

## ◆ fl_value_set_string_take()

void fl_value_set_string_take | ( | FlValue * | value,
|  | const gchar * | key,
|  | FlValue * | child_value
| ) |  |

fl_value_set_string_take: @value: an FlValue of type FL_VALUE_TYPE_MAP. @key: a UTF-8 text key. @child_value: (transfer full): an FlValue.

Sets a value in the map with a text key, taking ownership of the value. If an existing value was in the map with the same key it is replaced. Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Definition at line 650 of file fl_value.cc.

652 {
653 g_return_if_fail(self != nullptr);
654 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
655 g_return_if_fail(key != nullptr);
656 g_return_if_fail(value != nullptr);
657
658 fl_value_set_take(self, fl_value_new_string(key), value);
659 }

References fl_value_new_string(), fl_value_set_take(), FL_VALUE_TYPE_MAP, self, and value.

Referenced by build_map(), fl_key_event_channel_send(), fl_platform_channel_make_system_request_app_exit_response(), fl_platform_channel_respond_clipboard_get_data(), fl_platform_channel_respond_clipboard_has_strings(), fl_platform_channel_system_request_app_exit(), fl_settings_channel_send(), fl_test_application_activate(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_with_deltas(), fl_windowing_channel_make_create_regular_response(), make_destroy_window_args(), make_modify_regular_args(), perform_set_selection_action(), set_key_event_channel(), and TEST().

## ◆ fl_value_set_take()

void fl_value_set_take | ( | FlValue * | value,
|  | FlValue * | key,
|  | FlValue * | child_value
| ) |  |

fl_value_set_take: @value: an FlValue of type FL_VALUE_TYPE_MAP. @key: (transfer full): an FlValue. @child_value: (transfer full): an FlValue.

Sets @key in @value to @child_value. Ownership of both @key and @child_value is taken by @value. If an existing value was in the map with the same key it is replaced. Calling this with an FlValue that is not of type FL_VALUE_TYPE_MAP is a programming error.

Definition at line 618 of file fl_value.cc.

620 {
621 g_return_if_fail(self != nullptr);
622 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
623 g_return_if_fail(key != nullptr);
624 g_return_if_fail(value != nullptr);
625
626 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
627 ssize_t index = fl_value_lookup_index(self, key);
628 if (index < 0) {
629 g_ptr_array_add(v->keys, key);
630 g_ptr_array_add(v->values, value);
631 } else {
632 fl_value_destroy(v->keys->pdata[index]);
633 v->keys->pdata[index] = key;
634 fl_value_destroy(v->values->pdata[index]);
635 v->values->pdata[index] = value;
636 }
637 }

References fl_value_destroy(), fl_value_lookup_index(), FL_VALUE_TYPE_MAP, FlValueMap::keys, self, value, and FlValueMap::values.

Referenced by FlValueHandler::add(), fl_json_method_codec_encode_method_call(), fl_value_set(), fl_value_set_string(), fl_value_set_string_take(), get_keyboard_state(), and TEST().

## ◆ fl_value_to_string()

gchar* fl_value_to_string | ( | FlValue * | value | ) |

fl_value_to_string: @value: an FlValue.

Converts an FlValue to a text representation, suitable for logging purposes. The text is formatted to be the equivalent of Dart toString() methods.

Returns: UTF-8 text.

Definition at line 846 of file fl_value.cc.

846 {
847 GString* buffer = g_string_new("");
848 value_to_string(value, buffer);
849 return g_string_free(buffer, FALSE);
850 }
buffer
static const uint8_t buffer[]
Definition: fl_pixel_buffer_texture_test.cc:44
value_to_string
static void value_to_string(FlValue *value, GString *buffer)
Definition: fl_value.cc:136

References buffer, value, and value_to_string().

Referenced by fl_method_response_get_result(), set_key_event_channel(), and TEST().

## ◆ fl_value_unref()

void fl_value_unref | ( | FlValue * | value | ) |

fl_value_unref: @value: an FlValue.

Decreases the reference count of an FlValue. When the reference count hits zero @value is destroyed and no longer valid.

Definition at line 400 of file fl_value.cc.

400 {
401 g_return_if_fail(self != nullptr);
402 g_return_if_fail(self->ref_count > 0);
403 self->ref_count--;
404 if (self->ref_count != 0) {
405 return;
406 }
407
408 switch (self->type) {
409 case FL_VALUE_TYPE_STRING: {
410 FlValueString* v = reinterpret_cast<FlValueString*>(self);
411 g_free(v->value);
412 break;
413 }
414 case FL_VALUE_TYPE_UINT8_LIST: {
415 FlValueUint8List* v = reinterpret_cast<FlValueUint8List*>(self);
416 g_free(v->values);
417 break;
418 }
419 case FL_VALUE_TYPE_INT32_LIST: {
420 FlValueInt32List* v = reinterpret_cast<FlValueInt32List*>(self);
421 g_free(v->values);
422 break;
423 }
424 case FL_VALUE_TYPE_INT64_LIST: {
425 FlValueInt64List* v = reinterpret_cast<FlValueInt64List*>(self);
426 g_free(v->values);
427 break;
428 }
429 case FL_VALUE_TYPE_FLOAT32_LIST: {
430 FlValueFloat32List* v = reinterpret_cast<FlValueFloat32List*>(self);
431 g_free(v->values);
432 break;
433 }
434 case FL_VALUE_TYPE_FLOAT_LIST: {
435 FlValueFloatList* v = reinterpret_cast<FlValueFloatList*>(self);
436 g_free(v->values);
437 break;
438 }
439 case FL_VALUE_TYPE_LIST: {
440 FlValueList* v = reinterpret_cast<FlValueList*>(self);
441 g_ptr_array_unref(v->values);
442 break;
443 }
444 case FL_VALUE_TYPE_MAP: {
445 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
446 g_ptr_array_unref(v->keys);
447 g_ptr_array_unref(v->values);
448 break;
449 }
450 case FL_VALUE_TYPE_CUSTOM: {
451 FlValueCustom* v = reinterpret_cast<FlValueCustom*>(self);
452 if (v->destroy_notify != nullptr) {
453 v->destroy_notify(const_cast<gpointer>(v->value));
454 }
455 break;
456 }
457 case FL_VALUE_TYPE_NULL:
458 case FL_VALUE_TYPE_BOOL:
459 case FL_VALUE_TYPE_INT:
460 case FL_VALUE_TYPE_FLOAT:
461 break;
462 }
463 g_free(self);
464 }
FlValueCustom::destroy_notify
GDestroyNotify destroy_notify
Definition: fl_value.cc:81

References FlValueCustom::destroy_notify, FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_CUSTOM, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_FLOAT32_LIST, FL_VALUE_TYPE_FLOAT_LIST, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_INT32_LIST, FL_VALUE_TYPE_INT64_LIST, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, FL_VALUE_TYPE_UINT8_LIST, FlValueMap::keys, self, FlValueString::value, FlValueCustom::value, FlValueUint8List::values, FlValueInt32List::values, FlValueInt64List::values, FlValueFloat32List::values, FlValueFloatList::values, FlValueList::values, and FlValueMap::values.

Referenced by fl_method_call_dispose(), fl_method_error_response_dispose(), fl_method_success_response_dispose(), fl_value_destroy(), fl_value_lookup_string(), fl_view_accessible_handle_update_semantics(), FlValueHandler::FlValueHandler(), FlValueHandler::Key(), TEST(), and FlValueHandler::~FlValueHandler().