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