| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #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> |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wshadow" |
| |
| namespace test_errorsyntax { |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailRequest; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResponse; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResult; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailRequest { |
| private: |
| struct Storage_; |
| |
| public: |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest(Storage_ storage) noexcept; |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest(::std::string s) noexcept; |
| |
| #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& operator=(const ExampleUseOfErrorSyntaxCallWhichMayFailRequest& other) noexcept; |
| |
| 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; |
| } |
| |
| // Setter for s. |
| // |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest& s(::std::string value); |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| 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(); |
| }; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResponse { |
| private: |
| struct Storage_; |
| |
| public: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse(Storage_ storage) noexcept; |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse(int64_t value) noexcept; |
| |
| #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& operator=(const ExampleUseOfErrorSyntaxCallWhichMayFailResponse& other) noexcept; |
| |
| 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; |
| } |
| |
| // Setter for value. |
| // |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse& value(int64_t value); |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| 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(); |
| }; |
| |
| 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_xunion_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_); |
| } |
| |
| // Sets the union to hold the response member. |
| // |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult& response(::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse value) { |
| storage_->emplace<1>(std::move(value)); |
| return *this; |
| } |
| 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_); |
| } |
| |
| // Sets the union to hold the err member. |
| // |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult& err(uint32_t value) { |
| storage_->emplace<2>(std::move(value)); |
| return *this; |
| } |
| |
| 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; |
| } |
| } |
| }; |
| |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailRequest::ExampleUseOfErrorSyntaxCallWhichMayFailRequest(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailRequest::ExampleUseOfErrorSyntaxCallWhichMayFailRequest(::std::string s) noexcept |
| : storage_({.s = std::move(s)}) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailRequest::ExampleUseOfErrorSyntaxCallWhichMayFailRequest(const ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest& other) noexcept : ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest(other.CloneStorage_()) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailRequest& ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest::operator=(const ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest & other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailRequest::ExampleUseOfErrorSyntaxCallWhichMayFailRequest(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : ExampleUseOfErrorSyntaxCallWhichMayFailRequest(Storage_{ |
| .s = {}, |
| }) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailRequest& ExampleUseOfErrorSyntaxCallWhichMayFailRequest::s(::std::string value) { |
| storage_.s = std::move(value); |
| return *this; |
| } |
| |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailResponse::ExampleUseOfErrorSyntaxCallWhichMayFailResponse(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailResponse::ExampleUseOfErrorSyntaxCallWhichMayFailResponse(int64_t value) noexcept |
| : storage_({.value = std::move(value)}) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailResponse::ExampleUseOfErrorSyntaxCallWhichMayFailResponse(const ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse& other) noexcept : ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse(other.CloneStorage_()) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailResponse& ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse::operator=(const ::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse & other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailResponse::ExampleUseOfErrorSyntaxCallWhichMayFailResponse(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : ExampleUseOfErrorSyntaxCallWhichMayFailResponse(Storage_{ |
| .value = {}, |
| }) {} |
| inline ExampleUseOfErrorSyntaxCallWhichMayFailResponse& ExampleUseOfErrorSyntaxCallWhichMayFailResponse::value(int64_t value) { |
| storage_.value = std::move(value); |
| return *this; |
| } |
| |
| } // namespace test_errorsyntax |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 1; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kMaxOutOfLine = 4294967295; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsStruct<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalStructCodingTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest, 16> {}; |
| |
| template <> |
| struct IsFidlType<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 0; |
| static constexpr uint32_t kPrimarySize = 8; |
| static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsStruct<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalStructCodingTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse, 8> {}; |
| |
| template <> |
| struct IsFidlType<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 1; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kMaxOutOfLine = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsUnion<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalUnionCodingTraits<::test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResult> {}; |
| |
| #pragma clang diagnostic pop |
| |
| } // namespace fidl |