|
Flutter Linux Embedder
|
|
Go to the documentation of this file.
31 fl_standard_message_codec,
32 fl_message_codec_get_type())
67 while (
buffer->len % align != 0) {
77 if (offset + required > g_bytes_get_size(
buffer)) {
90 if ((*offset) % align == 0) {
94 size_t required = align - (*offset) % align;
99 (*offset) += required;
105 return static_cast<const uint8_t*
>(g_bytes_get_data(
buffer,
nullptr)) +
135 *offset +=
sizeof(uint16_t);
150 *offset +=
sizeof(uint32_t);
166 *offset +=
sizeof(int32_t);
182 *offset +=
sizeof(int64_t);
201 *offset +=
sizeof(double);
266 *offset +=
sizeof(int32_t) *
length;
290 *offset +=
sizeof(int64_t) *
length;
314 *offset +=
sizeof(float) *
length;
338 *offset +=
sizeof(double) *
length;
359 if (child ==
nullptr) {
385 if (key ==
nullptr) {
390 if (
value ==
nullptr) {
403 FlStandardMessageCodec*
self =
404 reinterpret_cast<FlStandardMessageCodec*
>(codec);
406 g_autoptr(GByteArray)
buffer = g_byte_array_new();
410 return g_byte_array_free_to_bytes(
411 static_cast<GByteArray*
>(g_steal_pointer(&
buffer)));
418 if (g_bytes_get_size(message) == 0) {
422 FlStandardMessageCodec*
self =
423 reinterpret_cast<FlStandardMessageCodec*
>(codec);
428 if (
value ==
nullptr) {
432 if (offset != g_bytes_get_size(message)) {
435 "Unused %zi bytes after standard message",
436 g_bytes_get_size(message) - offset);
445 FlStandardMessageCodec*
self,
449 if (
value ==
nullptr) {
467 if (v >= INT32_MIN && v <= INT32_MAX) {
484 size_t length = strlen(text);
495 sizeof(uint8_t) *
length);
506 sizeof(int32_t) *
length);
517 sizeof(int64_t) *
length);
569 "Custom value not implemented");
581 FlStandardMessageCodec*
self,
618 "Unexpected standard codec type %02x",
type);
626 FlStandardMessageCodecClass* klass) {
627 FL_MESSAGE_CODEC_CLASS(klass)->encode_message =
629 FL_MESSAGE_CODEC_CLASS(klass)->decode_message =
638 return static_cast<FlStandardMessageCodec*
>(
639 g_object_new(fl_standard_message_codec_get_type(),
nullptr));
643 FlStandardMessageCodec* codec,
647 write_uint8(
buffer, size);
648 }
else if (size <= 0xffff) {
658 FlStandardMessageCodec* codec,
672 }
else if (value8 == 254) {
686 FlStandardMessageCodec*
self,
690 return FL_STANDARD_MESSAGE_CODEC_GET_CLASS(
self)->write_value(
self,
buffer,
695 FlStandardMessageCodec*
self,
704 return FL_STANDARD_MESSAGE_CODEC_GET_CLASS(
self)->read_value_of_type(
G_DEFINE_TYPE(FlStandardMessageCodec, fl_standard_message_codec, fl_message_codec_get_type()) static void write_uint8(GByteArray *buffer
static FlValue * read_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static gboolean read_uint16(GBytes *buffer, size_t *offset, uint16_t *value, GError **error)
static constexpr int kValueList
const G_MODULE_EXPORT int32_t * fl_value_get_int32_list(FlValue *self)
@ FL_VALUE_TYPE_UINT8_LIST
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
G_MODULE_EXPORT void fl_standard_message_codec_write_size(FlStandardMessageCodec *codec, GByteArray *buffer, uint32_t size)
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
static constexpr int kValueUint8List
static GBytes * fl_standard_message_codec_encode_message(FlMessageCodec *codec, FlValue *message, GError **error)
static FlValue * read_int32_value(GBytes *buffer, size_t *offset, GError **error)
static constexpr int kValueNull
static FlValue * fl_standard_message_codec_read_value_of_type(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, int type, GError **error)
static constexpr int kValueInt64List
G_MODULE_EXPORT gboolean fl_standard_message_codec_write_value(FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_list()
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
const G_MODULE_EXPORT double * fl_value_get_float_list(FlValue *self)
static constexpr int kValueInt32List
static constexpr int kValueInt64
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
@ FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA
typedefG_BEGIN_DECLS struct _FlValue FlValue
static constexpr int kValueInt32
static constexpr int kValueFloat64List
static void write_float64(GByteArray *buffer, double value)
static constexpr int kValueTrue
G_MODULE_EXPORT FlValue * fl_value_new_null()
static FlValue * read_string_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
const G_MODULE_EXPORT uint8_t * fl_value_get_uint8_list(FlValue *self)
G_MODULE_EXPORT void fl_value_set(FlValue *self, FlValue *key, FlValue *value)
static void write_int64(GByteArray *buffer, int64_t value)
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
static FlValue * read_float64_value(GBytes *buffer, size_t *offset, GError **error)
const G_MODULE_EXPORT float * fl_value_get_float32_list(FlValue *self)
static FlValue * read_map_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
static FlValue * read_int32_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
static void write_int32(GByteArray *buffer, int32_t value)
static FlValue * read_uint8_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
g_byte_array_append(buffer, &type, sizeof(uint8_t))
G_MODULE_EXPORT FlValue * fl_value_new_map()
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
static void write_uint16(GByteArray *buffer, uint16_t value)
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
static FlValue * read_int64_value(GBytes *buffer, size_t *offset, GError **error)
@ FL_VALUE_TYPE_FLOAT32_LIST
static FlValue * read_float32_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
static constexpr int kValueFalse
static FlValue * fl_standard_message_codec_decode_message(FlMessageCodec *codec, GBytes *message, GError **error)
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
static gboolean fl_standard_message_codec_real_write_value(FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
@ FL_VALUE_TYPE_INT64_LIST
static constexpr int kValueFloat64
G_MODULE_EXPORT gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
static void fl_standard_message_codec_class_init(FlStandardMessageCodecClass *klass)
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
const uint8_t uint32_t uint32_t GError ** error
static constexpr int kValueMap
@ FL_VALUE_TYPE_FLOAT_LIST
static void fl_standard_message_codec_init(FlStandardMessageCodec *self)
static gboolean read_uint32(GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
static const uint8_t buffer[]
static constexpr int kValueFloat32List
static constexpr int kValueString
@ FL_VALUE_TYPE_INT32_LIST
static void write_align(GByteArray *buffer, guint align)
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
static FlValue * read_float64_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
static gboolean read_uint8(GBytes *buffer, size_t *offset, uint8_t *value, GError **error)
static void write_uint32(GByteArray *buffer, uint32_t value)
const G_MODULE_EXPORT int64_t * fl_value_get_int64_list(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
static FlValue * read_int64_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_standard_message_codec_read_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
#define FL_MESSAGE_CODEC_ERROR