Flutter Engine
fl_message_codec.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_message_codec.h"
#include <gmodule.h>

Go to the source code of this file.

Functions

G_MODULE_EXPORT GType fl_message_codec_get_type ()
 
static void fl_message_codec_class_init (FlMessageCodecClass *klass)
 
static void fl_message_codec_init (FlMessageCodec *self)
 
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message (FlMessageCodec *self, FlValue *message, GError **error)
 
G_MODULE_EXPORT FlValuefl_message_codec_decode_message (FlMessageCodec *self, GBytes *message, GError **error)
 

Function Documentation

◆ fl_message_codec_class_init()

static void fl_message_codec_class_init ( FlMessageCodecClass *  klass)
static

Definition at line 16 of file fl_message_codec.cc.

16 {}

◆ fl_message_codec_decode_message()

G_MODULE_EXPORT FlValue* fl_message_codec_decode_message ( FlMessageCodec *  codec,
GBytes *  message,
GError **  error 
)

fl_message_codec_decode_message: : an #FlMessageCodec. : binary message to decode. : (allow-none): #GError location to store the error occurring, or NULL.

Decodes a message from a binary encoding.

Returns: an FlValue or NULL on error.

Definition at line 36 of file fl_message_codec.cc.

Referenced by decode_error_value(), decode_message(), fl_basic_message_channel_send_finish(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), G_DECLARE_DERIVABLE_TYPE(), message_cb(), and TEST().

38  {
39  g_return_val_if_fail(FL_IS_MESSAGE_CODEC(self), nullptr);
40  g_return_val_if_fail(message != nullptr, nullptr);
41 
42  return FL_MESSAGE_CODEC_GET_CLASS(self)->decode_message(self, message, error);
43 }
FlMethodResponse GError ** error

◆ fl_message_codec_encode_message()

G_MODULE_EXPORT GBytes* fl_message_codec_encode_message ( FlMessageCodec *  codec,
FlValue message,
GError **  error 
)

fl_message_codec_encode_message: : an #FlMessageCodec. : buffer to write to. : message to encode or NULL to encode the null value. : (allow-none): #GError location to store the error occurring, or NULL.

Encodes a message into a binary representation.

Returns: a binary encoded message or NULL on error.

Definition at line 20 of file fl_message_codec.cc.

References fl_value_new_null().

Referenced by encode_message(), encode_message_error(), fl_basic_message_channel_respond(), fl_basic_message_channel_send(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_json_method_codec_encode_success_envelope(), G_DECLARE_DERIVABLE_TYPE(), and TEST().

22  {
23  g_return_val_if_fail(FL_IS_MESSAGE_CODEC(self), nullptr);
24 
25  // If the user provided NULL, then make a temporary FlValue object for this to
26  // make it simpler for the subclasses.
27  g_autoptr(FlValue) null_value = nullptr;
28  if (message == nullptr) {
29  null_value = fl_value_new_null();
30  message = null_value;
31  }
32 
33  return FL_MESSAGE_CODEC_GET_CLASS(self)->encode_message(self, message, error);
34 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ fl_message_codec_get_type()

G_MODULE_EXPORT GType fl_message_codec_get_type ( )

◆ fl_message_codec_init()

static void fl_message_codec_init ( FlMessageCodec *  self)
static

Definition at line 18 of file fl_message_codec.cc.

18 {}