#include <standard_method_codec.h>
|
std::unique_ptr< MethodCall< EncodableValue > > | DecodeMethodCallInternal (const uint8_t *message, size_t message_size) const override |
|
std::unique_ptr< std::vector< uint8_t > > | EncodeMethodCallInternal (const MethodCall< EncodableValue > &method_call) const override |
|
std::unique_ptr< std::vector< uint8_t > > | EncodeSuccessEnvelopeInternal (const EncodableValue *result) const override |
|
std::unique_ptr< std::vector< uint8_t > > | EncodeErrorEnvelopeInternal (const std::string &error_code, const std::string &error_message, const EncodableValue *error_details) const override |
|
bool | DecodeAndProcessResponseEnvelopeInternal (const uint8_t *response, size_t response_size, MethodResult< EncodableValue > *result) const override |
|
virtual std::unique_ptr< MethodCall< EncodableValue > > | DecodeMethodCallInternal (const uint8_t *message, size_t message_size) const=0 |
|
virtual std::unique_ptr< std::vector< uint8_t > > | EncodeMethodCallInternal (const MethodCall< EncodableValue > &method_call) const=0 |
|
virtual std::unique_ptr< std::vector< uint8_t > > | EncodeSuccessEnvelopeInternal (const EncodableValue *result) const=0 |
|
virtual std::unique_ptr< std::vector< uint8_t > > | EncodeErrorEnvelopeInternal (const std::string &error_code, const std::string &error_message, const EncodableValue *error_details) const=0 |
|
virtual bool | DecodeAndProcessResponseEnvelopeInternal (const uint8_t *response, size_t response_size, MethodResult< EncodableValue > *result) const=0 |
|
Definition at line 18 of file standard_method_codec.h.
◆ ~StandardMethodCodec()
flutter::StandardMethodCodec::~StandardMethodCodec |
( |
| ) |
|
|
default |
◆ StandardMethodCodec()
◆ DecodeAndProcessResponseEnvelopeInternal()
bool flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal |
( |
const uint8_t * |
response, |
|
|
size_t |
response_size, |
|
|
MethodResult< EncodableValue > * |
result |
|
) |
| const |
|
overrideprotectedvirtual |
Implements flutter::MethodCodec< EncodableValue >.
Definition at line 432 of file standard_codec.cc.
435 {
436 ByteBufferStreamReader
stream(response, response_size);
439 case 0: {
441 if (
value.IsNull()) {
443 } else {
445 }
446 return true;
447 }
448 case 1: {
452 const std::string& message_string =
454 if (details.IsNull()) {
455 result->Error(std::get<std::string>(
code), message_string);
456 } else {
457 result->Error(std::get<std::string>(
code), message_string, details);
458 }
459 return true;
460 }
461 default:
462 return false;
463 }
464}
EncodableValue ReadValue(ByteStreamReader *stream) const
FlutterSemanticsFlag flag
◆ DecodeMethodCallInternal()
std::unique_ptr< MethodCall< EncodableValue > > flutter::StandardMethodCodec::DecodeMethodCallInternal |
( |
const uint8_t * |
message, |
|
|
size_t |
message_size |
|
) |
| const |
|
overrideprotectedvirtual |
Implements flutter::MethodCodec< EncodableValue >.
Definition at line 366 of file standard_codec.cc.
367 {
370 const auto* method_name = std::get_if<std::string>(&method_name_value);
371 if (!method_name) {
372 std::cerr << "Invalid method call; method name is not a string."
373 << std::endl;
374 return nullptr;
375 }
376 auto arguments =
378 return std::make_unique<MethodCall<EncodableValue>>(*method_name,
379 std::move(arguments));
380}
◆ EncodeErrorEnvelopeInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::StandardMethodCodec::EncodeErrorEnvelopeInternal |
( |
const std::string & |
error_code, |
|
|
const std::string & |
error_message, |
|
|
const EncodableValue * |
error_details |
|
) |
| const |
|
overrideprotectedvirtual |
Implements flutter::MethodCodec< EncodableValue >.
Definition at line 411 of file standard_codec.cc.
414 {
415 auto encoded = std::make_unique<std::vector<uint8_t>>();
416 ByteBufferStreamWriter
stream(encoded.get());
419 if (error_message.empty()) {
421 } else {
423 }
424 if (error_details) {
426 } else {
428 }
429 return encoded;
430}
virtual void WriteValue(const EncodableValue &value, ByteStreamWriter *stream) const
◆ EncodeMethodCallInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::StandardMethodCodec::EncodeMethodCallInternal |
( |
const MethodCall< EncodableValue > & |
method_call | ) |
const |
|
overrideprotectedvirtual |
◆ EncodeSuccessEnvelopeInternal()
std::unique_ptr< std::vector< uint8_t > > flutter::StandardMethodCodec::EncodeSuccessEnvelopeInternal |
( |
const EncodableValue * |
result | ) |
const |
|
overrideprotectedvirtual |
◆ GetInstance()
Definition at line 340 of file standard_codec.cc.
341 {
342 if (!serializer) {
344 }
345 static auto* sInstances =
new std::map<
const StandardCodecSerializer*,
346 std::unique_ptr<StandardMethodCodec>>;
347 auto it = sInstances->find(serializer);
348 if (it == sInstances->end()) {
349
350
351 auto emplace_result = sInstances->emplace(
352 serializer, std::unique_ptr<StandardMethodCodec>(
354 it = emplace_result.first;
355 }
356 return *(it->second);
357}
static const StandardCodecSerializer & GetInstance()
StandardMethodCodec(StandardMethodCodec const &)=delete
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
◆ operator=()
The documentation for this class was generated from the following files: