| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include "lib/fidl/cpp/internal/header.h" |
| |
| |
| namespace test { |
| namespace name { |
| |
| class OlderSimpleUnion; |
| class NewerSimpleUnion; |
| |
| class OlderSimpleUnion { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| OlderSimpleUnion(); |
| ~OlderSimpleUnion(); |
| |
| OlderSimpleUnion(OlderSimpleUnion&&); |
| OlderSimpleUnion& operator=(OlderSimpleUnion&&); |
| |
| enum Tag : fidl_xunion_tag_t { |
| Empty = 0, |
| kI = 1026732503, |
| kF = 1362546558, |
| }; |
| |
| static inline ::std::unique_ptr<OlderSimpleUnion> New() { return ::std::make_unique<OlderSimpleUnion>(); } |
| |
| void Encode(::fidl::Encoder* encoder, size_t offset); |
| static void Decode(::fidl::Decoder* decoder, OlderSimpleUnion* value, size_t offset); |
| zx_status_t Clone(OlderSimpleUnion* result) const; |
| |
| bool empty() const { return tag_ == Tag::Empty; } |
| |
| bool is_i() const { return tag_ == 1026732503; } |
| |
| int64_t& i() { |
| EnsureStorageInitialized(1026732503); |
| return i_; |
| } |
| |
| const int64_t& i() const { return i_; } |
| void set_i(int64_t value); |
| |
| bool is_f() const { return tag_ == 1362546558; } |
| |
| float& f() { |
| EnsureStorageInitialized(1362546558); |
| return f_; |
| } |
| |
| const float& f() const { return f_; } |
| void set_f(float value); |
| |
| Tag Which() const { return Tag(tag_); } |
| |
| private: |
| friend bool operator==(const OlderSimpleUnion& lhs, const OlderSimpleUnion& rhs); |
| void Destroy(); |
| void EnsureStorageInitialized(::fidl_xunion_tag_t tag); |
| |
| ::fidl_xunion_tag_t tag_ = Tag::Empty; |
| union { |
| int64_t i_; |
| float f_; |
| }; |
| }; |
| |
| bool operator==(const OlderSimpleUnion& lhs, const OlderSimpleUnion& rhs); |
| inline bool operator!=(const OlderSimpleUnion& lhs, const OlderSimpleUnion& rhs) { |
| return !(lhs == rhs); |
| } |
| |
| inline zx_status_t Clone(const ::test::name::OlderSimpleUnion& value, |
| ::test::name::OlderSimpleUnion* result) { |
| return value.Clone(result); |
| } |
| |
| using OlderSimpleUnionPtr = ::std::unique_ptr<OlderSimpleUnion>; |
| |
| class NewerSimpleUnion { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| NewerSimpleUnion(); |
| ~NewerSimpleUnion(); |
| |
| NewerSimpleUnion(NewerSimpleUnion&&); |
| NewerSimpleUnion& operator=(NewerSimpleUnion&&); |
| |
| enum Tag : fidl_xunion_tag_t { |
| Empty = 0, |
| kI = 693944286, |
| kS = 473666119, |
| kV = 1815655055, |
| }; |
| |
| static inline ::std::unique_ptr<NewerSimpleUnion> New() { return ::std::make_unique<NewerSimpleUnion>(); } |
| |
| void Encode(::fidl::Encoder* encoder, size_t offset); |
| static void Decode(::fidl::Decoder* decoder, NewerSimpleUnion* value, size_t offset); |
| zx_status_t Clone(NewerSimpleUnion* result) const; |
| |
| bool empty() const { return tag_ == Tag::Empty; } |
| |
| bool is_i() const { return tag_ == 693944286; } |
| |
| int64_t& i() { |
| EnsureStorageInitialized(693944286); |
| return i_; |
| } |
| |
| const int64_t& i() const { return i_; } |
| void set_i(int64_t value); |
| |
| bool is_s() const { return tag_ == 473666119; } |
| |
| ::std::string& s() { |
| EnsureStorageInitialized(473666119); |
| return s_; |
| } |
| |
| const ::std::string& s() const { return s_; } |
| void set_s(::std::string value); |
| |
| bool is_v() const { return tag_ == 1815655055; } |
| |
| ::std::vector<::std::string>& v() { |
| EnsureStorageInitialized(1815655055); |
| return v_; |
| } |
| |
| const ::std::vector<::std::string>& v() const { return v_; } |
| void set_v(::std::vector<::std::string> value); |
| |
| Tag Which() const { return Tag(tag_); } |
| |
| private: |
| friend bool operator==(const NewerSimpleUnion& lhs, const NewerSimpleUnion& rhs); |
| void Destroy(); |
| void EnsureStorageInitialized(::fidl_xunion_tag_t tag); |
| |
| ::fidl_xunion_tag_t tag_ = Tag::Empty; |
| union { |
| int64_t i_; |
| ::std::string s_; |
| ::std::vector<::std::string> v_; |
| }; |
| }; |
| |
| bool operator==(const NewerSimpleUnion& lhs, const NewerSimpleUnion& rhs); |
| inline bool operator!=(const NewerSimpleUnion& lhs, const NewerSimpleUnion& rhs) { |
| return !(lhs == rhs); |
| } |
| |
| inline zx_status_t Clone(const ::test::name::NewerSimpleUnion& value, |
| ::test::name::NewerSimpleUnion* result) { |
| return value.Clone(result); |
| } |
| |
| using NewerSimpleUnionPtr = ::std::unique_ptr<NewerSimpleUnion>; |
| } // namespace name |
| } // namespace test |
| namespace fidl { |
| |
| template <> |
| struct CodingTraits<::test::name::OlderSimpleUnion> |
| : public EncodableCodingTraits<::test::name::OlderSimpleUnion, 24> {}; |
| |
| inline zx_status_t Clone(const ::test::name::OlderSimpleUnion& value, |
| ::test::name::OlderSimpleUnion* result) { |
| return ::test::name::Clone(value, result); |
| } |
| template <> |
| struct CodingTraits<::test::name::NewerSimpleUnion> |
| : public EncodableCodingTraits<::test::name::NewerSimpleUnion, 24> {}; |
| |
| inline zx_status_t Clone(const ::test::name::NewerSimpleUnion& value, |
| ::test::name::NewerSimpleUnion* result) { |
| return ::test::name::Clone(value, result); |
| }} // namespace fidl |