#include <json_method_codec.h>
Definition at line 16 of file json_method_codec.h.
◆ ~JsonMethodCodec()
flutter::JsonMethodCodec::~JsonMethodCodec |
( |
| ) |
|
|
default |
◆ JsonMethodCodec() [1/2]
◆ JsonMethodCodec() [2/2]
flutter::JsonMethodCodec::JsonMethodCodec |
( |
| ) |
|
|
protecteddefault |
◆ DecodeAndProcessResponseEnvelopeInternal()
bool flutter::JsonMethodCodec::DecodeAndProcessResponseEnvelopeInternal |
( |
const uint8_t * |
response, |
|
|
const size_t |
response_size, |
|
|
MethodResult< rapidjson::Document > * |
result |
|
) |
| const |
|
overrideprotectedvirtual |
◆ DecodeMethodCallInternal()
std::unique_ptr< MethodCall< rapidjson::Document > > flutter::JsonMethodCodec::DecodeMethodCallInternal |
( |
const uint8_t * |
message, |
|
|
const size_t |
message_size |
|
) |
| const |
|
overrideprotectedvirtual |
Implements flutter::MethodCodec< rapidjson::Document >.
Definition at line 42 of file json_method_codec.cc.
44 std::unique_ptr<rapidjson::Document> json_message =
50 auto method_name_iter = json_message->FindMember(kMessageMethodKey);
51 if (method_name_iter == json_message->MemberEnd()) {
54 if (!method_name_iter->value.IsString()) {
57 std::string method_name(method_name_iter->value.GetString());
58 auto arguments_iter = json_message->FindMember(kMessageArgumentsKey);
59 std::unique_ptr<rapidjson::Document> arguments;
60 if (arguments_iter != json_message->MemberEnd()) {
61 arguments = ExtractElement(json_message.get(), &(arguments_iter->value));
63 return std::make_unique<MethodCall<rapidjson::Document>>(
64 method_name, std::move(arguments));
References flutter::MessageCodec< T >::DecodeMessage(), flutter::JsonMessageCodec::GetInstance(), and message.
◆ EncodeErrorEnvelopeInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::JsonMethodCodec::EncodeErrorEnvelopeInternal |
( |
const std::string & |
error_code, |
|
|
const std::string & |
error_message, |
|
|
const rapidjson::Document * |
error_details |
|
) |
| const |
|
overrideprotectedvirtual |
◆ EncodeMethodCallInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::JsonMethodCodec::EncodeMethodCallInternal |
( |
const MethodCall< rapidjson::Document > & |
method_call | ) |
const |
|
overrideprotectedvirtual |
Implements flutter::MethodCodec< rapidjson::Document >.
Definition at line 67 of file json_method_codec.cc.
72 rapidjson::Document
message(rapidjson::kObjectType);
73 auto& allocator =
message.GetAllocator();
74 rapidjson::Value name(method_call.method_name(), allocator);
75 rapidjson::Value arguments;
76 if (method_call.arguments()) {
77 arguments.CopyFrom(*method_call.arguments(), allocator);
79 message.AddMember(kMessageMethodKey, name, allocator);
80 message.AddMember(kMessageArgumentsKey, arguments, allocator);
References flutter::MethodCall< T >::arguments(), flutter::MessageCodec< T >::EncodeMessage(), flutter::JsonMessageCodec::GetInstance(), message, and flutter::MethodCall< T >::method_name().
◆ EncodeSuccessEnvelopeInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::JsonMethodCodec::EncodeSuccessEnvelopeInternal |
( |
const rapidjson::Document * |
result | ) |
const |
|
overrideprotectedvirtual |
◆ GetInstance()
◆ operator=()
The documentation for this class was generated from the following files: