Flutter Engine
The Flutter Engine
Classes | Functions
fl_string_codec.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_string_codec.h"
#include <gmodule.h>
#include <cstring>

Go to the source code of this file.

Classes

struct  _FlStringCodec
 

Functions

static GBytes * fl_string_codec_encode_message (FlMessageCodec *codec, FlValue *value, GError **error)
 
static FlValuefl_string_codec_decode_message (FlMessageCodec *codec, GBytes *message, GError **error)
 
static void fl_string_codec_class_init (FlStringCodecClass *klass)
 
static void fl_string_codec_init (FlStringCodec *self)
 
G_MODULE_EXPORT FlStringCodec * fl_string_codec_new ()
 

Function Documentation

◆ fl_string_codec_class_init()

static void fl_string_codec_class_init ( FlStringCodecClass *  klass)
static

Definition at line 44 of file fl_string_codec.cc.

44 {
45 FL_MESSAGE_CODEC_CLASS(klass)->encode_message =
47 FL_MESSAGE_CODEC_CLASS(klass)->decode_message =
49}
static GBytes * fl_string_codec_encode_message(FlMessageCodec *codec, FlValue *value, GError **error)
static FlValue * fl_string_codec_decode_message(FlMessageCodec *codec, GBytes *message, GError **error)

◆ fl_string_codec_decode_message()

static FlValue * fl_string_codec_decode_message ( FlMessageCodec *  codec,
GBytes *  message,
GError **  error 
)
static

Definition at line 35 of file fl_string_codec.cc.

37 {
38 gsize data_length;
39 const gchar* data =
40 static_cast<const gchar*>(g_bytes_get_data(message, &data_length));
41 return fl_value_new_string_sized(data, data_length);
42}
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:283
Win32Message message
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ fl_string_codec_encode_message()

static GBytes * fl_string_codec_encode_message ( FlMessageCodec *  codec,
FlValue value,
GError **  error 
)
static

Definition at line 20 of file fl_string_codec.cc.

22 {
24 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
26 "Only string values supported");
27 return nullptr;
28 }
29
30 const gchar* text = fl_value_get_string(value);
31 return g_bytes_new(text, strlen(text));
32}
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
#define FL_MESSAGE_CODEC_ERROR
const uint8_t uint32_t uint32_t GError ** error
uint8_t value
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:69
std::u16string text

◆ fl_string_codec_init()

static void fl_string_codec_init ( FlStringCodec *  self)
static

Definition at line 51 of file fl_string_codec.cc.

51{}

◆ fl_string_codec_new()

G_MODULE_EXPORT FlStringCodec * fl_string_codec_new ( )

Definition at line 53 of file fl_string_codec.cc.

53 {
54 return static_cast<FlStringCodec*>(
55 g_object_new(fl_string_codec_get_type(), nullptr));
56}