| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include <fidl/test.struct/cpp/common_types.h> |
| #include <fidl/test.struct/cpp/markers.h> |
| #include <lib/fidl/cpp/natural_coding_traits.h> |
| #include <lib/fidl/cpp/natural_types.h> |
| |
| #include <cinttypes> |
| #include <string> |
| |
| #ifdef __Fuchsia__ |
| |
| #endif // __Fuchsia__ |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wshadow" |
| |
| namespace test_struct { |
| |
| class Simple; |
| |
| class BasicStruct; |
| |
| class Simple { |
| private: |
| struct Storage_; |
| |
| public: |
| Simple(Storage_ storage) noexcept; |
| Simple(uint8_t f1, bool f2) noexcept; |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |Simple| only if all of its members are default constructible. |
| Simple() = default; |
| #pragma clang diagnostic pop |
| |
| Simple(Simple&&) noexcept = default; |
| Simple& operator=(Simple&&) noexcept = default; |
| Simple(const Simple& other) noexcept; |
| Simple& operator=(const Simple& other) noexcept; |
| |
| bool operator==(const Simple& other) const noexcept { |
| return ::fidl::internal::NaturalStructCodingTraits<::test_struct::Simple, 2>::Equal(this, &other); |
| } |
| bool operator!=(const Simple& other) const noexcept { |
| return !::fidl::internal::NaturalStructCodingTraits<::test_struct::Simple, 2>::Equal(this, &other); |
| } |
| |
| uint8_t |
| f1() const { |
| return storage_.f1; |
| } |
| |
| uint8_t& f1() { |
| return storage_.f1; |
| } |
| |
| // Setter for f1. |
| // |
| |
| Simple& f1(uint8_t value); |
| |
| bool |
| f2() const { |
| return storage_.f2; |
| } |
| |
| bool& f2() { |
| return storage_.f2; |
| } |
| |
| // Setter for f2. |
| // |
| |
| Simple& f2(bool value); |
| |
| Simple(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| private: |
| struct Storage_ final { |
| uint8_t f1 = {}; |
| bool f2 = {}; |
| }; |
| |
| Storage_ storage_; |
| Storage_ CloneStorage_() const; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits<::test_struct::Simple, 2>; |
| friend struct ::fidl::internal::MemberVisitor<::test_struct::Simple>; |
| static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, uint8_t, fidl::internal::NaturalCodingConstraintEmpty>{ |
| &Storage_::f1, 0}, |
| ::fidl::internal::NaturalStructMember<Storage_, bool, fidl::internal::NaturalCodingConstraintEmpty>{&Storage_::f2, 1}); |
| static constexpr auto kPadding = std::make_tuple(); |
| }; |
| |
| class BasicStruct { |
| private: |
| struct Storage_; |
| |
| public: |
| BasicStruct(Storage_ storage) noexcept; |
| BasicStruct(uint32_t x, ::std::string y) noexcept; |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |BasicStruct| only if all of its members are default constructible. |
| BasicStruct() = default; |
| #pragma clang diagnostic pop |
| |
| BasicStruct(BasicStruct&&) noexcept = default; |
| BasicStruct& operator=(BasicStruct&&) noexcept = default; |
| BasicStruct(const BasicStruct& other) noexcept; |
| BasicStruct& operator=(const BasicStruct& other) noexcept; |
| |
| bool operator==(const BasicStruct& other) const noexcept { |
| return ::fidl::internal::NaturalStructCodingTraits<::test_struct::BasicStruct, 24>::Equal(this, &other); |
| } |
| bool operator!=(const BasicStruct& other) const noexcept { |
| return !::fidl::internal::NaturalStructCodingTraits<::test_struct::BasicStruct, 24>::Equal(this, &other); |
| } |
| |
| uint32_t |
| x() const { |
| return storage_.x; |
| } |
| |
| uint32_t& x() { |
| return storage_.x; |
| } |
| |
| // Setter for x. |
| // |
| |
| BasicStruct& x(uint32_t value); |
| |
| const ::std::string& |
| y() const { |
| return storage_.y; |
| } |
| |
| ::std::string& y() { |
| return storage_.y; |
| } |
| |
| // Setter for y. |
| // |
| |
| BasicStruct& y(::std::string value); |
| |
| BasicStruct(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| private: |
| struct Storage_ final { |
| uint32_t x = {}; |
| ::std::string y; |
| }; |
| |
| Storage_ storage_; |
| Storage_ CloneStorage_() const; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits<::test_struct::BasicStruct, 24>; |
| friend struct ::fidl::internal::MemberVisitor<::test_struct::BasicStruct>; |
| static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, uint32_t, fidl::internal::NaturalCodingConstraintEmpty>{ |
| &Storage_::x, 0}, |
| ::fidl::internal::NaturalStructMember<Storage_, ::std::string, fidl::internal::NaturalCodingConstraintString<>>{&Storage_::y, 8}); |
| static constexpr auto kPadding = std::make_tuple(::fidl::internal::NaturalStructPadding<uint64_t>{ |
| .offset = 0, |
| .mask = 0xffffffff00000000, |
| }); |
| }; |
| |
| inline Simple::Simple(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| inline Simple::Simple(uint8_t f1, bool f2) noexcept |
| : storage_({.f1 = std::move(f1), |
| .f2 = std::move(f2)}) {} |
| inline Simple::Simple(const ::test_struct::Simple& other) noexcept : ::test_struct::Simple(other.CloneStorage_()) {} |
| inline Simple& ::test_struct::Simple::operator=(const ::test_struct::Simple & other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| inline Simple::Simple(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : Simple(Storage_{ |
| .f1 = {}, |
| .f2 = {}, |
| }) {} |
| inline Simple& Simple::f1(uint8_t value) { |
| storage_.f1 = std::move(value); |
| return *this; |
| } |
| inline Simple& Simple::f2(bool value) { |
| storage_.f2 = std::move(value); |
| return *this; |
| } |
| |
| inline BasicStruct::BasicStruct(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| inline BasicStruct::BasicStruct(uint32_t x, ::std::string y) noexcept |
| : storage_({.x = std::move(x), |
| .y = std::move(y)}) {} |
| inline BasicStruct::BasicStruct(const ::test_struct::BasicStruct& other) noexcept : ::test_struct::BasicStruct(other.CloneStorage_()) {} |
| inline BasicStruct& ::test_struct::BasicStruct::operator=(const ::test_struct::BasicStruct & other) noexcept { |
| storage_ = other.CloneStorage_(); |
| return *this; |
| } |
| |
| inline BasicStruct::BasicStruct(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : BasicStruct(Storage_{ |
| .x = {}, |
| .y = {}, |
| }) {} |
| inline BasicStruct& BasicStruct::x(uint32_t value) { |
| storage_.x = std::move(value); |
| return *this; |
| } |
| inline BasicStruct& BasicStruct::y(::std::string value) { |
| storage_.y = std::move(value); |
| return *this; |
| } |
| |
| } // namespace test_struct |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::test_struct::Simple> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_struct::Simple> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 0; |
| static constexpr uint32_t kPrimarySize = 2; |
| static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsStruct<::test_struct::Simple> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_struct::Simple, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalStructCodingTraits<::test_struct::Simple, 2> {}; |
| |
| template <> |
| struct IsFidlType<::test_struct::BasicStruct> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_struct::BasicStruct> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 1; |
| static constexpr uint32_t kPrimarySize = 24; |
| static constexpr uint32_t kMaxOutOfLine = 4294967295; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsStruct<::test_struct::BasicStruct> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_struct::BasicStruct, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalStructCodingTraits<::test_struct::BasicStruct, 24> {}; |
| |
| #pragma clang diagnostic pop |
| |
| } // namespace fidl |