| Flutter Linux Embedder |

Typedefs | Enumerations | Functions
fl_value.h File Reference
`#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 }

## 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_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)
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>

See #FlMessageCodec to encode and decode these values.

Definition at line 40 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.

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 |

Definition at line 59 of file fl_value.h.

59 {
60 // Parts of the public API, so fixing the names is a breaking change.
61 // NOLINTBEGIN(readability-identifier-naming)
62 FL_VALUE_TYPE_NULL,
63 FL_VALUE_TYPE_BOOL,
64 FL_VALUE_TYPE_INT,
65 FL_VALUE_TYPE_FLOAT,
66 FL_VALUE_TYPE_STRING,
67 FL_VALUE_TYPE_UINT8_LIST,
68 FL_VALUE_TYPE_INT32_LIST,
69 FL_VALUE_TYPE_INT64_LIST,
70 FL_VALUE_TYPE_FLOAT_LIST,
71 FL_VALUE_TYPE_LIST,
72 FL_VALUE_TYPE_MAP,
73 FL_VALUE_TYPE_FLOAT32_LIST,
74 // NOLINTEND(readability-identifier-naming)
75 } FlValueType;

## 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 552 of file fl_value.cc.

552 {
553 g_return_if_fail(self != nullptr);
554 g_return_if_fail(self->type == FL_VALUE_TYPE_LIST);
555 g_return_if_fail(value != nullptr);
556
557 fl_value_append_take(self, fl_value_ref(value));
558 }

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

Referenced by FlValueHandler::add(), cancel_channel(), listen_channel(), read_list_value(), TEST(), update_editing_state(), and update_editing_state_with_delta().

## ◆ 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 560 of file fl_value.cc.

560 {
561 g_return_if_fail(self != nullptr);
562 g_return_if_fail(self->type == FL_VALUE_TYPE_LIST);
563 g_return_if_fail(value != nullptr);
564
565 FlValueList* v = reinterpret_cast<FlValueList*>(self);
566 g_ptr_array_add(v->values, value);
567 }

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

Referenced by build_list(), cancel_channel(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_success_envelope(), fl_value_append(), fl_value_new_list_from_strv(), listen_channel(), perform_action(), resize_channel(), set_warns_on_channel_overflow(), TEST(), update_editing_state(), and update_editing_state_with_delta().

## ◆ 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 433 of file fl_value.cc.

433 {
434 g_return_val_if_fail(a != nullptr, false);
435 g_return_val_if_fail(b != nullptr, false);
436
437 if (a->type != b->type) {
438 return false;
439 }
440
441 switch (a->type) {
442 case FL_VALUE_TYPE_NULL:
443 return true;
444 case FL_VALUE_TYPE_BOOL:
445 return fl_value_get_bool(a) == fl_value_get_bool(b);
446 case FL_VALUE_TYPE_INT:
447 return fl_value_get_int(a) == fl_value_get_int(b);
448 case FL_VALUE_TYPE_FLOAT:
449 return fl_value_get_float(a) == fl_value_get_float(b);
450 case FL_VALUE_TYPE_STRING: {
451 FlValueString* a_ = reinterpret_cast<FlValueString*>(a);
452 FlValueString* b_ = reinterpret_cast<FlValueString*>(b);
453 return g_strcmp0(a_->value, b_->value) == 0;
454 }
455 case FL_VALUE_TYPE_UINT8_LIST: {
456 if (fl_value_get_length(a) != fl_value_get_length(b)) {
457 return false;
458 }
459 const uint8_t* values_a = fl_value_get_uint8_list(a);
460 const uint8_t* values_b = fl_value_get_uint8_list(b);
461 for (size_t i = 0; i < fl_value_get_length(a); i++) {
462 if (values_a[i] != values_b[i]) {
463 return false;
464 }
465 }
466 return true;
467 }
468 case FL_VALUE_TYPE_INT32_LIST: {
469 if (fl_value_get_length(a) != fl_value_get_length(b)) {
470 return false;
471 }
472 const int32_t* values_a = fl_value_get_int32_list(a);
473 const int32_t* values_b = fl_value_get_int32_list(b);
474 for (size_t i = 0; i < fl_value_get_length(a); i++) {
475 if (values_a[i] != values_b[i]) {
476 return false;
477 }
478 }
479 return true;
480 }
481 case FL_VALUE_TYPE_INT64_LIST: {
482 if (fl_value_get_length(a) != fl_value_get_length(b)) {
483 return false;
484 }
485 const int64_t* values_a = fl_value_get_int64_list(a);
486 const int64_t* values_b = fl_value_get_int64_list(b);
487 for (size_t i = 0; i < fl_value_get_length(a); i++) {
488 if (values_a[i] != values_b[i]) {
489 return false;
490 }
491 }
492 return true;
493 }
494 case FL_VALUE_TYPE_FLOAT32_LIST: {
495 if (fl_value_get_length(a) != fl_value_get_length(b)) {
496 return false;
497 }
498 const float* values_a = fl_value_get_float32_list(a);
499 const float* values_b = fl_value_get_float32_list(b);
500 for (size_t i = 0; i < fl_value_get_length(a); i++) {
501 if (values_a[i] != values_b[i]) {
502 return false;
503 }
504 }
505 return true;
506 }
507 case FL_VALUE_TYPE_FLOAT_LIST: {
508 if (fl_value_get_length(a) != fl_value_get_length(b)) {
509 return false;
510 }
511 const double* values_a = fl_value_get_float_list(a);
512 const double* values_b = fl_value_get_float_list(b);
513 for (size_t i = 0; i < fl_value_get_length(a); i++) {
514 if (values_a[i] != values_b[i]) {
515 return false;
516 }
517 }
518 return true;
519 }
520 case FL_VALUE_TYPE_LIST: {
521 if (fl_value_get_length(a) != fl_value_get_length(b)) {
522 return false;
523 }
524 for (size_t i = 0; i < fl_value_get_length(a); i++) {
525 if (!fl_value_equal(fl_value_get_list_value(a, i),
526 fl_value_get_list_value(b, i))) {
527 return false;
528 }
529 }
530 return true;
531 }
532 case FL_VALUE_TYPE_MAP: {
533 if (fl_value_get_length(a) != fl_value_get_length(b)) {
534 return false;
535 }
536 for (size_t i = 0; i < fl_value_get_length(a); i++) {
537 FlValue* key = fl_value_get_map_key(a, i);
538 FlValue* value_b = fl_value_lookup(b, key);
539 if (value_b == nullptr) {
540 return false;
541 }
542 FlValue* value_a = fl_value_get_map_value(a, i);
543 if (!fl_value_equal(value_a, value_b)) {
544 return false;
545 }
546 }
547 return true;
548 }
549 }
550 }

References fl_value_equal(), 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_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, and FlValueString::value.

Referenced by args_cancel_cb(), args_listen_cb(), decode_response_with_error(), decode_response_with_success(), fl_value_equal(), fl_value_lookup_index(), MATCHER_P(), MATCHER_P2(), 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 621 of file fl_value.cc.

621 {
622 g_return_val_if_fail(self != nullptr, FALSE);
623 g_return_val_if_fail(self->type == FL_VALUE_TYPE_BOOL, FALSE);
624 FlValueBool* v = reinterpret_cast<FlValueBool*>(self);
625 return v->value;
626 }

References FL_VALUE_TYPE_BOOL, self, and FlValueBool::value.

Referenced by fl_standard_message_codec_write_value(), fl_value_equal(), G_DEFINE_TYPE(), handle_response(), set_client(), TEST(), and value_to_string().

## ◆ 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 635 of file fl_value.cc.

635 {
636 g_return_val_if_fail(self != nullptr, 0.0);
637 g_return_val_if_fail(self->type == FL_VALUE_TYPE_FLOAT, 0.0);
638 FlValueDouble* v = reinterpret_cast<FlValueDouble*>(self);
639 return v->value;
640 }

References FL_VALUE_TYPE_FLOAT, self, and FlValueDouble::value.

Referenced by fl_standard_message_codec_write_value(), fl_value_equal(), G_DEFINE_TYPE(), 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 670 of file fl_value.cc.

670 {
671 g_return_val_if_fail(self != nullptr, nullptr);
672 g_return_val_if_fail(self->type == FL_VALUE_TYPE_FLOAT32_LIST, nullptr);
673 FlValueFloat32List* v = reinterpret_cast<FlValueFloat32List*>(self);
674 return v->values;
675 }

References FL_VALUE_TYPE_FLOAT32_LIST, self, and FlValueFloat32List::values.

Referenced by fl_standard_message_codec_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 677 of file fl_value.cc.

677 {
678 g_return_val_if_fail(self != nullptr, nullptr);
679 g_return_val_if_fail(self->type == FL_VALUE_TYPE_FLOAT_LIST, nullptr);
680 FlValueFloatList* v = reinterpret_cast<FlValueFloatList*>(self);
681 return v->values;
682 }

References FL_VALUE_TYPE_FLOAT_LIST, self, and FlValueFloatList::values.

Referenced by fl_standard_message_codec_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 628 of file fl_value.cc.

628 {
629 g_return_val_if_fail(self != nullptr, 0);
630 g_return_val_if_fail(self->type == FL_VALUE_TYPE_INT, 0);
631 FlValueInt* v = reinterpret_cast<FlValueInt*>(self);
632 return v->value;
633 }

References FL_VALUE_TYPE_INT, self, and FlValueInt::value.

Referenced by fl_standard_message_codec_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(), send_events_events_cb(), 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 656 of file fl_value.cc.

656 {
657 g_return_val_if_fail(self != nullptr, nullptr);
658 g_return_val_if_fail(self->type == FL_VALUE_TYPE_INT32_LIST, nullptr);
659 FlValueInt32List* v = reinterpret_cast<FlValueInt32List*>(self);
660 return v->values;
661 }

References FL_VALUE_TYPE_INT32_LIST, self, and FlValueInt32List::values.

Referenced by fl_standard_message_codec_write_value(), fl_value_equal(), 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 663 of file fl_value.cc.

663 {
664 g_return_val_if_fail(self != nullptr, nullptr);
665 g_return_val_if_fail(self->type == FL_VALUE_TYPE_INT64_LIST, nullptr);
666 FlValueInt64List* v = reinterpret_cast<FlValueInt64List*>(self);
667 return v->values;
668 }

References FL_VALUE_TYPE_INT64_LIST, self, and FlValueInt64List::values.

Referenced by fl_standard_message_codec_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 684 of file fl_value.cc.

684 {
685 g_return_val_if_fail(self != nullptr, 0);
686 g_return_val_if_fail(self->type == FL_VALUE_TYPE_UINT8_LIST ||
687 self->type == FL_VALUE_TYPE_INT32_LIST ||
688 self->type == FL_VALUE_TYPE_INT64_LIST ||
689 self->type == FL_VALUE_TYPE_FLOAT32_LIST ||
690 self->type == FL_VALUE_TYPE_FLOAT_LIST ||
691 self->type == FL_VALUE_TYPE_LIST ||
692 self->type == FL_VALUE_TYPE_MAP,
693 0);
694
695 switch (self->type) {
696 case FL_VALUE_TYPE_UINT8_LIST: {
697 FlValueUint8List* v = reinterpret_cast<FlValueUint8List*>(self);
698 return v->values_length;
699 }
700 case FL_VALUE_TYPE_INT32_LIST: {
701 FlValueInt32List* v = reinterpret_cast<FlValueInt32List*>(self);
702 return v->values_length;
703 }
704 case FL_VALUE_TYPE_INT64_LIST: {
705 FlValueInt64List* v = reinterpret_cast<FlValueInt64List*>(self);
706 return v->values_length;
707 }
708 case FL_VALUE_TYPE_FLOAT32_LIST: {
709 FlValueFloat32List* v = reinterpret_cast<FlValueFloat32List*>(self);
710 return v->values_length;
711 }
712 case FL_VALUE_TYPE_FLOAT_LIST: {
713 FlValueFloatList* v = reinterpret_cast<FlValueFloatList*>(self);
714 return v->values_length;
715 }
716 case FL_VALUE_TYPE_LIST: {
717 FlValueList* v = reinterpret_cast<FlValueList*>(self);
718 return v->values->len;
719 }
720 case FL_VALUE_TYPE_MAP: {
721 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
722 return v->keys->len;
723 }
724 case FL_VALUE_TYPE_NULL:
725 case FL_VALUE_TYPE_BOOL:
726 case FL_VALUE_TYPE_INT:
727 case FL_VALUE_TYPE_FLOAT:
728 case FL_VALUE_TYPE_STRING:
729 return 0;
730 }
731
732 return 0;
733 }

References FL_VALUE_TYPE_BOOL, 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_write_value(), fl_value_equal(), fl_value_lookup_index(), G_DEFINE_TYPE(), 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 735 of file fl_value.cc.

735 {
736 g_return_val_if_fail(self != nullptr, nullptr);
737 g_return_val_if_fail(self->type == FL_VALUE_TYPE_LIST, nullptr);
738
739 FlValueList* v = reinterpret_cast<FlValueList*>(self);
740 return static_cast<FlValue*>(g_ptr_array_index(v->values, index));
741 }

References FL_VALUE_TYPE_LIST, self, and FlValueList::values.

Referenced by fl_json_method_codec_decode_response(), fl_standard_message_codec_write_value(), fl_value_equal(), G_DEFINE_TYPE(), 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 743 of file fl_value.cc.

743 {
744 g_return_val_if_fail(self != nullptr, nullptr);
745 g_return_val_if_fail(self->type == FL_VALUE_TYPE_MAP, nullptr);
746
747 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
748 return static_cast<FlValue*>(g_ptr_array_index(v->keys, index));
749 }

References FL_VALUE_TYPE_MAP, FlValueMap::keys, and self.

Referenced by fl_standard_message_codec_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 751 of file fl_value.cc.

751 {
752 g_return_val_if_fail(self != nullptr, nullptr);
753 g_return_val_if_fail(self->type == FL_VALUE_TYPE_MAP, nullptr);
754
755 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
756 return static_cast<FlValue*>(g_ptr_array_index(v->values, index));
757 }

References FL_VALUE_TYPE_MAP, self, and FlValueMap::values.

Referenced by fl_standard_message_codec_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 642 of file fl_value.cc.

642 {
643 g_return_val_if_fail(self != nullptr, nullptr);
644 g_return_val_if_fail(self->type == FL_VALUE_TYPE_STRING, nullptr);
645 FlValueString* v = reinterpret_cast<FlValueString*>(self);
646 return v->value;
647 }

References FL_VALUE_TYPE_STRING, self, and FlValueString::value.

Referenced by activate_system_cursor(), clipboard_get_data_async(), clipboard_set_data(), echo_response_cb(), error_response_cb(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_standard_message_codec_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(), message_cb(), method_call_error_cb(), method_call_error_response_cb(), method_call_not_implemented_cb(), method_call_success_cb(), method_call_success_response_cb(), method_response_cb(), response_cb(), 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 428 of file fl_value.cc.

428 {
429 g_return_val_if_fail(self != nullptr, FL_VALUE_TYPE_NULL);
430 return self->type;
431 }

References FL_VALUE_TYPE_NULL.

Referenced by activate_system_cursor(), FlValueHandler::add(), cancel_cancel_cb(), clipboard_get_data_async(), clipboard_set_data(), echo_response_cb(), error_response_cb(), fl_binary_codec_encode_message(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_standard_message_codec_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(), G_DEFINE_TYPE(), get_exit_response(), listen_listen_cb(), message_cb(), method_call_error_cb(), method_call_error_response_cb(), method_call_not_implemented_cb(), method_call_success_cb(), method_call_success_response_cb(), method_response_cb(), null_message_response_cb(), nullptr_args_response_cb(), response_cb(), send_events_events_cb(), 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 649 of file fl_value.cc.

649 {
650 g_return_val_if_fail(self != nullptr, nullptr);
651 g_return_val_if_fail(self->type == FL_VALUE_TYPE_UINT8_LIST, nullptr);
652 FlValueUint8List* v = reinterpret_cast<FlValueUint8List*>(self);
653 return v->values;
654 }

References FL_VALUE_TYPE_UINT8_LIST, self, and FlValueUint8List::values.

Referenced by fl_binary_codec_encode_message(), fl_standard_message_codec_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 759 of file fl_value.cc.

759 {
760 g_return_val_if_fail(self != nullptr, nullptr);
761 g_return_val_if_fail(self->type == FL_VALUE_TYPE_MAP, nullptr);
762
763 ssize_t index = fl_value_lookup_index(self, key);
764 if (index < 0) {
765 return nullptr;
766 }
767 return fl_value_get_map_value(self, index);
768 }

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 770 of file fl_value.cc.

771 {
772 g_return_val_if_fail(self != nullptr, nullptr);
773 FlValue* string_key = fl_value_new_string(key);
774 FlValue* value = fl_value_lookup(self, string_key);
775 // Explicit unref used because the g_autoptr is triggering a false positive
776 // with clang-tidy.
777 fl_value_unref(string_key);
778 return value;
779 }

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

Referenced by activate_system_cursor(), clipboard_set_data(), fl_json_method_codec_decode_method_call(), get_exit_response(), handle_response(), MATCHER_P2(), 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 244 of file fl_value.cc.

244 {
245 FlValueBool* self = reinterpret_cast<FlValueBool*>(
246 fl_value_new(FL_VALUE_TYPE_BOOL, sizeof(FlValueBool)));
247 self->value = value ? true : false;
248 return reinterpret_cast<FlValue*>(self);
249 }

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

Referenced by FlValueHandler::Bool(), build_editing_delta(), build_editing_state(), build_input_config(), clipboard_text_has_strings_cb(), echo_response_cb(), encode_bool(), fl_accessible_text_field_perform_action(), fl_standard_message_codec_read_value(), set_warns_on_channel_overflow(), TEST(), update_editing_state(), update_editing_state_with_delta(), and update_settings().

## ◆ 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 258 of file fl_value.cc.

258 {
259 FlValueDouble* self = reinterpret_cast<FlValueDouble*>(
260 fl_value_new(FL_VALUE_TYPE_FLOAT, sizeof(FlValueDouble)));
261 self->value = value;
262 return reinterpret_cast<FlValue*>(self);
263 }

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

Referenced by FlValueHandler::Double(), encode_float(), read_float64_value(), TEST(), FlValueHandler::Uint64(), and update_settings().

## ◆ 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 318 of file fl_value.cc.

319 {
320 FlValueFloat32List* self = reinterpret_cast<FlValueFloat32List*>(
321 fl_value_new(FL_VALUE_TYPE_FLOAT32_LIST, sizeof(FlValueFloat32List)));
322 self->values_length = data_length;
323 self->values = static_cast<float*>(g_malloc(sizeof(float) * data_length));
324 memcpy(self->values, data, sizeof(float) * data_length);
325 return reinterpret_cast<FlValue*>(self);
326 }

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 328 of file fl_value.cc.

329 {
330 FlValueFloatList* self = reinterpret_cast<FlValueFloatList*>(
331 fl_value_new(FL_VALUE_TYPE_FLOAT_LIST, sizeof(FlValueFloatList)));
332 self->values_length = data_length;
333 self->values = static_cast<double*>(g_malloc(sizeof(double) * data_length));
334 memcpy(self->values, data, sizeof(double) * data_length);
335 return reinterpret_cast<FlValue*>(self);
336 }

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 251 of file fl_value.cc.

251 {
252 FlValueInt* self = reinterpret_cast<FlValueInt*>(
253 fl_value_new(FL_VALUE_TYPE_INT, sizeof(FlValueInt)));
254 self->value = value;
255 return reinterpret_cast<FlValue*>(self);
256 }

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

Referenced by build_editing_delta(), build_editing_state(), build_input_config(), encode_int(), fl_key_channel_responder_handle_event(), fl_test_codec_decode_message(), fl_test_codec_decode_response(), get_keyboard_state(), FlValueHandler::Int(), FlValueHandler::Int64(), method_call_error_error_cb(), method_call_success_error_cb(), perform_action(), perform_set_selection_action(), read_int32_value(), read_int64_value(), resize_channel(), send_events_listen_cb(), TEST(), FlValueHandler::Uint(), FlValueHandler::Uint64(), update_editing_state(), and update_editing_state_with_delta().

## ◆ 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 298 of file fl_value.cc.

299 {
300 FlValueInt32List* self = reinterpret_cast<FlValueInt32List*>(
301 fl_value_new(FL_VALUE_TYPE_INT32_LIST, sizeof(FlValueInt32List)));
302 self->values_length = data_length;
303 self->values = static_cast<int32_t*>(g_malloc(sizeof(int32_t) * data_length));
304 memcpy(self->values, data, sizeof(int32_t) * data_length);
305 return reinterpret_cast<FlValue*>(self);
306 }

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

Referenced by fl_view_accessible_handle_update_semantics_node(), 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 308 of file fl_value.cc.

309 {
310 FlValueInt64List* self = reinterpret_cast<FlValueInt64List*>(
311 fl_value_new(FL_VALUE_TYPE_INT64_LIST, sizeof(FlValueInt64List)));
312 self->values_length = data_length;
313 self->values = static_cast<int64_t*>(g_malloc(sizeof(int64_t) * data_length));
314 memcpy(self->values, data, sizeof(int64_t) * data_length);
315 return reinterpret_cast<FlValue*>(self);
316 }

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_double (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 338 of file fl_value.cc.

338 {
339 FlValueList* self = reinterpret_cast<FlValueList*>(
340 fl_value_new(FL_VALUE_TYPE_LIST, sizeof(FlValueList)));
341 self->values = g_ptr_array_new_with_free_func(fl_value_destroy);
342 return reinterpret_cast<FlValue*>(self);
343 }

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

Referenced by build_list(), cancel_channel(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_success_envelope(), fl_value_new_list_from_strv(), listen_channel(), perform_action(), read_list_value(), resize_channel(), set_warns_on_channel_overflow(), FlValueHandler::StartArray(), TEST(), update_editing_state(), and update_editing_state_with_delta().

## ◆ 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 345 of file fl_value.cc.

346 {
347 g_return_val_if_fail(str_array != nullptr, nullptr);
348 g_autoptr(FlValue) value = fl_value_new_list();
349 for (int i = 0; str_array[i] != nullptr; i++) {
350 fl_value_append_take(value, fl_value_new_string(str_array[i]));
351 }
352 return fl_value_ref(value);
353 }

References fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), fl_value_ref(), 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 355 of file fl_value.cc.

355 {
356 FlValueMap* self = reinterpret_cast<FlValueMap*>(
357 fl_value_new(FL_VALUE_TYPE_MAP, sizeof(FlValueMap)));
358 self->keys = g_ptr_array_new_with_free_func(fl_value_destroy);
359 self->values = g_ptr_array_new_with_free_func(fl_value_destroy);
360 return reinterpret_cast<FlValue*>(self);
361 }

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

Referenced by build_map(), clipboard_text_cb(), clipboard_text_has_strings_cb(), echo_response_cb(), fl_json_method_codec_encode_method_call(), fl_key_channel_responder_handle_event(), fl_test_application_activate(), get_keyboard_state(), perform_set_selection_action(), read_map_value(), request_app_exit(), request_app_exit_response_cb(), FlValueHandler::StartObject(), system_exit_application(), TEST(), update_editing_state(), update_editing_state_with_delta(), and update_settings().

## ◆ 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 240 of file fl_value.cc.

240 {
241 return fl_value_new(FL_VALUE_TYPE_NULL, sizeof(FlValue));
242 }

References fl_value_new(), and FL_VALUE_TYPE_NULL.

Referenced by cancel_channel(), 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(), fl_test_codec_decode_method_call(), listen_channel(), FlValueHandler::Null(), 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 265 of file fl_value.cc.

265 {
266 FlValueString* self = reinterpret_cast<FlValueString*>(
267 fl_value_new(FL_VALUE_TYPE_STRING, sizeof(FlValueString)));
268 self->value = g_strdup(value);
269 return reinterpret_cast<FlValue*>(self);
270 }

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

Referenced by args_cancel_cb(), args_listen_cb(), build_editing_delta(), build_editing_state(), build_input_config(), cancel_channel(), clipboard_text_cb(), encode_string(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_key_channel_responder_handle_event(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_method_call(), fl_test_application_activate(), fl_test_codec_decode_response(), fl_value_lookup_string(), fl_value_new_list_from_strv(), fl_value_set_string(), fl_value_set_string_take(), listen_channel(), message_cb(), method_call_error_cb(), method_call_success_cb(), perform_action(), perform_set_text_action(), reassign_method_cb(), request_app_exit(), request_app_exit_response_cb(), resize_channel(), set_app_lifecycle_state(), set_warns_on_channel_overflow(), system_exit_application(), TEST(), update_editing_state(), update_editing_state_with_delta(), and update_settings().

## ◆ 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 272 of file fl_value.cc.

273 {
274 FlValueString* self = reinterpret_cast<FlValueString*>(
275 fl_value_new(FL_VALUE_TYPE_STRING, sizeof(FlValueString)));
276 self->value =
277 value_length == 0 ? g_strdup("") : g_strndup(value, value_length);
278 return reinterpret_cast<FlValue*>(self);
279 }

References fl_value_new(), FL_VALUE_TYPE_STRING, FlValueString::value, and 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 281 of file fl_value.cc.

282 {
283 FlValueUint8List* self = reinterpret_cast<FlValueUint8List*>(
284 fl_value_new(FL_VALUE_TYPE_UINT8_LIST, sizeof(FlValueUint8List)));
285 self->values_length = data_length;
286 self->values = static_cast<uint8_t*>(g_malloc(sizeof(uint8_t) * data_length));
287 memcpy(self->values, data, sizeof(uint8_t) * data_length);
288 return reinterpret_cast<FlValue*>(self);
289 }

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 291 of file fl_value.cc.

291 {
292 gsize length;
293 const uint8_t* d =
294 static_cast<const uint8_t*>(g_bytes_get_data(data, &length));
295 return fl_value_new_uint8_list(d, length);
296 }

References fl_value_new_uint8_list().

## ◆ 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 363 of file fl_value.cc.

363 {
364 g_return_val_if_fail(self != nullptr, nullptr);
365 self->ref_count++;
366 return self;
367 }

Referenced by FlValueHandler::add(), cancel_channel(), decode_message(), 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(), fl_standard_method_codec_decode_method_call(), fl_value_append(), fl_value_new_list_from_strv(), fl_value_set(), fl_value_set_string(), listen_channel(), 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 569 of file fl_value.cc.

569 {
570 g_return_if_fail(self != nullptr);
571 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
572 g_return_if_fail(key != nullptr);
573 g_return_if_fail(value != nullptr);
574
575 fl_value_set_take(self, fl_value_ref(key), fl_value_ref(value));
576 }

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 599 of file fl_value.cc.

601 {
602 g_return_if_fail(self != nullptr);
603 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
604 g_return_if_fail(key != nullptr);
605 g_return_if_fail(value != nullptr);
606
607 fl_value_set_take(self, fl_value_new_string(key), fl_value_ref(value));
608 }

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

Referenced by TEST(), and update_editing_state_with_delta().

## ◆ 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 610 of file fl_value.cc.

612 {
613 g_return_if_fail(self != nullptr);
614 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
615 g_return_if_fail(key != nullptr);
616 g_return_if_fail(value != nullptr);
617
618 fl_value_set_take(self, fl_value_new_string(key), value);
619 }

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

Referenced by build_map(), clipboard_text_cb(), clipboard_text_has_strings_cb(), echo_response_cb(), fl_key_channel_responder_handle_event(), fl_test_application_activate(), perform_set_selection_action(), request_app_exit(), request_app_exit_response_cb(), system_exit_application(), TEST(), update_editing_state(), update_editing_state_with_delta(), and update_settings().

## ◆ 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 578 of file fl_value.cc.

580 {
581 g_return_if_fail(self != nullptr);
582 g_return_if_fail(self->type == FL_VALUE_TYPE_MAP);
583 g_return_if_fail(key != nullptr);
584 g_return_if_fail(value != nullptr);
585
586 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
587 ssize_t index = fl_value_lookup_index(self, key);
588 if (index < 0) {
589 g_ptr_array_add(v->keys, key);
590 g_ptr_array_add(v->values, value);
591 } else {
592 fl_value_destroy(v->keys->pdata[index]);
593 v->keys->pdata[index] = key;
594 fl_value_destroy(v->values->pdata[index]);
595 v->values->pdata[index] = value;
596 }
597 }

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 781 of file fl_value.cc.

781 {
782 GString* buffer = g_string_new("");
783 value_to_string(value, buffer);
784 return g_string_free(buffer, FALSE);
785 }

References buffer, value, and value_to_string().

Referenced by echo_response_cb(), fl_method_response_get_result(), 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 369 of file fl_value.cc.

369 {
370 g_return_if_fail(self != nullptr);
371 g_return_if_fail(self->ref_count > 0);
372 self->ref_count--;
373 if (self->ref_count != 0) {
374 return;
375 }
376
377 switch (self->type) {
378 case FL_VALUE_TYPE_STRING: {
379 FlValueString* v = reinterpret_cast<FlValueString*>(self);
380 g_free(v->value);
381 break;
382 }
383 case FL_VALUE_TYPE_UINT8_LIST: {
384 FlValueUint8List* v = reinterpret_cast<FlValueUint8List*>(self);
385 g_free(v->values);
386 break;
387 }
388 case FL_VALUE_TYPE_INT32_LIST: {
389 FlValueInt32List* v = reinterpret_cast<FlValueInt32List*>(self);
390 g_free(v->values);
391 break;
392 }
393 case FL_VALUE_TYPE_INT64_LIST: {
394 FlValueInt64List* v = reinterpret_cast<FlValueInt64List*>(self);
395 g_free(v->values);
396 break;
397 }
398 case FL_VALUE_TYPE_FLOAT32_LIST: {
399 FlValueFloat32List* v = reinterpret_cast<FlValueFloat32List*>(self);
400 g_free(v->values);
401 break;
402 }
403 case FL_VALUE_TYPE_FLOAT_LIST: {
404 FlValueFloatList* v = reinterpret_cast<FlValueFloatList*>(self);
405 g_free(v->values);
406 break;
407 }
408 case FL_VALUE_TYPE_LIST: {
409 FlValueList* v = reinterpret_cast<FlValueList*>(self);
410 g_ptr_array_unref(v->values);
411 break;
412 }
413 case FL_VALUE_TYPE_MAP: {
414 FlValueMap* v = reinterpret_cast<FlValueMap*>(self);
415 g_ptr_array_unref(v->keys);
416 g_ptr_array_unref(v->values);
417 break;
418 }
419 case FL_VALUE_TYPE_NULL:
420 case FL_VALUE_TYPE_BOOL:
421 case FL_VALUE_TYPE_INT:
422 case FL_VALUE_TYPE_FLOAT:
423 break;
424 }
425 g_free(self);
426 }

References FL_VALUE_TYPE_BOOL, 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, 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_init(), FlValueHandler::FlValueHandler(), FlValueHandler::Key(), TEST(), and FlValueHandler::~FlValueHandler().

FlValueFloatList::values_length
size_t values_length
Definition: fl_value.cc:63
fl_value_get_int32_list
const G_MODULE_EXPORT int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:656
FL_VALUE_TYPE_UINT8_LIST
@ FL_VALUE_TYPE_UINT8_LIST
Definition: fl_value.h:67
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:72
fl_value_new
static FlValue * fl_value_new(FlValueType type, size_t size)
Definition: fl_value.cc:77
FlValueInt::value
int64_t value
Definition: fl_value.cc:23
fl_value_destroy
static void fl_value_destroy(gpointer value)
Definition: fl_value.cc:85
FlValueUint8List::values
uint8_t * values
Definition: fl_value.cc:38
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
FlValueFloat32List::values_length
size_t values_length
Definition: fl_value.cc:57
FlValueList
Definition: fl_value.cc:66
fl_value_get_float_list
const G_MODULE_EXPORT double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:677
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
fl_value_set_take
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:578
FlValueInt
Definition: fl_value.cc:21
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:71
FlValueType
FlValueType
Definition: fl_value.h:59
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:621
fl_value_get_uint8_list
const G_MODULE_EXPORT uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:649
FlValueFloatList
Definition: fl_value.cc:60
fl_value_get_float32_list
const G_MODULE_EXPORT float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:670
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:62
value_to_string
static void value_to_string(FlValue *value, GString *buffer)
Definition: fl_value.cc:129
FlValueBool
Definition: fl_value.cc:16
FlValueInt32List
Definition: fl_value.cc:42
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
fl_value_unref
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
Definition: fl_value.cc:369
FlValueMap
Definition: fl_value.cc:71
FlValueFloat32List::values
float * values
Definition: fl_value.cc:56
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
FlValueInt32List::values
int32_t * values
Definition: fl_value.cc:44
FlValueFloatList::values
double * values
Definition: fl_value.cc:62
FlValueString::value
gchar * value
Definition: fl_value.cc:33
FlValueInt64List::values
int64_t * values
Definition: fl_value.cc:50
fl_value_get_list_value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:735
FL_VALUE_TYPE_FLOAT32_LIST
@ FL_VALUE_TYPE_FLOAT32_LIST
Definition: fl_value.h:73
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:66
FlValueBool::value
bool value
Definition: fl_value.cc:18
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:560
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
FL_VALUE_TYPE_INT64_LIST
@ FL_VALUE_TYPE_INT64_LIST
Definition: fl_value.h:69
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:433
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:64
FlValueList::values
GPtrArray * values
Definition: fl_value.cc:68
self
GdkEvent FlView * self
Definition: fl_view.cc:100
FlValueMap::values
GPtrArray * values
Definition: fl_value.cc:74
FlValueInt32List::values_length
size_t values_length
Definition: fl_value.cc:45
FlValueString
Definition: fl_value.cc:31
FlValueMap::keys
GPtrArray * keys
Definition: fl_value.cc:73
FlValueDouble::value
double value
Definition: fl_value.cc:28
FL_VALUE_TYPE_FLOAT_LIST
@ FL_VALUE_TYPE_FLOAT_LIST
Definition: fl_value.h:70
FlValueInt64List
Definition: fl_value.cc:48
FlValueFloat32List
Definition: fl_value.cc:54
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:281
buffer
static const uint8_t buffer[]
Definition: fl_pixel_buffer_texture_test.cc:44
FL_VALUE_TYPE_FLOAT
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:65
FlValueDouble
Definition: fl_value.cc:26
FL_VALUE_TYPE_INT32_LIST
@ FL_VALUE_TYPE_INT32_LIST
Definition: fl_value.h:68
FlValueInt64List::values_length
size_t values_length
Definition: fl_value.cc:51
FlValueUint8List::values_length
size_t values_length
Definition: fl_value.cc:39
fl_value_lookup_index
static ssize_t fl_value_lookup_index(FlValue *self, FlValue *key)
Definition: fl_value.cc:92
FlValueUint8List
Definition: fl_value.cc:36
fl_value_lookup
G_MODULE_EXPORT FlValue * fl_value_lookup(FlValue *self, FlValue *key)
Definition: fl_value.cc:759
fl_value_get_map_key
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:743
fl_value_get_int64_list
const G_MODULE_EXPORT int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:663
FL_VALUE_TYPE_BOOL
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:63
value
uint8_t value
Definition: fl_standard_message_codec.cc:41
fl_value_get_map_value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:751
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265