| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include <fidl/test.anonymous/cpp/natural_types.h> |
| #include <lib/fidl/cpp/hlcpp_conversion.h> |
| #include <lib/fidl/cpp/wire/service_handler.h> |
| #include <test/anonymous/cpp/fidl.h> |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wshadow" |
| |
| namespace fidl { |
| namespace internal { |
| |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::Op> : public NaturalToHLCPPTraitsEnum<::test_anonymous::Op, ::test::anonymous::Op, uint32_t> {}; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::Op> : public HLCPPToNaturalTraitsEnum<::test::anonymous::Op, ::test_anonymous::Op> {}; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodError> : public NaturalToHLCPPTraitsEnum<::test_anonymous::SomeProtocolSomeMethodError, ::test::anonymous::SomeProtocol_SomeMethod_Error, uint32_t> {}; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::SomeProtocol_SomeMethod_Error> : public HLCPPToNaturalTraitsEnum<::test::anonymous::SomeProtocol_SomeMethod_Error, ::test_anonymous::SomeProtocolSomeMethodError> {}; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::Flags> : public NaturalToHLCPPTraitsBits<::test_anonymous::Flags, ::test::anonymous::Flags, uint16_t> {}; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::Flags> : public HLCPPToNaturalTraitsBits<::test::anonymous::Flags, ::test_anonymous::Flags, uint16_t> {}; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::BitsMember> : public NaturalToHLCPPTraitsBits<::test_anonymous::BitsMember, ::test::anonymous::BitsMember, uint32_t> {}; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::BitsMember> : public HLCPPToNaturalTraitsBits<::test::anonymous::BitsMember, ::test_anonymous::BitsMember, uint32_t> {}; |
| |
| template <> |
| struct NaturalToHLCPPTraits<fidl::ClientEnd<::test_anonymous::SomeProtocol>> { |
| using HLCPPType = fidl::InterfaceHandle<::test::anonymous::SomeProtocol>; |
| static inline fidl::InterfaceHandle<::test::anonymous::SomeProtocol> Convert(fidl::ClientEnd<::test_anonymous::SomeProtocol>&& c) { |
| return fidl::InterfaceHandle<::test::anonymous::SomeProtocol>(c.TakeChannel()); |
| } |
| }; |
| |
| template <> |
| struct NaturalToHLCPPTraits<fidl::ServerEnd<::test_anonymous::SomeProtocol>> { |
| using HLCPPType = fidl::InterfaceRequest<::test::anonymous::SomeProtocol>; |
| static inline fidl::InterfaceRequest<::test::anonymous::SomeProtocol> Convert(fidl::ServerEnd<::test_anonymous::SomeProtocol>&& c) { |
| return fidl::InterfaceRequest<::test::anonymous::SomeProtocol>(c.TakeChannel()); |
| } |
| }; |
| |
| template <> |
| struct HLCPPToNaturalTraits<fidl::InterfaceHandle<::test::anonymous::SomeProtocol>> { |
| using NaturalType = fidl::ClientEnd<::test_anonymous::SomeProtocol>; |
| static inline fidl::ClientEnd<::test_anonymous::SomeProtocol> Convert(fidl::InterfaceHandle<::test::anonymous::SomeProtocol>&& c) { |
| return fidl::ClientEnd<::test_anonymous::SomeProtocol>(c.TakeChannel()); |
| } |
| }; |
| |
| template <> |
| struct HLCPPToNaturalTraits<fidl::InterfaceRequest<::test::anonymous::SomeProtocol>> { |
| using NaturalType = fidl::ServerEnd<::test_anonymous::SomeProtocol>; |
| static inline fidl::ServerEnd<::test_anonymous::SomeProtocol> Convert(fidl::InterfaceRequest<::test::anonymous::SomeProtocol>&& c) { |
| return fidl::ServerEnd<::test_anonymous::SomeProtocol>(c.TakeChannel()); |
| } |
| }; |
| |
| template <> |
| struct NaturalToHLCPPTraits<fidl::ProtocolHandler<::test_anonymous::SomeProtocol>> { |
| using HLCPPType = fidl::InterfaceRequestHandler<::test::anonymous::SomeProtocol>; |
| static inline fidl::InterfaceRequestHandler<::test::anonymous::SomeProtocol> Convert(fidl::ProtocolHandler<::test_anonymous::SomeProtocol>&& c) { |
| return [c = std::move(c)](fidl::InterfaceRequest<::test::anonymous::SomeProtocol> r) { |
| c(::fidl::HLCPPToNatural(r)); |
| }; |
| } |
| }; |
| |
| template <> |
| struct HLCPPToNaturalTraits<fidl::InterfaceRequestHandler<::test::anonymous::SomeProtocol>> { |
| using NaturalType = fidl::ProtocolHandler<::test_anonymous::SomeProtocol>; |
| static inline fidl::ProtocolHandler<::test_anonymous::SomeProtocol> Convert(fidl::InterfaceRequestHandler<::test::anonymous::SomeProtocol>&& c) { |
| return [c = std::move(c)](fidl::ServerEnd<::test_anonymous::SomeProtocol> r) { |
| c(::fidl::NaturalToHLCPP(r)); |
| }; |
| } |
| }; |
| |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::OverrideTest> { |
| using HLCPPType = ::test::anonymous::OverrideTest; |
| static inline ::test::anonymous::OverrideTest Convert(::test_anonymous::OverrideTest&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::OverrideTest> { |
| using NaturalType = ::test_anonymous::OverrideTest; |
| static inline ::test_anonymous::OverrideTest Convert(::test::anonymous::OverrideTest&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::TableData> { |
| using HLCPPType = ::test::anonymous::TableData; |
| static inline ::test::anonymous::TableData Convert(::test_anonymous::TableData&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::TableData> { |
| using NaturalType = ::test_anonymous::TableData; |
| static inline ::test_anonymous::TableData Convert(::test::anonymous::TableData&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodRequest> { |
| using HLCPPType = ::test::anonymous::SomeProtocolSomeMethodRequest; |
| static inline ::test::anonymous::SomeProtocolSomeMethodRequest Convert(::test_anonymous::SomeProtocolSomeMethodRequest&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::SomeProtocolSomeMethodRequest> { |
| using NaturalType = ::test_anonymous::SomeProtocolSomeMethodRequest; |
| static inline ::test_anonymous::SomeProtocolSomeMethodRequest Convert(::test::anonymous::SomeProtocolSomeMethodRequest&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodResponse> { |
| using HLCPPType = ::test::anonymous::SomeProtocol_SomeMethod_Response; |
| static inline ::test::anonymous::SomeProtocol_SomeMethod_Response Convert(::test_anonymous::SomeProtocolSomeMethodResponse&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::SomeProtocol_SomeMethod_Response> { |
| using NaturalType = ::test_anonymous::SomeProtocolSomeMethodResponse; |
| static inline ::test_anonymous::SomeProtocolSomeMethodResponse Convert(::test::anonymous::SomeProtocol_SomeMethod_Response&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::FunctionApplication> { |
| using HLCPPType = ::test::anonymous::FunctionApplication; |
| static inline ::test::anonymous::FunctionApplication Convert(::test_anonymous::FunctionApplication&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::FunctionApplication> { |
| using NaturalType = ::test_anonymous::FunctionApplication; |
| static inline ::test_anonymous::FunctionApplication Convert(::test::anonymous::FunctionApplication&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::TableMember> { |
| using HLCPPType = ::test::anonymous::TableMember; |
| static inline ::test::anonymous::TableMember Convert(::test_anonymous::TableMember&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::TableMember> { |
| using NaturalType = ::test_anonymous::TableMember; |
| static inline ::test_anonymous::TableMember Convert(::test::anonymous::TableMember&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::Expression> { |
| using HLCPPType = ::test::anonymous::Expression; |
| static inline ::test::anonymous::Expression Convert(::test_anonymous::Expression&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::Expression> { |
| using NaturalType = ::test_anonymous::Expression; |
| static inline ::test_anonymous::Expression Convert(::test::anonymous::Expression&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::UnionMember> { |
| using HLCPPType = ::test::anonymous::UnionMember; |
| static inline ::test::anonymous::UnionMember Convert(::test_anonymous::UnionMember&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::UnionMember> { |
| using NaturalType = ::test_anonymous::UnionMember; |
| static inline ::test_anonymous::UnionMember Convert(::test::anonymous::UnionMember&&); |
| }; |
| template <> |
| struct NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodResult> { |
| using HLCPPType = ::test::anonymous::SomeProtocol_SomeMethod_Result; |
| static inline ::test::anonymous::SomeProtocol_SomeMethod_Result Convert(::test_anonymous::SomeProtocolSomeMethodResult&&); |
| }; |
| template <> |
| struct HLCPPToNaturalTraits<::test::anonymous::SomeProtocol_SomeMethod_Result> { |
| using NaturalType = ::test_anonymous::SomeProtocolSomeMethodResult; |
| static inline ::test_anonymous::SomeProtocolSomeMethodResult Convert(::test::anonymous::SomeProtocol_SomeMethod_Result&&); |
| }; |
| |
| ::test::anonymous::OverrideTest NaturalToHLCPPTraits<::test_anonymous::OverrideTest>::Convert(::test_anonymous::OverrideTest&& value) { |
| ::test::anonymous::OverrideTest hlcpp; |
| hlcpp.op = ::fidl::NaturalToHLCPP(std::move(value.op())); |
| hlcpp.left = ::fidl::NaturalToHLCPP(std::move(value.left())); |
| hlcpp.right = ::fidl::NaturalToHLCPP(std::move(value.right())); |
| return hlcpp; |
| } |
| |
| ::test_anonymous::OverrideTest HLCPPToNaturalTraits<::test::anonymous::OverrideTest>::Convert(::test::anonymous::OverrideTest&& value) { |
| return ::test_anonymous::OverrideTest{{ |
| .op = ::fidl::HLCPPToNatural(std::move(value.op)), |
| .left = ::fidl::HLCPPToNatural(std::move(value.left)), |
| .right = ::fidl::HLCPPToNatural(std::move(value.right)), |
| }}; |
| } |
| ::test::anonymous::TableData NaturalToHLCPPTraits<::test_anonymous::TableData>::Convert(::test_anonymous::TableData&& value) { |
| ::test::anonymous::TableData hlcpp; |
| hlcpp.data = ::fidl::NaturalToHLCPP(std::move(value.data())); |
| return hlcpp; |
| } |
| |
| ::test_anonymous::TableData HLCPPToNaturalTraits<::test::anonymous::TableData>::Convert(::test::anonymous::TableData&& value) { |
| return ::test_anonymous::TableData{{ |
| .data = ::fidl::HLCPPToNatural(std::move(value.data)), |
| }}; |
| } |
| ::test::anonymous::SomeProtocolSomeMethodRequest NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodRequest>::Convert(::test_anonymous::SomeProtocolSomeMethodRequest&& value) { |
| ::test::anonymous::SomeProtocolSomeMethodRequest hlcpp; |
| hlcpp.union_member = ::fidl::NaturalToHLCPP(std::move(value.union_member())); |
| hlcpp.table_member = ::fidl::NaturalToHLCPP(std::move(value.table_member())); |
| return hlcpp; |
| } |
| |
| ::test_anonymous::SomeProtocolSomeMethodRequest HLCPPToNaturalTraits<::test::anonymous::SomeProtocolSomeMethodRequest>::Convert(::test::anonymous::SomeProtocolSomeMethodRequest&& value) { |
| return ::test_anonymous::SomeProtocolSomeMethodRequest{{ |
| .union_member = ::fidl::HLCPPToNatural(std::move(value.union_member)), |
| .table_member = ::fidl::HLCPPToNatural(std::move(value.table_member)), |
| }}; |
| } |
| ::test::anonymous::SomeProtocol_SomeMethod_Response NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodResponse>::Convert(::test_anonymous::SomeProtocolSomeMethodResponse&& value) { |
| ::test::anonymous::SomeProtocol_SomeMethod_Response hlcpp; |
| hlcpp.bits_member = ::fidl::NaturalToHLCPP(std::move(value.bits_member())); |
| return hlcpp; |
| } |
| |
| ::test_anonymous::SomeProtocolSomeMethodResponse HLCPPToNaturalTraits<::test::anonymous::SomeProtocol_SomeMethod_Response>::Convert(::test::anonymous::SomeProtocol_SomeMethod_Response&& value) { |
| return ::test_anonymous::SomeProtocolSomeMethodResponse{{ |
| .bits_member = ::fidl::HLCPPToNatural(std::move(value.bits_member)), |
| }}; |
| } |
| ::test::anonymous::FunctionApplication NaturalToHLCPPTraits<::test_anonymous::FunctionApplication>::Convert(::test_anonymous::FunctionApplication&& value) { |
| ::test::anonymous::FunctionApplication hlcpp; |
| if (value.func().has_value()) { |
| hlcpp.set_func(::fidl::NaturalToHLCPP(std::move(value.func().value()))); |
| } |
| if (value.args().has_value()) { |
| hlcpp.set_args(::fidl::NaturalToHLCPP(std::move(value.args().value()))); |
| } |
| if (value.flags().has_value()) { |
| hlcpp.set_flags(::fidl::NaturalToHLCPP(std::move(value.flags().value()))); |
| } |
| return hlcpp; |
| } |
| |
| ::test_anonymous::FunctionApplication HLCPPToNaturalTraits<::test::anonymous::FunctionApplication>::Convert(::test::anonymous::FunctionApplication&& value) { |
| ::test_anonymous::FunctionApplication natural; |
| if (value.has_func()) { |
| natural.func() = ::fidl::HLCPPToNatural(std::move(*value.mutable_func())); |
| } |
| if (value.has_args()) { |
| natural.args() = ::fidl::HLCPPToNatural(std::move(*value.mutable_args())); |
| } |
| if (value.has_flags()) { |
| natural.flags() = ::fidl::HLCPPToNatural(std::move(*value.mutable_flags())); |
| } |
| return natural; |
| } |
| ::test::anonymous::TableMember NaturalToHLCPPTraits<::test_anonymous::TableMember>::Convert(::test_anonymous::TableMember&& value) { |
| ::test::anonymous::TableMember hlcpp; |
| if (value.table_data().has_value()) { |
| hlcpp.set_table_data(::fidl::NaturalToHLCPP(std::move(value.table_data().value()))); |
| } |
| return hlcpp; |
| } |
| |
| ::test_anonymous::TableMember HLCPPToNaturalTraits<::test::anonymous::TableMember>::Convert(::test::anonymous::TableMember&& value) { |
| ::test_anonymous::TableMember natural; |
| if (value.has_table_data()) { |
| natural.table_data() = ::fidl::HLCPPToNatural(std::move(*value.mutable_table_data())); |
| } |
| return natural; |
| } |
| |
| ::test::anonymous::Expression NaturalToHLCPPTraits<::test_anonymous::Expression>::Convert(::test_anonymous::Expression&& value) { |
| ::test::anonymous::Expression hlcpp; |
| switch (value.Which()) { |
| case ::test_anonymous::Expression::Tag::kValue: |
| hlcpp.set_value(::fidl::NaturalToHLCPP(std::move(value.value().value()))); |
| break; |
| case ::test_anonymous::Expression::Tag::kBinOp: |
| hlcpp.set_bin_op(::fidl::NaturalToHLCPP(std::move(value.bin_op().value()))); |
| break; |
| case ::test_anonymous::Expression::Tag::kFunctionApplication: |
| hlcpp.set_function_application(::fidl::NaturalToHLCPP(std::move(value.function_application().value()))); |
| break; |
| default: |
| break; |
| } |
| return hlcpp; |
| } |
| |
| ::test_anonymous::Expression HLCPPToNaturalTraits<::test::anonymous::Expression>::Convert(::test::anonymous::Expression&& value) { |
| using _NaturalUnion = ::test_anonymous::Expression; |
| switch (value.Which()) { |
| case ::test::anonymous::Expression::Tag::kValue: |
| return _NaturalUnion::WithValue( |
| ::fidl::HLCPPToNatural(std::move(value.value()))); |
| case ::test::anonymous::Expression::Tag::kBinOp: |
| return _NaturalUnion::WithBinOp( |
| ::fidl::HLCPPToNatural(std::move(value.bin_op()))); |
| case ::test::anonymous::Expression::Tag::kFunctionApplication: |
| return _NaturalUnion::WithFunctionApplication( |
| ::fidl::HLCPPToNatural(std::move(value.function_application()))); |
| default: |
| return _NaturalUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}); |
| } |
| } |
| ::test::anonymous::UnionMember NaturalToHLCPPTraits<::test_anonymous::UnionMember>::Convert(::test_anonymous::UnionMember&& value) { |
| ::test::anonymous::UnionMember hlcpp; |
| switch (value.Which()) { |
| case ::test_anonymous::UnionMember::Tag::kUnionData: |
| hlcpp.set_union_data(::fidl::NaturalToHLCPP(std::move(value.union_data().value()))); |
| break; |
| default: |
| break; |
| } |
| return hlcpp; |
| } |
| |
| ::test_anonymous::UnionMember HLCPPToNaturalTraits<::test::anonymous::UnionMember>::Convert(::test::anonymous::UnionMember&& value) { |
| using _NaturalUnion = ::test_anonymous::UnionMember; |
| switch (value.Which()) { |
| case ::test::anonymous::UnionMember::Tag::kUnionData: |
| return _NaturalUnion::WithUnionData( |
| ::fidl::HLCPPToNatural(std::move(value.union_data()))); |
| default: |
| return _NaturalUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}); |
| } |
| } |
| ::test::anonymous::SomeProtocol_SomeMethod_Result NaturalToHLCPPTraits<::test_anonymous::SomeProtocolSomeMethodResult>::Convert(::test_anonymous::SomeProtocolSomeMethodResult&& value) { |
| ::test::anonymous::SomeProtocol_SomeMethod_Result hlcpp; |
| switch (value.Which()) { |
| case ::test_anonymous::SomeProtocolSomeMethodResult::Tag::kResponse: |
| hlcpp.set_response(::fidl::NaturalToHLCPP(std::move(value.response().value()))); |
| break; |
| case ::test_anonymous::SomeProtocolSomeMethodResult::Tag::kErr: |
| hlcpp.set_err(::fidl::NaturalToHLCPP(std::move(value.err().value()))); |
| break; |
| default: |
| break; |
| } |
| return hlcpp; |
| } |
| |
| ::test_anonymous::SomeProtocolSomeMethodResult HLCPPToNaturalTraits<::test::anonymous::SomeProtocol_SomeMethod_Result>::Convert(::test::anonymous::SomeProtocol_SomeMethod_Result&& value) { |
| using _NaturalUnion = ::test_anonymous::SomeProtocolSomeMethodResult; |
| switch (value.Which()) { |
| case ::test::anonymous::SomeProtocol_SomeMethod_Result::Tag::kResponse: |
| return _NaturalUnion::WithResponse( |
| ::fidl::HLCPPToNatural(std::move(value.response()))); |
| case ::test::anonymous::SomeProtocol_SomeMethod_Result::Tag::kErr: |
| return _NaturalUnion::WithErr( |
| ::fidl::HLCPPToNatural(std::move(value.err()))); |
| default: |
| ZX_PANIC("Can't convert invalid strict union %s from HLCPP to Natural", "::test::anonymous::SomeProtocol_SomeMethod_Result"); |
| } |
| } |
| |
| #pragma clang diagnostic pop |
| |
| } // namespace internal |
| } // namespace fidl |