| Flutter Linux Embedder |

fl_value.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_VALUE_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_VALUE_H_
7
8 #include <glib-object.h>
9 #include <glib.h>
10 #include <stdbool.h>
11 #include <stdint.h>
12
13 #if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
14 #error "Only <flutter_linux/flutter_linux.h> can be included directly."
15 #endif
16
17 G_BEGIN_DECLS
18
19 /**
20 * FlValue:
21 *
22 * #FlValue is an object that contains the data types used in the platform
23 * channel used by Flutter.
24 *
25 * In Dart the values are represented as follows:
26 * - #FL_VALUE_TYPE_NULL: Null
27 * - #FL_VALUE_TYPE_BOOL: bool
28 * - #FL_VALUE_TYPE_INT: num
29 * - #FL_VALUE_TYPE_FLOAT: num
30 * - #FL_VALUE_TYPE_STRING: String
31 * - #FL_VALUE_TYPE_UINT8_LIST: Uint8List
32 * - #FL_VALUE_TYPE_INT32_LIST: Int32List
33 * - #FL_VALUE_TYPE_INT64_LIST: Int64List
34 * - #FL_VALUE_TYPE_FLOAT32_LIST: Float32List
35 * - #FL_VALUE_TYPE_FLOAT_LIST: Float64List
36 * - #FL_VALUE_TYPE_LIST: List<dynamic>
37 * - #FL_VALUE_TYPE_MAP: Map<dynamic>
38 * - #FL_VALUE_TYPE_CUSTOM: (custom type)
39 *
40 * See #FlMessageCodec to encode and decode these values.
41 */
42 typedef struct _FlValue FlValue;
43
44 /**
45 * FlValueType:
46 * @FL_VALUE_TYPE_NULL: The null value.
47 * @FL_VALUE_TYPE_BOOL: A boolean.
48 * @FL_VALUE_TYPE_INT: A 64 bit signed integer.
49 * @FL_VALUE_TYPE_FLOAT: A 64 bit floating point number.
50 * @FL_VALUE_TYPE_STRING: UTF-8 text.
51 * @FL_VALUE_TYPE_UINT8_LIST: An ordered list of unsigned 8 bit integers.
52 * @FL_VALUE_TYPE_INT32_LIST: An ordered list of 32 bit integers.
53 * @FL_VALUE_TYPE_INT64_LIST: An ordered list of 64 bit integers.
54 * @FL_VALUE_TYPE_FLOAT_LIST: An ordered list of floating point numbers.
55 * @FL_VALUE_TYPE_LIST: An ordered list of #FlValue objects.
56 * @FL_VALUE_TYPE_MAP: A map of #FlValue objects keyed by #FlValue object.
57 * @FL_VALUE_TYPE_FLOAT32_LIST: An ordered list of 32bit floating point numbers.
58 * @FL_VALUE_TYPE_CUSTOM: A custom value.
59 *
60 * Types of #FlValue.
61 */
62 typedef enum {
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;
78
79 /**
80 * fl_value_new_null:
81 *
82 * Creates an #FlValue that contains a null value. The equivalent Dart type is
83 * null.
84 *
85 * Returns: a new #FlValue.
86 */
87 FlValue* fl_value_new_null();
88
89 /**
90 * fl_value_new_bool:
91 * @value: the value.
92 *
93 * Creates an #FlValue that contains a boolean value. The equivalent Dart type
94 * is a bool.
95 *
96 * Returns: a new #FlValue.
97 */
98 FlValue* fl_value_new_bool(bool value);
99
100 /**
101 * fl_value_new_int:
102 * @value: the value.
103 *
104 * Creates an #FlValue that contains an integer number. The equivalent Dart type
105 * is a num.
106 *
107 * Returns: a new #FlValue.
108 */
109 FlValue* fl_value_new_int(int64_t value);
110
111 /**
112 * fl_value_new_float:
113 * @value: the value.
114 *
115 * Creates an #FlValue that contains a floating point number. The equivalent
116 * Dart type is a num.
117 *
118 * Returns: a new #FlValue.
119 */
120 FlValue* fl_value_new_float(double value);
121
122 /**
123 * fl_value_new_string:
124 * @value: a %NULL-terminated UTF-8 string.
125 *
126 * Creates an #FlValue that contains UTF-8 text. The equivalent Dart type is a
127 * String.
128 *
129 * Returns: a new #FlValue.
130 */
131 FlValue* fl_value_new_string(const gchar* value);
132
133 /**
134 * fl_value_new_string_sized:
135 * @value: a buffer containing UTF-8 text. It does not require a nul terminator.
136 * @value_length: the number of bytes to use from @value.
137 *
138 * Creates an #FlValue that contains UTF-8 text. The equivalent Dart type is a
139 * String.
140 *
141 * Returns: a new #FlValue.
142 */
143 FlValue* fl_value_new_string_sized(const gchar* value, size_t value_length);
144
145 /**
146 * fl_value_new_uint8_list:
147 * @value: an array of unsigned 8 bit integers.
148 * @value_length: number of elements in @value.
149 *
150 * Creates an ordered list containing 8 bit unsigned integers. The data is
151 * copied. The equivalent Dart type is a Uint8List.
152 *
153 * Returns: a new #FlValue.
154 */
155 FlValue* fl_value_new_uint8_list(const uint8_t* value, size_t value_length);
156
157 /**
158 * fl_value_new_uint8_list_from_bytes:
159 * @value: a #GBytes.
160 *
161 * Creates an ordered list containing 8 bit unsigned integers. The data is
162 * copied. The equivalent Dart type is a Uint8List.
163 *
164 * Returns: a new #FlValue.
165 */
166 FlValue* fl_value_new_uint8_list_from_bytes(GBytes* value);
167
168 /**
169 * fl_value_new_int32_list:
170 * @value: an array of signed 32 bit integers.
171 * @value_length: number of elements in @value.
172 *
173 * Creates an ordered list containing 32 bit integers. The equivalent Dart type
174 * is a Int32List.
175 *
176 * Returns: a new #FlValue.
177 */
178 FlValue* fl_value_new_int32_list(const int32_t* value, size_t value_length);
179
180 /**
181 * fl_value_new_int64_list:
182 * @value: an array of signed 64 bit integers.
183 * @value_length: number of elements in @value.
184 *
185 * Creates an ordered list containing 64 bit integers. The equivalent Dart type
186 * is a Int64List.
187 *
188 * Returns: a new #FlValue.
189 */
190 FlValue* fl_value_new_int64_list(const int64_t* value, size_t value_length);
191
192 /**
193 * fl_value_new_float32_list:
194 * @value: an array of floating point numbers.
195 * @value_length: number of elements in @value.
196 *
197 * Creates an ordered list containing 32 bit floating point numbers.
198 * The equivalent Dart type is a Float32List.
199 *
200 * Returns: a new #FlValue.
201 */
202 FlValue* fl_value_new_float32_list(const float* value, size_t value_length);
203
204 /**
205 * fl_value_new_float_list:
206 * @value: an array of floating point numbers.
207 * @value_length: number of elements in @value.
208 *
209 * Creates an ordered list containing floating point numbers. The equivalent
210 * Dart type is a Float64List.
211 *
212 * Returns: a new #FlValue.
213 */
214 FlValue* fl_value_new_float_list(const double* value, size_t value_length);
215
216 /**
217 * fl_value_new_list:
218 *
219 * Creates an ordered list. Children can be added to the list using
220 * fl_value_append(). The children are accessed using fl_value_get_length()
221 * and fl_value_get_list_value(). The equivalent Dart type is a List<dynamic>.
222 *
223 * The following example shows a simple list of values:
224 *
225 * |[<!-- language="C" -->
226 * g_autoptr(FlValue) value = fl_value_new_list ();
227 * fl_value_append_take (value, fl_value_new_string ("one");
228 * fl_value_append_take (value, fl_value_new_int (2);
229 * fl_value_append_take (value, fl_value_new_float (3.0);
230 * ]|
231 *
232 * This value can be decoded using:
233 *
234 * |[<!-- language="C" -->
235 * g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_LIST);
236 * for (size_t i = 0; i < fl_value_get_length (value); i++) {
237 * FlValue *child = fl_value_get_list_value (value, i);
238 * process_value (child);
239 * }
240 * ]|
241 *
242 * Returns: a new #FlValue.
243 */
244 FlValue* fl_value_new_list();
245
246 /**
247 * fl_value_new_list_from_strv:
248 * @value: a %NULL-terminated array of strings.
249 *
250 * Creates an ordered list containing #FlString values.
251 *
252 * Returns: a new #FlValue.
253 */
254 FlValue* fl_value_new_list_from_strv(const gchar* const* value);
255
256 /**
257 * fl_value_new_map:
258 *
259 * Creates an ordered associative array. Children can be added to the map
260 * using fl_value_set(), fl_value_set_take(), fl_value_set_string(),
261 * fl_value_set_string_take(). The children are accessed using
262 * fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(),
263 * fl_value_lookup() and fl_value_lookup_string(). The equivalent Dart type is a
264 * Map<dynamic>.
265 *
266 * The following example shows how to create a map of values keyed by strings:
267 *
268 * |[<!-- language="C" -->
269 * g_autoptr(FlValue) value = fl_value_new_map ();
270 * fl_value_set_string_take (value, "name", fl_value_new_string ("Gandalf"));
271 * fl_value_set_string_take (value, "occupation",
272 * fl_value_new_string ("Wizard"));
273 * fl_value_set_string_take (value, "age", fl_value_new_int (2019));
274 * ]|
275 *
276 * This value can be decoded using:
277 * |[<!-- language="C" -->
278 * g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_MAP);
279 * FlValue *name = fl_value_lookup_string (value, "name");
280 * g_assert (fl_value_get_type (name) == FL_VALUE_TYPE_STRING);
281 * FlValue *age = fl_value_lookup_string (value, "age");
282 * g_assert (fl_value_get_type (age) == FL_VALUE_TYPE_INT);
283 * g_message ("Next customer is %s (%d years old)",
284 * fl_value_get_string (name),
285 * fl_value_get_int (age));
286 * ]|
287 *
288 * Returns: a new #FlValue.
289 */
290 FlValue* fl_value_new_map();
291
292 /**
293 * fl_value_new_custom:
294 * @type: an ID for this type.
295 * @value: pointer to the custom value.
296 * @destroy_notify: function to call when @value is no longer required.
297 *
298 * Creates a new custom data type. The Dart side of the channel must have
299 * equivalent custom code to access this object.
300 *
301 * Returns: a new #FlValue.
302 */
303 FlValue* fl_value_new_custom(int type,
304 gconstpointer value,
305 GDestroyNotify destroy_notify);
306
307 /**
308 * fl_value_new_custom_object:
309 * @type: an ID for this type.
310 * @object: the custom object.
311 *
312 * Creates a new custom data type. The Dart side of the channel must have
313 * equivalent custom code to access this object.
314 *
315 * Returns: a new #FlValue.
316 */
317 FlValue* fl_value_new_custom_object(int type, GObject* object);
318
319 /**
320 * fl_value_new_custom_object_take:
321 * @type: an ID for this type.
322 * @object: (transfer full): the custom object.
323 *
324 * Creates a new custom data type. The Dart side of the channel must have
325 * equivalent custom code to access this object. Ownership of @object is taken.
326 *
327 * Returns: a new #FlValue.
328 */
329 FlValue* fl_value_new_custom_object_take(int type, GObject* object);
330
331 /**
332 * fl_value_ref:
333 * @value: an #FlValue.
334 *
335 * Increases the reference count of an #FlValue.
336 *
337 * Returns: the value that was referenced.
338 */
339 FlValue* fl_value_ref(FlValue* value);
340
341 /**
342 * fl_value_unref:
343 * @value: an #FlValue.
344 *
345 * Decreases the reference count of an #FlValue. When the reference count hits
346 * zero @value is destroyed and no longer valid.
347 */
348 void fl_value_unref(FlValue* value);
349
350 /**
351 * fl_value_get_type:
352 * @value: an #FlValue.
353 *
354 * Gets the type of @value.
355 *
356 * Returns: an #FlValueType.
357 */
358 FlValueType fl_value_get_type(FlValue* value);
359
360 /**
361 * fl_value_equal:
362 * @a: an #FlValue.
363 * @b: an #FlValue.
364 *
365 * Compares two #FlValue to see if they are equivalent. Two values are
366 * considered equivalent if they are of the same type and their data is the same
367 * including any child values. For values of type #FL_VALUE_TYPE_MAP the order
368 * of the values does not matter.
369 *
370 * Returns: %TRUE if both values are equivalent.
371 */
372 bool fl_value_equal(FlValue* a, FlValue* b);
373
374 /**
375 * fl_value_append:
376 * @value: an #FlValue of type #FL_VALUE_TYPE_LIST.
377 * @child: an #FlValue.
378 *
379 * Adds @child to the end of @value. Calling this with an #FlValue that is not
380 * of type #FL_VALUE_TYPE_LIST is a programming error.
381 */
382 void fl_value_append(FlValue* value, FlValue* child);
383
384 /**
385 * fl_value_append_take:
386 * @value: an #FlValue of type #FL_VALUE_TYPE_LIST.
387 * @child: (transfer full): an #FlValue.
388 *
389 * Adds @child to the end of @value. Ownership of @child is taken by @value.
390 * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_LIST is a
391 * programming error.
392 */
393 void fl_value_append_take(FlValue* value, FlValue* child);
394
395 /**
396 * fl_value_set:
397 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
398 * @key: an #FlValue.
399 * @child_value: an #FlValue.
400 *
401 * Sets @key in @value to @child_value. If an existing value was in the map with
402 * the same key it is replaced. Calling this with an #FlValue that is not of
403 * type #FL_VALUE_TYPE_MAP is a programming error.
404 */
405 void fl_value_set(FlValue* value, FlValue* key, FlValue* child_value);
406
407 /**
408 * fl_value_set_take:
409 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
410 * @key: (transfer full): an #FlValue.
411 * @child_value: (transfer full): an #FlValue.
412 *
413 * Sets @key in @value to @child_value. Ownership of both @key and @child_value
414 * is taken by @value. If an existing value was in the map with the same key it
415 * is replaced. Calling this with an #FlValue that is not of type
416 * #FL_VALUE_TYPE_MAP is a programming error.
417 */
418 void fl_value_set_take(FlValue* value, FlValue* key, FlValue* child_value);
419
420 /**
421 * fl_value_set_string:
422 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
423 * @key: a UTF-8 text key.
424 * @child_value: an #FlValue.
425 *
426 * Sets a value in the map with a text key. If an existing value was in the map
427 * with the same key it is replaced. Calling this with an #FlValue that is not
428 * of type #FL_VALUE_TYPE_MAP is a programming error.
429 */
430 void fl_value_set_string(FlValue* value,
431 const gchar* key,
432 FlValue* child_value);
433
434 /**
435 * fl_value_set_string_take:
436 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
437 * @key: a UTF-8 text key.
438 * @child_value: (transfer full): an #FlValue.
439 *
440 * Sets a value in the map with a text key, taking ownership of the value. If an
441 * existing value was in the map with the same key it is replaced. Calling this
442 * with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a programming
443 * error.
444 */
445 void fl_value_set_string_take(FlValue* value,
446 const gchar* key,
447 FlValue* child_value);
448
449 /**
450 * fl_value_get_bool:
451 * @value: an #FlValue of type #FL_VALUE_TYPE_BOOL.
452 *
453 * Gets the boolean value of @value. Calling this with an #FlValue that is
454 * not of type #FL_VALUE_TYPE_BOOL is a programming error.
455 *
456 * Returns: a boolean value.
457 */
458 bool fl_value_get_bool(FlValue* value);
459
460 /**
461 * fl_value_get_int:
462 * @value: an #FlValue of type #FL_VALUE_TYPE_INT.
463 *
464 * Gets the integer number of @value. Calling this with an #FlValue that is
465 * not of type #FL_VALUE_TYPE_INT is a programming error.
466 *
467 * Returns: an integer number.
468 */
469 int64_t fl_value_get_int(FlValue* value);
470
471 /**
472 * fl_value_get_float:
473 * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT.
474 *
475 * Gets the floating point number of @value. Calling this with an #FlValue
476 * that is not of type #FL_VALUE_TYPE_FLOAT is a programming error.
477 *
478 * Returns: a floating point number.
479 */
480 double fl_value_get_float(FlValue* value);
481
482 /**
483 * fl_value_get_string:
484 * @value: an #FlValue of type #FL_VALUE_TYPE_STRING.
485 *
486 * Gets the UTF-8 text contained in @value. Calling this with an #FlValue
487 * that is not of type #FL_VALUE_TYPE_STRING is a programming error.
488 *
489 * Returns: a UTF-8 encoded string.
490 */
491 const gchar* fl_value_get_string(FlValue* value);
492
493 /**
494 * fl_value_get_length:
495 * @value: an #FlValue of type #FL_VALUE_TYPE_UINT8_LIST,
496 * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST,
497 * #FL_VALUE_TYPE_FLOAT32_LIST, #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST
498 * or #FL_VALUE_TYPE_MAP.
499 *
500 * Gets the number of elements @value contains. This is only valid for list
501 * and map types. Calling this with other types is a programming error.
502 *
503 * Returns: the number of elements inside @value.
504 */
505 size_t fl_value_get_length(FlValue* value);
506
507 /**
508 * fl_value_get_uint8_list:
509 * @value: an #FlValue of type #FL_VALUE_TYPE_UINT8_LIST.
510 *
511 * Gets the array of unisigned 8 bit integers @value contains. The data
512 * contains fl_value_get_length() elements. Calling this with an #FlValue that
513 * is not of type #FL_VALUE_TYPE_UINT8_LIST is a programming error.
514 *
515 * Returns: an array of unsigned 8 bit integers.
516 */
517 const uint8_t* fl_value_get_uint8_list(FlValue* value);
518
519 /**
520 * fl_value_get_int32_list:
521 * @value: an #FlValue of type #FL_VALUE_TYPE_INT32_LIST.
522 *
523 * Gets the array of 32 bit integers @value contains. The data contains
524 * fl_value_get_length() elements. Calling this with an #FlValue that is not of
525 * type #FL_VALUE_TYPE_INT32_LIST is a programming error.
526 *
527 * Returns: an array of 32 bit integers.
528 */
529 const int32_t* fl_value_get_int32_list(FlValue* value);
530
531 /**
532 * fl_value_get_int64_list:
533 * @value: an #FlValue of type #FL_VALUE_TYPE_INT64_LIST.
534 *
535 * Gets the array of 64 bit integers @value contains. The data contains
536 * fl_value_get_length() elements. Calling this with an #FlValue that is not of
537 * type #FL_VALUE_TYPE_INT64_LIST is a programming error.
538 *
539 * Returns: an array of 64 bit integers.
540 */
541 const int64_t* fl_value_get_int64_list(FlValue* value);
542
543 /**
544 * fl_value_get_float32_list:
545 * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT32_LIST.
546 *
547 * Gets the array of floating point numbers @value contains. The data
548 * contains fl_value_get_length() elements. Calling this with an #FlValue that
549 * is not of type #FL_VALUE_TYPE_FLOAT32_LIST is a programming error.
550 *
551 * Returns: an array of floating point numbers.
552 */
553 const float* fl_value_get_float32_list(FlValue* value);
554
555 /**
556 * fl_value_get_float_list:
557 * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT_LIST.
558 *
559 * Gets the array of floating point numbers @value contains. The data
560 * contains fl_value_get_length() elements. Calling this with an #FlValue that
561 * is not of type #FL_VALUE_TYPE_FLOAT_LIST is a programming error.
562 *
563 * Returns: an array of floating point numbers.
564 */
565 const double* fl_value_get_float_list(FlValue* value);
566
567 /**
568 * fl_value_get_list_value:
569 * @value: an #FlValue of type #FL_VALUE_TYPE_LIST.
570 * @index: an index in the list.
571 *
572 * Gets a child element of the list. It is a programming error to request an
573 * index that is outside the size of the list as returned from
574 * fl_value_get_length(). Calling this with an #FlValue that is not of type
575 * #FL_VALUE_TYPE_LIST is a programming error.
576 *
577 * Returns: an #FlValue.
578 */
579 FlValue* fl_value_get_list_value(FlValue* value, size_t index);
580
581 /**
582 * fl_value_get_map_key:
583 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
584 * @index: an index in the map.
585 *
586 * Gets a key from the map. It is a programming error to request an index that
587 * is outside the size of the list as returned from fl_value_get_length().
588 * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a
589 * programming error.
590 *
591 * Returns: an #FlValue.
592 */
593 FlValue* fl_value_get_map_key(FlValue* value, size_t index);
594
595 /**
596 * fl_value_get_map_value:
597 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
598 * @index: an index in the map.
599 *
600 * Gets a value from the map. It is a programming error to request an index that
601 * is outside the size of the list as returned from fl_value_get_length().
602 * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a
603 * programming error.
604 *
605 * Returns: an #FlValue.
606 */
607 FlValue* fl_value_get_map_value(FlValue* value, size_t index);
608
609 /**
610 * fl_value_lookup:
611 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
612 * @key: a key value.
613 *
614 * Gets the map entry that matches @key. Keys are checked using
615 * fl_value_equal(). Calling this with an #FlValue that is not of type
616 * #FL_VALUE_TYPE_MAP is a programming error.
617 *
618 * Map lookups are not optimized for performance - if you have a large map or
619 * need frequent access you should copy the data into another structure, e.g.
620 * #GHashTable.
621 *
622 * Returns: (allow-none): the value with this key or %NULL if not one present.
623 */
624 FlValue* fl_value_lookup(FlValue* value, FlValue* key);
625
626 /**
627 * fl_value_lookup_string:
628 * @value: an #FlValue of type #FL_VALUE_TYPE_MAP.
629 * @key: a key value.
630 *
631 * Gets the map entry that matches @key. Keys are checked using
632 * fl_value_equal(). Calling this with an #FlValue that is not of type
633 * #FL_VALUE_TYPE_MAP is a programming error.
634 *
635 * Map lookups are not optimized for performance - if you have a large map or
636 * need frequent access you should copy the data into another structure, e.g.
637 * #GHashTable.
638 *
639 * Returns: (allow-none): the value with this key or %NULL if not one present.
640 */
641 FlValue* fl_value_lookup_string(FlValue* value, const gchar* key);
642
643 /**
644 * fl_value_get_custom_type:
645 * @value: an #FlValue of type #FL_VALUE_TYPE_CUSTOM.
646 *
647 * Gets the type ID for this custom type.
648 *
649 * Returns: a type ID.
650 */
651 int fl_value_get_custom_type(FlValue* value);
652
653 /**
654 * fl_value_get_custom_value:
655 * @value: an #FlValue of type #FL_VALUE_TYPE_CUSTOM.
656 *
657 * Gets the address of the custom value.
658 *
659 * Returns: a pointer to the custom value.
660 */
661 gconstpointer fl_value_get_custom_value(FlValue* value);
662
663 /**
664 * fl_value_get_custom_value_object:
665 * @value: an #FlValue of type #FL_VALUE_TYPE_CUSTOM.
666 *
667 * Gets the custom value as an object.
668 *
669 * Returns: an object.
670 */
671 GObject* fl_value_get_custom_value_object(FlValue* value);
672
673 /**
674 * fl_value_to_string:
675 * @value: an #FlValue.
676 *
677 * Converts an #FlValue to a text representation, suitable for logging purposes.
678 * The text is formatted to be the equivalent of Dart toString() methods.
679 *
680 * Returns: UTF-8 text.
681 */
682 gchar* fl_value_to_string(FlValue* value);
683
684 G_DEFINE_AUTOPTR_CLEANUP_FUNC(FlValue, fl_value_unref)
685
686 G_END_DECLS
687
688 #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_VALUE_H_
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1117
fl_value_get_int32_list
const int32_t * fl_value_get_int32_list(FlValue *value)
Definition: fl_value.cc:696
fl_value_get_map_value
FlValue * fl_value_get_map_value(FlValue *value, size_t index)
Definition: fl_value.cc:792
fl_value_new_bool
FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255
fl_value_new_null
FlValue * fl_value_new_null()
Definition: fl_value.cc:251
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
fl_value_new_custom_object
FlValue * fl_value_new_custom_object(int type, GObject *object)
Definition: fl_value.cc:385
fl_value_new_custom
FlValue * fl_value_new_custom(int type, gconstpointer value, GDestroyNotify destroy_notify)
Definition: fl_value.cc:374
fl_value_set_take
void fl_value_set_take(FlValue *value, FlValue *key, FlValue *child_value)
Definition: fl_value.cc:618
fl_value_new_float_list
FlValue * fl_value_new_float_list(const double *value, size_t value_length)
Definition: fl_value.cc:339
fl_value_get_list_value
FlValue * fl_value_get_list_value(FlValue *value, size_t index)
Definition: fl_value.cc:776
fl_value_unref
void fl_value_unref(FlValue *value)
Definition: fl_value.cc:400
fl_value_new_uint8_list_from_bytes
FlValue * fl_value_new_uint8_list_from_bytes(GBytes *value)
Definition: fl_value.cc:302
fl_value_new_float32_list
FlValue * fl_value_new_float32_list(const float *value, size_t value_length)
Definition: fl_value.cc:329
fl_value_new_int
FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
fl_value_get_type
FlValueType fl_value_get_type(FlValue *value)
Definition: fl_value.cc:466
fl_value_get_bool
bool fl_value_get_bool(FlValue *value)
Definition: fl_value.cc:661
fl_value_new_map
FlValue * fl_value_new_map()
Definition: fl_value.cc:366
fl_value_get_float32_list
const float * fl_value_get_float32_list(FlValue *value)
Definition: fl_value.cc:710
fl_value_get_float_list
const double * fl_value_get_float_list(FlValue *value)
Definition: fl_value.cc:717
fl_value_get_float
double fl_value_get_float(FlValue *value)
Definition: fl_value.cc:675
fl_value_new_int32_list
FlValue * fl_value_new_int32_list(const int32_t *value, size_t value_length)
Definition: fl_value.cc:309
fl_value_set_string_take
void fl_value_set_string_take(FlValue *value, const gchar *key, FlValue *child_value)
Definition: fl_value.cc:650
fl_value_get_length
size_t fl_value_get_length(FlValue *value)
Definition: fl_value.cc:724
fl_value_new_custom_object_take
FlValue * fl_value_new_custom_object_take(int type, GObject *object)
Definition: fl_value.cc:389
fl_value_new_uint8_list
FlValue * fl_value_new_uint8_list(const uint8_t *value, size_t value_length)
Definition: fl_value.cc:292
fl_value_ref
FlValue * fl_value_ref(FlValue *value)
Definition: fl_value.cc:394
fl_value_append
void fl_value_append(FlValue *value, FlValue *child)
Definition: fl_value.cc:592
fl_value_lookup
FlValue * fl_value_lookup(FlValue *value, FlValue *key)
Definition: fl_value.cc:800
fl_value_set
void fl_value_set(FlValue *value, FlValue *key, FlValue *child_value)
Definition: fl_value.cc:609
fl_value_new_list
FlValue * fl_value_new_list()
Definition: fl_value.cc:349
fl_value_get_custom_value_object
GObject * fl_value_get_custom_value_object(FlValue *value)
Definition: fl_value.cc:838
fl_value_new_int64_list
FlValue * fl_value_new_int64_list(const int64_t *value, size_t value_length)
Definition: fl_value.cc:319
fl_value_new_list_from_strv
FlValue * fl_value_new_list_from_strv(const gchar *const *value)
Definition: fl_value.cc:356
fl_value_lookup_string
FlValue * fl_value_lookup_string(FlValue *value, const gchar *key)
Definition: fl_value.cc:811
fl_value_get_custom_value
gconstpointer fl_value_get_custom_value(FlValue *value)
Definition: fl_value.cc:830
fl_value_get_int
int64_t fl_value_get_int(FlValue *value)
Definition: fl_value.cc:668
fl_value_new_string_sized
FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:283
fl_value_get_custom_type
int fl_value_get_custom_type(FlValue *value)
Definition: fl_value.cc:822
fl_value_get_map_key
FlValue * fl_value_get_map_key(FlValue *value, size_t index)
Definition: fl_value.cc:784
fl_value_set_string
void fl_value_set_string(FlValue *value, const gchar *key, FlValue *child_value)
Definition: fl_value.cc:639
fl_value_get_string
const gchar * fl_value_get_string(FlValue *value)
Definition: fl_value.cc:682
fl_value_equal
bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
fl_value_new_string
FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
fl_value_new_float
FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:269
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
fl_value_get_uint8_list
const uint8_t * fl_value_get_uint8_list(FlValue *value)
Definition: fl_value.cc:689
fl_value_get_int64_list
const int64_t * fl_value_get_int64_list(FlValue *value)
Definition: fl_value.cc:703
fl_value_append_take
void fl_value_append_take(FlValue *value, FlValue *child)
Definition: fl_value.cc:600
fl_value_to_string
gchar * fl_value_to_string(FlValue *value)
Definition: fl_value.cc:846
_FlValue
Definition: fl_value.cc:11