#include <json_message_codec.h>
Definition at line 16 of file json_message_codec.h.
◆ ~JsonMessageCodec()
flutter::JsonMessageCodec::~JsonMessageCodec |
( |
| ) |
|
|
default |
◆ JsonMessageCodec() [1/2]
◆ JsonMessageCodec() [2/2]
flutter::JsonMessageCodec::JsonMessageCodec |
( |
| ) |
|
|
protecteddefault |
◆ DecodeMessageInternal()
std::unique_ptr< rapidjson::Document > flutter::JsonMessageCodec::DecodeMessageInternal |
( |
const uint8_t * |
binary_message, |
|
|
const size_t |
message_size |
|
) |
| const |
|
overrideprotectedvirtual |
Implements flutter::MessageCodec< rapidjson::Document >.
Definition at line 35 of file json_message_codec.cc.
38 auto raw_message =
reinterpret_cast<const char*
>(binary_message);
39 auto json_message = std::make_unique<rapidjson::Document>();
40 rapidjson::ParseResult result =
41 json_message->Parse(raw_message, message_size);
42 if (result.IsError()) {
43 std::cerr <<
"Unable to parse JSON message:" << std::endl
44 << rapidjson::GetParseError_En(result.Code()) << std::endl;
◆ EncodeMessageInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::JsonMessageCodec::EncodeMessageInternal |
( |
const rapidjson::Document & |
message | ) |
const |
|
overrideprotectedvirtual |
Implements flutter::MessageCodec< rapidjson::Document >.
Definition at line 22 of file json_message_codec.cc.
24 rapidjson::StringBuffer buffer;
25 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
29 message.Accept(writer);
30 const char* buffer_start = buffer.GetString();
31 return std::make_unique<std::vector<uint8_t>>(
32 buffer_start, buffer_start + buffer.GetSize());
◆ GetInstance()
◆ operator=()
The documentation for this class was generated from the following files: