| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <fidl/test.errorsyntax/cpp/common_types.h> |
| #include <fidl/test.errorsyntax/cpp/markers.h> |
| #include <lib/fidl/cpp/natural_coding_traits.h> |
| #include <lib/fidl/cpp/natural_types.h> |
| |
| #include <cinttypes> |
| #include <string> |
| |
| #ifdef __Fuchsia__ |
| |
| #include <lib/zx/channel.h> |
| |
| #endif // __Fuchsia__ |
| |
| #include <fidl/test.errorsyntax.parent/cpp/natural_types.h> |
| |
| namespace test_errorsyntax { |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResponse; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailRequest; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResult; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResponse { |
| private: |
| struct Storage_; |
| |
| public: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse(Storage_ storage) noexcept |
| : storage_(std::move(storage)) {} |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse(int64_t value) noexcept |
| : storage_({.value = std::move(value)}) {} |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |ExampleUseOfErrorSyntaxCallWhichMayFailResponse| only |
| // if all of its members are default constructible. |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse() = default; |
| #pragma clang diagnostic pop |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse( |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse&&) noexcept = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse& operator=( |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse&&) noexcept = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailResponse& other) noexcept |
| : ExampleUseOfErrorSyntaxCallWhichMayFailResponse(other.CloneStorage_()) { |
| } |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse& operator=( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailResponse& other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| bool operator==(const ExampleUseOfErrorSyntaxCallWhichMayFailResponse& other) |
| const noexcept { |
| return ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, |
| 8>::Equal(this, &other); |
| } |
| bool operator!=(const ExampleUseOfErrorSyntaxCallWhichMayFailResponse& other) |
| const noexcept { |
| return !::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, |
| 8>::Equal(this, &other); |
| } |
| |
| int64_t value() const { return storage_.value; } |
| |
| int64_t& value() { return storage_.value; } |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse( |
| ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) |
| : ExampleUseOfErrorSyntaxCallWhichMayFailResponse(Storage_{ |
| .value = {}, |
| }) {} |
| |
| private: |
| struct Storage_ final { |
| int64_t value = {}; |
| }; |
| |
| Storage_ storage_; |
| Storage_ CloneStorage_() const; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, 8>; |
| friend struct ::fidl::internal::MemberVisitor< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse>; |
| static constexpr auto kMembers = std::make_tuple( |
| ::fidl::internal::NaturalStructMember< |
| Storage_, int64_t, fidl::internal::NaturalCodingConstraintEmpty>{ |
| &Storage_::value, 0}); |
| static constexpr auto kPadding = std::make_tuple(); |
| }; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResult { |
| private: |
| using Storage_ = std::variant< |
| std::monostate, |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, |
| uint32_t>; |
| |
| public: |
| // TODO: share union tag types between wire & natural. |
| enum class Tag : fidl_union_tag_t { |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult&& other) noexcept |
| : ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}) { |
| *storage_ = std::move(*other.storage_); |
| } |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult& operator=( |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult&& other) noexcept { |
| if (this != &other) { |
| *storage_ = std::move(*other.storage_); |
| } |
| return *this; |
| } |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailResult& other) noexcept |
| : ExampleUseOfErrorSyntaxCallWhichMayFailResult(other.CloneStorage_()) {} |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult& operator=( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailResult& other) noexcept { |
| if (this != &other) { |
| storage_ = other.CloneStorage_(); |
| } |
| return *this; |
| } |
| |
| bool operator==(const ExampleUseOfErrorSyntaxCallWhichMayFailResult& other) |
| const noexcept { |
| return *storage_ == *other.storage_; |
| } |
| bool operator!=(const ExampleUseOfErrorSyntaxCallWhichMayFailResult& other) |
| const noexcept { |
| return *storage_ != *other.storage_; |
| } |
| |
| constexpr ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult:: |
| Tag |
| Which() const { |
| return ExampleUseOfErrorSyntaxCallWhichMayFailResult::IndexToTag( |
| storage_->index()) |
| .value(); |
| } |
| static ExampleUseOfErrorSyntaxCallWhichMayFailResult WithResponse( |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse val) { |
| return ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| std::make_shared<Storage_>(std::in_place_index_t<1>{}, std::move(val))); |
| } |
| |
| const ::fidl::internal::UnionMemberView<1, Storage_> response() const { |
| return ::fidl::internal::UnionMemberView<1, Storage_>(storage_); |
| } |
| ::fidl::internal::UnionMemberView<1, Storage_> response() { |
| return ::fidl::internal::UnionMemberView<1, Storage_>(storage_); |
| } |
| static ExampleUseOfErrorSyntaxCallWhichMayFailResult WithErr(uint32_t val) { |
| return ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| std::make_shared<Storage_>(std::in_place_index_t<2>{}, std::move(val))); |
| } |
| |
| const ::fidl::internal::UnionMemberView<2, Storage_> err() const { |
| return ::fidl::internal::UnionMemberView<2, Storage_>(storage_); |
| } |
| ::fidl::internal::UnionMemberView<2, Storage_> err() { |
| return ::fidl::internal::UnionMemberView<2, Storage_>(storage_); |
| } |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) |
| : storage_(std::make_shared<Storage_>()) {} |
| |
| private: |
| std::shared_ptr<Storage_> storage_; |
| std::shared_ptr<Storage_> CloneStorage_() const; |
| friend struct ::fidl::internal::NaturalUnionCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult>; |
| static constexpr auto kMembers = |
| std::make_tuple(::fidl::internal::NaturalUnionMember< |
| ::fidl::internal::NaturalCodingConstraintEmpty>(), |
| ::fidl::internal::NaturalUnionMember< |
| fidl::internal::NaturalCodingConstraintEmpty>(), |
| ::fidl::internal::NaturalUnionMember< |
| fidl::internal::NaturalCodingConstraintEmpty>()); |
| |
| explicit ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| std::shared_ptr<Storage_> storage) |
| : storage_(std::move(storage)) {} |
| |
| static constexpr size_t TagToIndex( |
| ::fidl::internal::NaturalDecoder* decoder, |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult::Tag |
| tag) { |
| switch (tag) { |
| case ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult:: |
| Tag::kResponse: |
| return 1; |
| case ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult:: |
| Tag::kErr: |
| return 2; |
| default: { |
| decoder->SetError(::fidl::internal::kCodingErrorUnknownUnionTag); |
| return 0; |
| } |
| } |
| } |
| |
| static constexpr std::optional< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult::Tag> |
| IndexToTag(size_t index) { |
| switch (index) { |
| case 1: |
| return ::test_errorsyntax:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Tag::kResponse; |
| case 2: |
| return ::test_errorsyntax:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Tag::kErr; |
| default: |
| return std::nullopt; |
| } |
| } |
| }; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailTopResponseTable; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse { |
| private: |
| struct Storage_; |
| |
| public: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse(Storage_ storage) noexcept |
| : storage_(std::move(storage)) {} |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse( |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult |
| result) noexcept |
| : storage_({.result = std::move(result)}) {} |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse| |
| // only if all of its members are default constructible. |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse() = default; |
| #pragma clang diagnostic pop |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse( |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse&&) noexcept = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse& operator=( |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse&&) noexcept = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse& other) noexcept |
| : ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse( |
| other.CloneStorage_()) {} |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse& operator=( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse& |
| other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| bool operator==(const ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse& |
| other) const noexcept { |
| return ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse, |
| 16>::Equal(this, &other); |
| } |
| bool operator!=(const ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse& |
| other) const noexcept { |
| return !::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse, |
| 16>::Equal(this, &other); |
| } |
| |
| const ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult& |
| result() const { |
| return storage_.result; |
| } |
| |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult& result() { |
| return storage_.result; |
| } |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse( |
| ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) |
| : ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse(Storage_{ |
| .result = |
| ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}, |
| }) {} |
| |
| private: |
| struct Storage_ final { |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult result; |
| }; |
| |
| Storage_ storage_; |
| Storage_ CloneStorage_() const; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse, |
| 16>; |
| friend struct ::fidl::internal::MemberVisitor< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse>; |
| static constexpr auto kMembers = std::make_tuple( |
| ::fidl::internal::NaturalStructMember< |
| Storage_, |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult, |
| fidl::internal::NaturalCodingConstraintEmpty>{&Storage_::result, 0}); |
| static constexpr auto kPadding = std::make_tuple(); |
| }; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestTable; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailRequest { |
| private: |
| struct Storage_; |
| |
| public: |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest(Storage_ storage) noexcept |
| : storage_(std::move(storage)) {} |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest(::std::string s) noexcept |
| : storage_({.s = std::move(s)}) {} |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |ExampleUseOfErrorSyntaxCallWhichMayFailRequest| only |
| // if all of its members are default constructible. |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest() = default; |
| #pragma clang diagnostic pop |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest( |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest&&) noexcept = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest& operator=( |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest&&) noexcept = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailRequest& other) noexcept |
| : ExampleUseOfErrorSyntaxCallWhichMayFailRequest(other.CloneStorage_()) {} |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest& operator=( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailRequest& other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| bool operator==(const ExampleUseOfErrorSyntaxCallWhichMayFailRequest& other) |
| const noexcept { |
| return ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, |
| 16>::Equal(this, &other); |
| } |
| bool operator!=(const ExampleUseOfErrorSyntaxCallWhichMayFailRequest& other) |
| const noexcept { |
| return !::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, |
| 16>::Equal(this, &other); |
| } |
| |
| const ::std::string& s() const { return storage_.s; } |
| |
| ::std::string& s() { return storage_.s; } |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest( |
| ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) |
| : ExampleUseOfErrorSyntaxCallWhichMayFailRequest(Storage_{ |
| .s = {}, |
| }) {} |
| |
| private: |
| struct Storage_ final { |
| ::std::string s; |
| }; |
| |
| Storage_ storage_; |
| Storage_ CloneStorage_() const; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, 16>; |
| friend struct ::fidl::internal::MemberVisitor< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest>; |
| static constexpr auto kMembers = std::make_tuple( |
| ::fidl::internal::NaturalStructMember< |
| Storage_, ::std::string, |
| fidl::internal::NaturalCodingConstraintString<>>{&Storage_::s, 0}); |
| static constexpr auto kPadding = std::make_tuple(); |
| }; |
| |
| } // namespace test_errorsyntax |
| namespace fidl { |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| |
| template <> |
| struct IsFidlType< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> |
| : public std::true_type {}; |
| |
| template <> |
| struct ::fidl::internal::TypeTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> |
| final { |
| public: |
| static constexpr const fidl_type_t* kCodingTable = |
| &test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| }; |
| |
| template <> |
| struct internal::NaturalCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, |
| ::fidl::internal::NaturalCodingConstraintEmpty> |
| final |
| : public ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, |
| 8> {}; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailTopResponseTable; |
| |
| template <> |
| struct IsFidlType< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse> |
| : public std::true_type {}; |
| |
| template <> |
| struct ::fidl::internal::TypeTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse> |
| final { |
| public: |
| static constexpr const fidl_type_t* kCodingTable = |
| &test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailTopResponseTable; |
| }; |
| |
| template <> |
| struct internal::NaturalCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse, |
| ::fidl::internal::NaturalCodingConstraintEmpty> |
| final : public ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse, |
| 16> {}; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestTable; |
| |
| template <> |
| struct IsFidlType< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> |
| : public std::true_type {}; |
| |
| template <> |
| struct ::fidl::internal::TypeTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> |
| final { |
| public: |
| static constexpr const fidl_type_t* kCodingTable = |
| &test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestTable; |
| }; |
| |
| template <> |
| struct internal::NaturalCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, |
| ::fidl::internal::NaturalCodingConstraintEmpty> |
| final |
| : public ::fidl::internal::NaturalStructCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, |
| 16> {}; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| |
| template <> |
| struct IsFidlType< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> |
| : public std::true_type {}; |
| template <> |
| struct IsUnion< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> |
| : public std::true_type {}; |
| |
| template <> |
| struct ::fidl::internal::TypeTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> |
| final { |
| public: |
| static constexpr const fidl_type_t* kCodingTable = |
| &test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| }; |
| |
| template <> |
| struct internal::NaturalCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult, |
| ::fidl::internal::NaturalCodingConstraintEmpty> |
| final |
| : public ::fidl::internal::NaturalUnionCodingTraits< |
| ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> {}; |
| |
| } // namespace fidl |