| // Copyright 2013 The Flutter Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // |
| // Autogenerated from Pigeon, do not edit directly. |
| // See also: https://pub.dev/packages/pigeon |
| |
| #undef _HAS_EXCEPTIONS |
| |
| #include "core_tests.gen.h" |
| |
| #include <flutter/basic_message_channel.h> |
| #include <flutter/binary_messenger.h> |
| #include <flutter/encodable_value.h> |
| #include <flutter/standard_message_codec.h> |
| |
| #include <map> |
| #include <optional> |
| #include <string> |
| |
| namespace core_tests_pigeontest { |
| using flutter::BasicMessageChannel; |
| using flutter::CustomEncodableValue; |
| using flutter::EncodableList; |
| using flutter::EncodableMap; |
| using flutter::EncodableValue; |
| |
| // AllTypes |
| |
| AllTypes::AllTypes(bool a_bool, int64_t an_int, int64_t an_int64, |
| double a_double, const std::vector<uint8_t>& a_byte_array, |
| const std::vector<int32_t>& a4_byte_array, |
| const std::vector<int64_t>& a8_byte_array, |
| const std::vector<double>& a_float_array, |
| const EncodableList& a_list, const EncodableMap& a_map, |
| const AnEnum& an_enum, const std::string& a_string, |
| const EncodableValue& an_object) |
| : a_bool_(a_bool), |
| an_int_(an_int), |
| an_int64_(an_int64), |
| a_double_(a_double), |
| a_byte_array_(a_byte_array), |
| a4_byte_array_(a4_byte_array), |
| a8_byte_array_(a8_byte_array), |
| a_float_array_(a_float_array), |
| a_list_(a_list), |
| a_map_(a_map), |
| an_enum_(an_enum), |
| a_string_(a_string), |
| an_object_(an_object) {} |
| |
| bool AllTypes::a_bool() const { return a_bool_; } |
| |
| void AllTypes::set_a_bool(bool value_arg) { a_bool_ = value_arg; } |
| |
| int64_t AllTypes::an_int() const { return an_int_; } |
| |
| void AllTypes::set_an_int(int64_t value_arg) { an_int_ = value_arg; } |
| |
| int64_t AllTypes::an_int64() const { return an_int64_; } |
| |
| void AllTypes::set_an_int64(int64_t value_arg) { an_int64_ = value_arg; } |
| |
| double AllTypes::a_double() const { return a_double_; } |
| |
| void AllTypes::set_a_double(double value_arg) { a_double_ = value_arg; } |
| |
| const std::vector<uint8_t>& AllTypes::a_byte_array() const { |
| return a_byte_array_; |
| } |
| |
| void AllTypes::set_a_byte_array(const std::vector<uint8_t>& value_arg) { |
| a_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int32_t>& AllTypes::a4_byte_array() const { |
| return a4_byte_array_; |
| } |
| |
| void AllTypes::set_a4_byte_array(const std::vector<int32_t>& value_arg) { |
| a4_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int64_t>& AllTypes::a8_byte_array() const { |
| return a8_byte_array_; |
| } |
| |
| void AllTypes::set_a8_byte_array(const std::vector<int64_t>& value_arg) { |
| a8_byte_array_ = value_arg; |
| } |
| |
| const std::vector<double>& AllTypes::a_float_array() const { |
| return a_float_array_; |
| } |
| |
| void AllTypes::set_a_float_array(const std::vector<double>& value_arg) { |
| a_float_array_ = value_arg; |
| } |
| |
| const EncodableList& AllTypes::a_list() const { return a_list_; } |
| |
| void AllTypes::set_a_list(const EncodableList& value_arg) { |
| a_list_ = value_arg; |
| } |
| |
| const EncodableMap& AllTypes::a_map() const { return a_map_; } |
| |
| void AllTypes::set_a_map(const EncodableMap& value_arg) { a_map_ = value_arg; } |
| |
| const AnEnum& AllTypes::an_enum() const { return an_enum_; } |
| |
| void AllTypes::set_an_enum(const AnEnum& value_arg) { an_enum_ = value_arg; } |
| |
| const std::string& AllTypes::a_string() const { return a_string_; } |
| |
| void AllTypes::set_a_string(std::string_view value_arg) { |
| a_string_ = value_arg; |
| } |
| |
| const EncodableValue& AllTypes::an_object() const { return an_object_; } |
| |
| void AllTypes::set_an_object(const EncodableValue& value_arg) { |
| an_object_ = value_arg; |
| } |
| |
| EncodableList AllTypes::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(13); |
| list.push_back(EncodableValue(a_bool_)); |
| list.push_back(EncodableValue(an_int_)); |
| list.push_back(EncodableValue(an_int64_)); |
| list.push_back(EncodableValue(a_double_)); |
| list.push_back(EncodableValue(a_byte_array_)); |
| list.push_back(EncodableValue(a4_byte_array_)); |
| list.push_back(EncodableValue(a8_byte_array_)); |
| list.push_back(EncodableValue(a_float_array_)); |
| list.push_back(EncodableValue(a_list_)); |
| list.push_back(EncodableValue(a_map_)); |
| list.push_back(EncodableValue((int)an_enum_)); |
| list.push_back(EncodableValue(a_string_)); |
| list.push_back(an_object_); |
| return list; |
| } |
| |
| AllTypes AllTypes::FromEncodableList(const EncodableList& list) { |
| AllTypes decoded( |
| std::get<bool>(list[0]), list[1].LongValue(), list[2].LongValue(), |
| std::get<double>(list[3]), std::get<std::vector<uint8_t>>(list[4]), |
| std::get<std::vector<int32_t>>(list[5]), |
| std::get<std::vector<int64_t>>(list[6]), |
| std::get<std::vector<double>>(list[7]), std::get<EncodableList>(list[8]), |
| std::get<EncodableMap>(list[9]), (AnEnum)(std::get<int32_t>(list[10])), |
| std::get<std::string>(list[11]), list[12]); |
| return decoded; |
| } |
| |
| // AllNullableTypes |
| |
| AllNullableTypes::AllNullableTypes() {} |
| |
| AllNullableTypes::AllNullableTypes( |
| const bool* a_nullable_bool, const int64_t* a_nullable_int, |
| const int64_t* a_nullable_int64, const double* a_nullable_double, |
| const std::vector<uint8_t>* a_nullable_byte_array, |
| const std::vector<int32_t>* a_nullable4_byte_array, |
| const std::vector<int64_t>* a_nullable8_byte_array, |
| const std::vector<double>* a_nullable_float_array, |
| const EncodableList* a_nullable_list, const EncodableMap* a_nullable_map, |
| const EncodableList* nullable_nested_list, |
| const EncodableMap* nullable_map_with_annotations, |
| const EncodableMap* nullable_map_with_object, const AnEnum* a_nullable_enum, |
| const std::string* a_nullable_string, |
| const EncodableValue* a_nullable_object) |
| : a_nullable_bool_(a_nullable_bool ? std::optional<bool>(*a_nullable_bool) |
| : std::nullopt), |
| a_nullable_int_(a_nullable_int ? std::optional<int64_t>(*a_nullable_int) |
| : std::nullopt), |
| a_nullable_int64_(a_nullable_int64 |
| ? std::optional<int64_t>(*a_nullable_int64) |
| : std::nullopt), |
| a_nullable_double_(a_nullable_double |
| ? std::optional<double>(*a_nullable_double) |
| : std::nullopt), |
| a_nullable_byte_array_( |
| a_nullable_byte_array |
| ? std::optional<std::vector<uint8_t>>(*a_nullable_byte_array) |
| : std::nullopt), |
| a_nullable4_byte_array_( |
| a_nullable4_byte_array |
| ? std::optional<std::vector<int32_t>>(*a_nullable4_byte_array) |
| : std::nullopt), |
| a_nullable8_byte_array_( |
| a_nullable8_byte_array |
| ? std::optional<std::vector<int64_t>>(*a_nullable8_byte_array) |
| : std::nullopt), |
| a_nullable_float_array_( |
| a_nullable_float_array |
| ? std::optional<std::vector<double>>(*a_nullable_float_array) |
| : std::nullopt), |
| a_nullable_list_(a_nullable_list |
| ? std::optional<EncodableList>(*a_nullable_list) |
| : std::nullopt), |
| a_nullable_map_(a_nullable_map |
| ? std::optional<EncodableMap>(*a_nullable_map) |
| : std::nullopt), |
| nullable_nested_list_(nullable_nested_list ? std::optional<EncodableList>( |
| *nullable_nested_list) |
| : std::nullopt), |
| nullable_map_with_annotations_( |
| nullable_map_with_annotations |
| ? std::optional<EncodableMap>(*nullable_map_with_annotations) |
| : std::nullopt), |
| nullable_map_with_object_( |
| nullable_map_with_object |
| ? std::optional<EncodableMap>(*nullable_map_with_object) |
| : std::nullopt), |
| a_nullable_enum_(a_nullable_enum ? std::optional<AnEnum>(*a_nullable_enum) |
| : std::nullopt), |
| a_nullable_string_(a_nullable_string |
| ? std::optional<std::string>(*a_nullable_string) |
| : std::nullopt), |
| a_nullable_object_(a_nullable_object |
| ? std::optional<EncodableValue>(*a_nullable_object) |
| : std::nullopt) {} |
| |
| const bool* AllNullableTypes::a_nullable_bool() const { |
| return a_nullable_bool_ ? &(*a_nullable_bool_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_bool(const bool* value_arg) { |
| a_nullable_bool_ = value_arg ? std::optional<bool>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_bool(bool value_arg) { |
| a_nullable_bool_ = value_arg; |
| } |
| |
| const int64_t* AllNullableTypes::a_nullable_int() const { |
| return a_nullable_int_ ? &(*a_nullable_int_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_int(const int64_t* value_arg) { |
| a_nullable_int_ = |
| value_arg ? std::optional<int64_t>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_int(int64_t value_arg) { |
| a_nullable_int_ = value_arg; |
| } |
| |
| const int64_t* AllNullableTypes::a_nullable_int64() const { |
| return a_nullable_int64_ ? &(*a_nullable_int64_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_int64(const int64_t* value_arg) { |
| a_nullable_int64_ = |
| value_arg ? std::optional<int64_t>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_int64(int64_t value_arg) { |
| a_nullable_int64_ = value_arg; |
| } |
| |
| const double* AllNullableTypes::a_nullable_double() const { |
| return a_nullable_double_ ? &(*a_nullable_double_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_double(const double* value_arg) { |
| a_nullable_double_ = |
| value_arg ? std::optional<double>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_double(double value_arg) { |
| a_nullable_double_ = value_arg; |
| } |
| |
| const std::vector<uint8_t>* AllNullableTypes::a_nullable_byte_array() const { |
| return a_nullable_byte_array_ ? &(*a_nullable_byte_array_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_byte_array( |
| const std::vector<uint8_t>* value_arg) { |
| a_nullable_byte_array_ = value_arg |
| ? std::optional<std::vector<uint8_t>>(*value_arg) |
| : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_byte_array( |
| const std::vector<uint8_t>& value_arg) { |
| a_nullable_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int32_t>* AllNullableTypes::a_nullable4_byte_array() const { |
| return a_nullable4_byte_array_ ? &(*a_nullable4_byte_array_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable4_byte_array( |
| const std::vector<int32_t>* value_arg) { |
| a_nullable4_byte_array_ = |
| value_arg ? std::optional<std::vector<int32_t>>(*value_arg) |
| : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable4_byte_array( |
| const std::vector<int32_t>& value_arg) { |
| a_nullable4_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int64_t>* AllNullableTypes::a_nullable8_byte_array() const { |
| return a_nullable8_byte_array_ ? &(*a_nullable8_byte_array_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable8_byte_array( |
| const std::vector<int64_t>* value_arg) { |
| a_nullable8_byte_array_ = |
| value_arg ? std::optional<std::vector<int64_t>>(*value_arg) |
| : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable8_byte_array( |
| const std::vector<int64_t>& value_arg) { |
| a_nullable8_byte_array_ = value_arg; |
| } |
| |
| const std::vector<double>* AllNullableTypes::a_nullable_float_array() const { |
| return a_nullable_float_array_ ? &(*a_nullable_float_array_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_float_array( |
| const std::vector<double>* value_arg) { |
| a_nullable_float_array_ = |
| value_arg ? std::optional<std::vector<double>>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_float_array( |
| const std::vector<double>& value_arg) { |
| a_nullable_float_array_ = value_arg; |
| } |
| |
| const EncodableList* AllNullableTypes::a_nullable_list() const { |
| return a_nullable_list_ ? &(*a_nullable_list_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_list(const EncodableList* value_arg) { |
| a_nullable_list_ = |
| value_arg ? std::optional<EncodableList>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_list(const EncodableList& value_arg) { |
| a_nullable_list_ = value_arg; |
| } |
| |
| const EncodableMap* AllNullableTypes::a_nullable_map() const { |
| return a_nullable_map_ ? &(*a_nullable_map_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_map(const EncodableMap* value_arg) { |
| a_nullable_map_ = |
| value_arg ? std::optional<EncodableMap>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_map(const EncodableMap& value_arg) { |
| a_nullable_map_ = value_arg; |
| } |
| |
| const EncodableList* AllNullableTypes::nullable_nested_list() const { |
| return nullable_nested_list_ ? &(*nullable_nested_list_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_nullable_nested_list( |
| const EncodableList* value_arg) { |
| nullable_nested_list_ = |
| value_arg ? std::optional<EncodableList>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_nullable_nested_list( |
| const EncodableList& value_arg) { |
| nullable_nested_list_ = value_arg; |
| } |
| |
| const EncodableMap* AllNullableTypes::nullable_map_with_annotations() const { |
| return nullable_map_with_annotations_ ? &(*nullable_map_with_annotations_) |
| : nullptr; |
| } |
| |
| void AllNullableTypes::set_nullable_map_with_annotations( |
| const EncodableMap* value_arg) { |
| nullable_map_with_annotations_ = |
| value_arg ? std::optional<EncodableMap>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_nullable_map_with_annotations( |
| const EncodableMap& value_arg) { |
| nullable_map_with_annotations_ = value_arg; |
| } |
| |
| const EncodableMap* AllNullableTypes::nullable_map_with_object() const { |
| return nullable_map_with_object_ ? &(*nullable_map_with_object_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_nullable_map_with_object( |
| const EncodableMap* value_arg) { |
| nullable_map_with_object_ = |
| value_arg ? std::optional<EncodableMap>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_nullable_map_with_object( |
| const EncodableMap& value_arg) { |
| nullable_map_with_object_ = value_arg; |
| } |
| |
| const AnEnum* AllNullableTypes::a_nullable_enum() const { |
| return a_nullable_enum_ ? &(*a_nullable_enum_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_enum(const AnEnum* value_arg) { |
| a_nullable_enum_ = |
| value_arg ? std::optional<AnEnum>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { |
| a_nullable_enum_ = value_arg; |
| } |
| |
| const std::string* AllNullableTypes::a_nullable_string() const { |
| return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_string( |
| const std::string_view* value_arg) { |
| a_nullable_string_ = |
| value_arg ? std::optional<std::string>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_string(std::string_view value_arg) { |
| a_nullable_string_ = value_arg; |
| } |
| |
| const EncodableValue* AllNullableTypes::a_nullable_object() const { |
| return a_nullable_object_ ? &(*a_nullable_object_) : nullptr; |
| } |
| |
| void AllNullableTypes::set_a_nullable_object(const EncodableValue* value_arg) { |
| a_nullable_object_ = |
| value_arg ? std::optional<EncodableValue>(*value_arg) : std::nullopt; |
| } |
| |
| void AllNullableTypes::set_a_nullable_object(const EncodableValue& value_arg) { |
| a_nullable_object_ = value_arg; |
| } |
| |
| EncodableList AllNullableTypes::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(16); |
| list.push_back(a_nullable_bool_ ? EncodableValue(*a_nullable_bool_) |
| : EncodableValue()); |
| list.push_back(a_nullable_int_ ? EncodableValue(*a_nullable_int_) |
| : EncodableValue()); |
| list.push_back(a_nullable_int64_ ? EncodableValue(*a_nullable_int64_) |
| : EncodableValue()); |
| list.push_back(a_nullable_double_ ? EncodableValue(*a_nullable_double_) |
| : EncodableValue()); |
| list.push_back(a_nullable_byte_array_ |
| ? EncodableValue(*a_nullable_byte_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable4_byte_array_ |
| ? EncodableValue(*a_nullable4_byte_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable8_byte_array_ |
| ? EncodableValue(*a_nullable8_byte_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable_float_array_ |
| ? EncodableValue(*a_nullable_float_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable_list_ ? EncodableValue(*a_nullable_list_) |
| : EncodableValue()); |
| list.push_back(a_nullable_map_ ? EncodableValue(*a_nullable_map_) |
| : EncodableValue()); |
| list.push_back(nullable_nested_list_ ? EncodableValue(*nullable_nested_list_) |
| : EncodableValue()); |
| list.push_back(nullable_map_with_annotations_ |
| ? EncodableValue(*nullable_map_with_annotations_) |
| : EncodableValue()); |
| list.push_back(nullable_map_with_object_ |
| ? EncodableValue(*nullable_map_with_object_) |
| : EncodableValue()); |
| list.push_back(a_nullable_enum_ ? EncodableValue((int)(*a_nullable_enum_)) |
| : EncodableValue()); |
| list.push_back(a_nullable_string_ ? EncodableValue(*a_nullable_string_) |
| : EncodableValue()); |
| list.push_back(a_nullable_object_ ? *a_nullable_object_ : EncodableValue()); |
| return list; |
| } |
| |
| AllNullableTypes AllNullableTypes::FromEncodableList( |
| const EncodableList& list) { |
| AllNullableTypes decoded; |
| auto& encodable_a_nullable_bool = list[0]; |
| if (!encodable_a_nullable_bool.IsNull()) { |
| decoded.set_a_nullable_bool(std::get<bool>(encodable_a_nullable_bool)); |
| } |
| auto& encodable_a_nullable_int = list[1]; |
| if (!encodable_a_nullable_int.IsNull()) { |
| decoded.set_a_nullable_int(encodable_a_nullable_int.LongValue()); |
| } |
| auto& encodable_a_nullable_int64 = list[2]; |
| if (!encodable_a_nullable_int64.IsNull()) { |
| decoded.set_a_nullable_int64(encodable_a_nullable_int64.LongValue()); |
| } |
| auto& encodable_a_nullable_double = list[3]; |
| if (!encodable_a_nullable_double.IsNull()) { |
| decoded.set_a_nullable_double( |
| std::get<double>(encodable_a_nullable_double)); |
| } |
| auto& encodable_a_nullable_byte_array = list[4]; |
| if (!encodable_a_nullable_byte_array.IsNull()) { |
| decoded.set_a_nullable_byte_array( |
| std::get<std::vector<uint8_t>>(encodable_a_nullable_byte_array)); |
| } |
| auto& encodable_a_nullable4_byte_array = list[5]; |
| if (!encodable_a_nullable4_byte_array.IsNull()) { |
| decoded.set_a_nullable4_byte_array( |
| std::get<std::vector<int32_t>>(encodable_a_nullable4_byte_array)); |
| } |
| auto& encodable_a_nullable8_byte_array = list[6]; |
| if (!encodable_a_nullable8_byte_array.IsNull()) { |
| decoded.set_a_nullable8_byte_array( |
| std::get<std::vector<int64_t>>(encodable_a_nullable8_byte_array)); |
| } |
| auto& encodable_a_nullable_float_array = list[7]; |
| if (!encodable_a_nullable_float_array.IsNull()) { |
| decoded.set_a_nullable_float_array( |
| std::get<std::vector<double>>(encodable_a_nullable_float_array)); |
| } |
| auto& encodable_a_nullable_list = list[8]; |
| if (!encodable_a_nullable_list.IsNull()) { |
| decoded.set_a_nullable_list( |
| std::get<EncodableList>(encodable_a_nullable_list)); |
| } |
| auto& encodable_a_nullable_map = list[9]; |
| if (!encodable_a_nullable_map.IsNull()) { |
| decoded.set_a_nullable_map( |
| std::get<EncodableMap>(encodable_a_nullable_map)); |
| } |
| auto& encodable_nullable_nested_list = list[10]; |
| if (!encodable_nullable_nested_list.IsNull()) { |
| decoded.set_nullable_nested_list( |
| std::get<EncodableList>(encodable_nullable_nested_list)); |
| } |
| auto& encodable_nullable_map_with_annotations = list[11]; |
| if (!encodable_nullable_map_with_annotations.IsNull()) { |
| decoded.set_nullable_map_with_annotations( |
| std::get<EncodableMap>(encodable_nullable_map_with_annotations)); |
| } |
| auto& encodable_nullable_map_with_object = list[12]; |
| if (!encodable_nullable_map_with_object.IsNull()) { |
| decoded.set_nullable_map_with_object( |
| std::get<EncodableMap>(encodable_nullable_map_with_object)); |
| } |
| auto& encodable_a_nullable_enum = list[13]; |
| if (!encodable_a_nullable_enum.IsNull()) { |
| decoded.set_a_nullable_enum( |
| (AnEnum)(std::get<int32_t>(encodable_a_nullable_enum))); |
| } |
| auto& encodable_a_nullable_string = list[14]; |
| if (!encodable_a_nullable_string.IsNull()) { |
| decoded.set_a_nullable_string( |
| std::get<std::string>(encodable_a_nullable_string)); |
| } |
| auto& encodable_a_nullable_object = list[15]; |
| if (!encodable_a_nullable_object.IsNull()) { |
| decoded.set_a_nullable_object(encodable_a_nullable_object); |
| } |
| return decoded; |
| } |
| |
| // AllClassesWrapper |
| |
| AllClassesWrapper::AllClassesWrapper(const AllNullableTypes& all_nullable_types) |
| : all_nullable_types_(all_nullable_types) {} |
| |
| AllClassesWrapper::AllClassesWrapper(const AllNullableTypes& all_nullable_types, |
| const AllTypes* all_types) |
| : all_nullable_types_(all_nullable_types), |
| all_types_(all_types ? std::optional<AllTypes>(*all_types) |
| : std::nullopt) {} |
| |
| const AllNullableTypes& AllClassesWrapper::all_nullable_types() const { |
| return all_nullable_types_; |
| } |
| |
| void AllClassesWrapper::set_all_nullable_types( |
| const AllNullableTypes& value_arg) { |
| all_nullable_types_ = value_arg; |
| } |
| |
| const AllTypes* AllClassesWrapper::all_types() const { |
| return all_types_ ? &(*all_types_) : nullptr; |
| } |
| |
| void AllClassesWrapper::set_all_types(const AllTypes* value_arg) { |
| all_types_ = value_arg ? std::optional<AllTypes>(*value_arg) : std::nullopt; |
| } |
| |
| void AllClassesWrapper::set_all_types(const AllTypes& value_arg) { |
| all_types_ = value_arg; |
| } |
| |
| EncodableList AllClassesWrapper::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(2); |
| list.push_back(EncodableValue(all_nullable_types_.ToEncodableList())); |
| list.push_back(all_types_ ? EncodableValue(all_types_->ToEncodableList()) |
| : EncodableValue()); |
| return list; |
| } |
| |
| AllClassesWrapper AllClassesWrapper::FromEncodableList( |
| const EncodableList& list) { |
| AllClassesWrapper decoded( |
| AllNullableTypes::FromEncodableList(std::get<EncodableList>(list[0]))); |
| auto& encodable_all_types = list[1]; |
| if (!encodable_all_types.IsNull()) { |
| decoded.set_all_types(AllTypes::FromEncodableList( |
| std::get<EncodableList>(encodable_all_types))); |
| } |
| return decoded; |
| } |
| |
| // TestMessage |
| |
| TestMessage::TestMessage() {} |
| |
| TestMessage::TestMessage(const EncodableList* test_list) |
| : test_list_(test_list ? std::optional<EncodableList>(*test_list) |
| : std::nullopt) {} |
| |
| const EncodableList* TestMessage::test_list() const { |
| return test_list_ ? &(*test_list_) : nullptr; |
| } |
| |
| void TestMessage::set_test_list(const EncodableList* value_arg) { |
| test_list_ = |
| value_arg ? std::optional<EncodableList>(*value_arg) : std::nullopt; |
| } |
| |
| void TestMessage::set_test_list(const EncodableList& value_arg) { |
| test_list_ = value_arg; |
| } |
| |
| EncodableList TestMessage::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(1); |
| list.push_back(test_list_ ? EncodableValue(*test_list_) : EncodableValue()); |
| return list; |
| } |
| |
| TestMessage TestMessage::FromEncodableList(const EncodableList& list) { |
| TestMessage decoded; |
| auto& encodable_test_list = list[0]; |
| if (!encodable_test_list.IsNull()) { |
| decoded.set_test_list(std::get<EncodableList>(encodable_test_list)); |
| } |
| return decoded; |
| } |
| |
| HostIntegrationCoreApiCodecSerializer::HostIntegrationCoreApiCodecSerializer() { |
| } |
| |
| EncodableValue HostIntegrationCoreApiCodecSerializer::ReadValueOfType( |
| uint8_t type, flutter::ByteStreamReader* stream) const { |
| switch (type) { |
| case 128: |
| return CustomEncodableValue(AllClassesWrapper::FromEncodableList( |
| std::get<EncodableList>(ReadValue(stream)))); |
| case 129: |
| return CustomEncodableValue(AllNullableTypes::FromEncodableList( |
| std::get<EncodableList>(ReadValue(stream)))); |
| case 130: |
| return CustomEncodableValue(AllTypes::FromEncodableList( |
| std::get<EncodableList>(ReadValue(stream)))); |
| case 131: |
| return CustomEncodableValue(TestMessage::FromEncodableList( |
| std::get<EncodableList>(ReadValue(stream)))); |
| default: |
| return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); |
| } |
| } |
| |
| void HostIntegrationCoreApiCodecSerializer::WriteValue( |
| const EncodableValue& value, flutter::ByteStreamWriter* stream) const { |
| if (const CustomEncodableValue* custom_value = |
| std::get_if<CustomEncodableValue>(&value)) { |
| if (custom_value->type() == typeid(AllClassesWrapper)) { |
| stream->WriteByte(128); |
| WriteValue(EncodableValue(std::any_cast<AllClassesWrapper>(*custom_value) |
| .ToEncodableList()), |
| stream); |
| return; |
| } |
| if (custom_value->type() == typeid(AllNullableTypes)) { |
| stream->WriteByte(129); |
| WriteValue( |
| EncodableValue( |
| std::any_cast<AllNullableTypes>(*custom_value).ToEncodableList()), |
| stream); |
| return; |
| } |
| if (custom_value->type() == typeid(AllTypes)) { |
| stream->WriteByte(130); |
| WriteValue(EncodableValue( |
| std::any_cast<AllTypes>(*custom_value).ToEncodableList()), |
| stream); |
| return; |
| } |
| if (custom_value->type() == typeid(TestMessage)) { |
| stream->WriteByte(131); |
| WriteValue( |
| EncodableValue( |
| std::any_cast<TestMessage>(*custom_value).ToEncodableList()), |
| stream); |
| return; |
| } |
| } |
| flutter::StandardCodecSerializer::WriteValue(value, stream); |
| } |
| |
| /// The codec used by HostIntegrationCoreApi. |
| const flutter::StandardMessageCodec& HostIntegrationCoreApi::GetCodec() { |
| return flutter::StandardMessageCodec::GetInstance( |
| &HostIntegrationCoreApiCodecSerializer::GetInstance()); |
| } |
| |
| // Sets up an instance of `HostIntegrationCoreApi` to handle messages through |
| // the `binary_messenger`. |
| void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, |
| HostIntegrationCoreApi* api) { |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "noop", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| std::optional<FlutterError> output = api->Noop(); |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAllTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| if (encodable_everything_arg.IsNull()) { |
| reply(WrapError("everything_arg unexpectedly null.")); |
| return; |
| } |
| const auto& everything_arg = std::any_cast<const AllTypes&>( |
| std::get<CustomEncodableValue>(encodable_everything_arg)); |
| ErrorOr<AllTypes> output = api->EchoAllTypes(everything_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "throwError", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| ErrorOr<std::optional<EncodableValue>> output = api->ThrowError(); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "throwErrorFromVoid", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| std::optional<FlutterError> output = api->ThrowErrorFromVoid(); |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "throwFlutterError", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| ErrorOr<std::optional<EncodableValue>> output = |
| api->ThrowFlutterError(); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| if (encodable_an_int_arg.IsNull()) { |
| reply(WrapError("an_int_arg unexpectedly null.")); |
| return; |
| } |
| const int64_t an_int_arg = encodable_an_int_arg.LongValue(); |
| ErrorOr<int64_t> output = api->EchoInt(an_int_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| if (encodable_a_double_arg.IsNull()) { |
| reply(WrapError("a_double_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_double_arg = |
| std::get<double>(encodable_a_double_arg); |
| ErrorOr<double> output = api->EchoDouble(a_double_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| if (encodable_a_bool_arg.IsNull()) { |
| reply(WrapError("a_bool_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_bool_arg = std::get<bool>(encodable_a_bool_arg); |
| ErrorOr<bool> output = api->EchoBool(a_bool_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| if (encodable_a_string_arg.IsNull()) { |
| reply(WrapError("a_string_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_string_arg = |
| std::get<std::string>(encodable_a_string_arg); |
| ErrorOr<std::string> output = api->EchoString(a_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_uint8_list_arg = args.at(0); |
| if (encodable_a_uint8_list_arg.IsNull()) { |
| reply(WrapError("a_uint8_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_uint8_list_arg = |
| std::get<std::vector<uint8_t>>(encodable_a_uint8_list_arg); |
| ErrorOr<std::vector<uint8_t>> output = |
| api->EchoUint8List(a_uint8_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_object_arg = args.at(0); |
| if (encodable_an_object_arg.IsNull()) { |
| reply(WrapError("an_object_arg unexpectedly null.")); |
| return; |
| } |
| const auto& an_object_arg = encodable_an_object_arg; |
| ErrorOr<EncodableValue> output = api->EchoObject(an_object_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| if (encodable_a_list_arg.IsNull()) { |
| reply(WrapError("a_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_list_arg = |
| std::get<EncodableList>(encodable_a_list_arg); |
| ErrorOr<EncodableList> output = api->EchoList(a_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| if (encodable_a_map_arg.IsNull()) { |
| reply(WrapError("a_map_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_map_arg = |
| std::get<EncodableMap>(encodable_a_map_arg); |
| ErrorOr<EncodableMap> output = api->EchoMap(a_map_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoClassWrapper", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_wrapper_arg = args.at(0); |
| if (encodable_wrapper_arg.IsNull()) { |
| reply(WrapError("wrapper_arg unexpectedly null.")); |
| return; |
| } |
| const auto& wrapper_arg = std::any_cast<const AllClassesWrapper&>( |
| std::get<CustomEncodableValue>(encodable_wrapper_arg)); |
| ErrorOr<AllClassesWrapper> output = |
| api->EchoClassWrapper(wrapper_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoEnum", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_enum_arg = args.at(0); |
| if (encodable_an_enum_arg.IsNull()) { |
| reply(WrapError("an_enum_arg unexpectedly null.")); |
| return; |
| } |
| const AnEnum& an_enum_arg = |
| (AnEnum)encodable_an_enum_arg.LongValue(); |
| ErrorOr<AnEnum> output = api->EchoEnum(an_enum_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue((int)std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAllNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| const auto* everything_arg = |
| &(std::any_cast<const AllNullableTypes&>( |
| std::get<CustomEncodableValue>( |
| encodable_everything_arg))); |
| ErrorOr<std::optional<AllNullableTypes>> output = |
| api->EchoAllNullableTypes(everything_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "extractNestedNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_wrapper_arg = args.at(0); |
| if (encodable_wrapper_arg.IsNull()) { |
| reply(WrapError("wrapper_arg unexpectedly null.")); |
| return; |
| } |
| const auto& wrapper_arg = std::any_cast<const AllClassesWrapper&>( |
| std::get<CustomEncodableValue>(encodable_wrapper_arg)); |
| ErrorOr<std::optional<std::string>> output = |
| api->ExtractNestedNullableString(wrapper_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "createNestedNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_nullable_string_arg = args.at(0); |
| const auto* nullable_string_arg = |
| std::get_if<std::string>(&encodable_nullable_string_arg); |
| ErrorOr<AllClassesWrapper> output = |
| api->CreateNestedNullableString(nullable_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "sendMultipleNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_bool_arg = args.at(0); |
| const auto* a_nullable_bool_arg = |
| std::get_if<bool>(&encodable_a_nullable_bool_arg); |
| const auto& encodable_a_nullable_int_arg = args.at(1); |
| const int64_t a_nullable_int_arg_value = |
| encodable_a_nullable_int_arg.IsNull() |
| ? 0 |
| : encodable_a_nullable_int_arg.LongValue(); |
| const auto* a_nullable_int_arg = |
| encodable_a_nullable_int_arg.IsNull() |
| ? nullptr |
| : &a_nullable_int_arg_value; |
| const auto& encodable_a_nullable_string_arg = args.at(2); |
| const auto* a_nullable_string_arg = |
| std::get_if<std::string>(&encodable_a_nullable_string_arg); |
| ErrorOr<AllNullableTypes> output = api->SendMultipleNullableTypes( |
| a_nullable_bool_arg, a_nullable_int_arg, |
| a_nullable_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_int_arg = args.at(0); |
| const int64_t a_nullable_int_arg_value = |
| encodable_a_nullable_int_arg.IsNull() |
| ? 0 |
| : encodable_a_nullable_int_arg.LongValue(); |
| const auto* a_nullable_int_arg = |
| encodable_a_nullable_int_arg.IsNull() |
| ? nullptr |
| : &a_nullable_int_arg_value; |
| ErrorOr<std::optional<int64_t>> output = |
| api->EchoNullableInt(a_nullable_int_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_double_arg = args.at(0); |
| const auto* a_nullable_double_arg = |
| std::get_if<double>(&encodable_a_nullable_double_arg); |
| ErrorOr<std::optional<double>> output = |
| api->EchoNullableDouble(a_nullable_double_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_bool_arg = args.at(0); |
| const auto* a_nullable_bool_arg = |
| std::get_if<bool>(&encodable_a_nullable_bool_arg); |
| ErrorOr<std::optional<bool>> output = |
| api->EchoNullableBool(a_nullable_bool_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_string_arg = args.at(0); |
| const auto* a_nullable_string_arg = |
| std::get_if<std::string>(&encodable_a_nullable_string_arg); |
| ErrorOr<std::optional<std::string>> output = |
| api->EchoNullableString(a_nullable_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_uint8_list_arg = args.at(0); |
| const auto* a_nullable_uint8_list_arg = |
| std::get_if<std::vector<uint8_t>>( |
| &encodable_a_nullable_uint8_list_arg); |
| ErrorOr<std::optional<std::vector<uint8_t>>> output = |
| api->EchoNullableUint8List(a_nullable_uint8_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_object_arg = args.at(0); |
| const auto* a_nullable_object_arg = |
| &encodable_a_nullable_object_arg; |
| ErrorOr<std::optional<EncodableValue>> output = |
| api->EchoNullableObject(a_nullable_object_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_list_arg = args.at(0); |
| const auto* a_nullable_list_arg = |
| std::get_if<EncodableList>(&encodable_a_nullable_list_arg); |
| ErrorOr<std::optional<EncodableList>> output = |
| api->EchoNullableList(a_nullable_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_map_arg = args.at(0); |
| const auto* a_nullable_map_arg = |
| std::get_if<EncodableMap>(&encodable_a_nullable_map_arg); |
| ErrorOr<std::optional<EncodableMap>> output = |
| api->EchoNullableMap(a_nullable_map_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoNullableEnum", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_enum_arg = args.at(0); |
| const int64_t an_enum_arg_value = |
| encodable_an_enum_arg.IsNull() |
| ? 0 |
| : encodable_an_enum_arg.LongValue(); |
| const auto an_enum_arg = |
| encodable_an_enum_arg.IsNull() |
| ? std::nullopt |
| : std::make_optional<AnEnum>( |
| static_cast<AnEnum>(an_enum_arg_value)); |
| ErrorOr<std::optional<AnEnum>> output = api->EchoNullableEnum( |
| an_enum_arg ? &(*an_enum_arg) : nullptr); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue((int)std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "noopAsync", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->NoopAsync([reply](std::optional<FlutterError>&& output) { |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| if (encodable_an_int_arg.IsNull()) { |
| reply(WrapError("an_int_arg unexpectedly null.")); |
| return; |
| } |
| const int64_t an_int_arg = encodable_an_int_arg.LongValue(); |
| api->EchoAsyncInt(an_int_arg, [reply](ErrorOr<int64_t>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| if (encodable_a_double_arg.IsNull()) { |
| reply(WrapError("a_double_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_double_arg = |
| std::get<double>(encodable_a_double_arg); |
| api->EchoAsyncDouble( |
| a_double_arg, [reply](ErrorOr<double>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| if (encodable_a_bool_arg.IsNull()) { |
| reply(WrapError("a_bool_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_bool_arg = std::get<bool>(encodable_a_bool_arg); |
| api->EchoAsyncBool(a_bool_arg, [reply](ErrorOr<bool>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| if (encodable_a_string_arg.IsNull()) { |
| reply(WrapError("a_string_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_string_arg = |
| std::get<std::string>(encodable_a_string_arg); |
| api->EchoAsyncString( |
| a_string_arg, [reply](ErrorOr<std::string>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_uint8_list_arg = args.at(0); |
| if (encodable_a_uint8_list_arg.IsNull()) { |
| reply(WrapError("a_uint8_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_uint8_list_arg = |
| std::get<std::vector<uint8_t>>(encodable_a_uint8_list_arg); |
| api->EchoAsyncUint8List( |
| a_uint8_list_arg, |
| [reply](ErrorOr<std::vector<uint8_t>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_object_arg = args.at(0); |
| if (encodable_an_object_arg.IsNull()) { |
| reply(WrapError("an_object_arg unexpectedly null.")); |
| return; |
| } |
| const auto& an_object_arg = encodable_an_object_arg; |
| api->EchoAsyncObject( |
| an_object_arg, [reply](ErrorOr<EncodableValue>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| if (encodable_a_list_arg.IsNull()) { |
| reply(WrapError("a_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_list_arg = |
| std::get<EncodableList>(encodable_a_list_arg); |
| api->EchoAsyncList( |
| a_list_arg, [reply](ErrorOr<EncodableList>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| if (encodable_a_map_arg.IsNull()) { |
| reply(WrapError("a_map_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_map_arg = |
| std::get<EncodableMap>(encodable_a_map_arg); |
| api->EchoAsyncMap( |
| a_map_arg, [reply](ErrorOr<EncodableMap>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncEnum", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_enum_arg = args.at(0); |
| if (encodable_an_enum_arg.IsNull()) { |
| reply(WrapError("an_enum_arg unexpectedly null.")); |
| return; |
| } |
| const AnEnum& an_enum_arg = |
| (AnEnum)encodable_an_enum_arg.LongValue(); |
| api->EchoAsyncEnum( |
| an_enum_arg, [reply](ErrorOr<AnEnum>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue((int)std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "throwAsyncError", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->ThrowAsyncError( |
| [reply](ErrorOr<std::optional<EncodableValue>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "throwAsyncErrorFromVoid", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->ThrowAsyncErrorFromVoid( |
| [reply](std::optional<FlutterError>&& output) { |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "throwAsyncFlutterError", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->ThrowAsyncFlutterError( |
| [reply](ErrorOr<std::optional<EncodableValue>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncAllTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| if (encodable_everything_arg.IsNull()) { |
| reply(WrapError("everything_arg unexpectedly null.")); |
| return; |
| } |
| const auto& everything_arg = std::any_cast<const AllTypes&>( |
| std::get<CustomEncodableValue>(encodable_everything_arg)); |
| api->EchoAsyncAllTypes( |
| everything_arg, [reply](ErrorOr<AllTypes>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableAllNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| const auto* everything_arg = |
| &(std::any_cast<const AllNullableTypes&>( |
| std::get<CustomEncodableValue>( |
| encodable_everything_arg))); |
| api->EchoAsyncNullableAllNullableTypes( |
| everything_arg, |
| [reply](ErrorOr<std::optional<AllNullableTypes>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back(CustomEncodableValue( |
| std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| const int64_t an_int_arg_value = |
| encodable_an_int_arg.IsNull() |
| ? 0 |
| : encodable_an_int_arg.LongValue(); |
| const auto* an_int_arg = |
| encodable_an_int_arg.IsNull() ? nullptr : &an_int_arg_value; |
| api->EchoAsyncNullableInt( |
| an_int_arg, |
| [reply](ErrorOr<std::optional<int64_t>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| const auto* a_double_arg = |
| std::get_if<double>(&encodable_a_double_arg); |
| api->EchoAsyncNullableDouble( |
| a_double_arg, |
| [reply](ErrorOr<std::optional<double>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| const auto* a_bool_arg = std::get_if<bool>(&encodable_a_bool_arg); |
| api->EchoAsyncNullableBool( |
| a_bool_arg, [reply](ErrorOr<std::optional<bool>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| const auto* a_string_arg = |
| std::get_if<std::string>(&encodable_a_string_arg); |
| api->EchoAsyncNullableString( |
| a_string_arg, |
| [reply](ErrorOr<std::optional<std::string>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_uint8_list_arg = args.at(0); |
| const auto* a_uint8_list_arg = std::get_if<std::vector<uint8_t>>( |
| &encodable_a_uint8_list_arg); |
| api->EchoAsyncNullableUint8List( |
| a_uint8_list_arg, |
| [reply]( |
| ErrorOr<std::optional<std::vector<uint8_t>>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_object_arg = args.at(0); |
| const auto* an_object_arg = &encodable_an_object_arg; |
| api->EchoAsyncNullableObject( |
| an_object_arg, |
| [reply](ErrorOr<std::optional<EncodableValue>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| const auto* a_list_arg = |
| std::get_if<EncodableList>(&encodable_a_list_arg); |
| api->EchoAsyncNullableList( |
| a_list_arg, |
| [reply](ErrorOr<std::optional<EncodableList>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| const auto* a_map_arg = |
| std::get_if<EncodableMap>(&encodable_a_map_arg); |
| api->EchoAsyncNullableMap( |
| a_map_arg, |
| [reply](ErrorOr<std::optional<EncodableMap>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "echoAsyncNullableEnum", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_enum_arg = args.at(0); |
| const int64_t an_enum_arg_value = |
| encodable_an_enum_arg.IsNull() |
| ? 0 |
| : encodable_an_enum_arg.LongValue(); |
| const auto an_enum_arg = |
| encodable_an_enum_arg.IsNull() |
| ? std::nullopt |
| : std::make_optional<AnEnum>( |
| static_cast<AnEnum>(an_enum_arg_value)); |
| api->EchoAsyncNullableEnum( |
| an_enum_arg ? &(*an_enum_arg) : nullptr, |
| [reply](ErrorOr<std::optional<AnEnum>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back(EncodableValue( |
| (int)std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." |
| "callFlutterNoop", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
|