| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include "lib/fidl/cpp/internal/header.h" |
| |
| namespace fidl { |
| namespace test { |
| namespace json { |
| |
| class SimpleTable; |
| class ReverseOrdinalTable; |
| class OlderSimpleTable; |
| class NewerSimpleTable; |
| class EmptyTable; |
| |
| class SimpleTable final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| const int64_t& x() const { |
| ZX_ASSERT(has_x_); |
| return x_value_.value; |
| } |
| bool has_x() const { return has_x_; } |
| |
| int64_t* mutable_x() { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value); |
| } |
| return &x_value_.value; |
| } |
| SimpleTable& set_x(int64_t _value) { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value, std::move(_value)); |
| } else { |
| x_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_x() { |
| if (!has_x_) { |
| return; |
| } |
| has_x_ = false; |
| Destruct(&x_value_.value); |
| } |
| |
| const int64_t& y() const { |
| ZX_ASSERT(has_y_); |
| return y_value_.value; |
| } |
| bool has_y() const { return has_y_; } |
| |
| int64_t* mutable_y() { |
| if (!has_y_) { |
| has_y_ = true; |
| Construct(&y_value_.value); |
| } |
| return &y_value_.value; |
| } |
| SimpleTable& set_y(int64_t _value) { |
| if (!has_y_) { |
| has_y_ = true; |
| Construct(&y_value_.value, std::move(_value)); |
| } else { |
| y_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_y() { |
| if (!has_y_) { |
| return; |
| } |
| has_y_ = false; |
| Destruct(&y_value_.value); |
| } |
| |
| SimpleTable(); |
| SimpleTable(SimpleTable&& other); |
| ~SimpleTable(); |
| SimpleTable& operator=(SimpleTable&& other); |
| |
| static inline ::std::unique_ptr<SimpleTable> New() { |
| return ::std::make_unique<SimpleTable>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, SimpleTable* _value, |
| size_t _offset); |
| zx_status_t Clone(SimpleTable* _result) const; |
| |
| private: |
| template <class T, class... Args> |
| void Construct(T* p, Args&&... args) { |
| new (p) T(std::forward<Args>(args)...); |
| } |
| |
| template <class T> |
| void Destruct(T* p) { |
| p->~T(); |
| } |
| bool has_x_ : 1; |
| bool has_y_ : 1; |
| union ValueUnion_x { |
| ValueUnion_x() {} |
| ~ValueUnion_x() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_x x_value_; |
| union ValueUnion_y { |
| ValueUnion_y() {} |
| ~ValueUnion_y() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_y y_value_; |
| }; |
| |
| using SimpleTablePtr = ::std::unique_ptr<SimpleTable>; |
| |
| class ReverseOrdinalTable final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| const int64_t& z() const { |
| ZX_ASSERT(has_z_); |
| return z_value_.value; |
| } |
| bool has_z() const { return has_z_; } |
| |
| int64_t* mutable_z() { |
| if (!has_z_) { |
| has_z_ = true; |
| Construct(&z_value_.value); |
| } |
| return &z_value_.value; |
| } |
| ReverseOrdinalTable& set_z(int64_t _value) { |
| if (!has_z_) { |
| has_z_ = true; |
| Construct(&z_value_.value, std::move(_value)); |
| } else { |
| z_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_z() { |
| if (!has_z_) { |
| return; |
| } |
| has_z_ = false; |
| Destruct(&z_value_.value); |
| } |
| |
| const int64_t& y() const { |
| ZX_ASSERT(has_y_); |
| return y_value_.value; |
| } |
| bool has_y() const { return has_y_; } |
| |
| int64_t* mutable_y() { |
| if (!has_y_) { |
| has_y_ = true; |
| Construct(&y_value_.value); |
| } |
| return &y_value_.value; |
| } |
| ReverseOrdinalTable& set_y(int64_t _value) { |
| if (!has_y_) { |
| has_y_ = true; |
| Construct(&y_value_.value, std::move(_value)); |
| } else { |
| y_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_y() { |
| if (!has_y_) { |
| return; |
| } |
| has_y_ = false; |
| Destruct(&y_value_.value); |
| } |
| |
| const int64_t& x() const { |
| ZX_ASSERT(has_x_); |
| return x_value_.value; |
| } |
| bool has_x() const { return has_x_; } |
| |
| int64_t* mutable_x() { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value); |
| } |
| return &x_value_.value; |
| } |
| ReverseOrdinalTable& set_x(int64_t _value) { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value, std::move(_value)); |
| } else { |
| x_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_x() { |
| if (!has_x_) { |
| return; |
| } |
| has_x_ = false; |
| Destruct(&x_value_.value); |
| } |
| |
| ReverseOrdinalTable(); |
| ReverseOrdinalTable(ReverseOrdinalTable&& other); |
| ~ReverseOrdinalTable(); |
| ReverseOrdinalTable& operator=(ReverseOrdinalTable&& other); |
| |
| static inline ::std::unique_ptr<ReverseOrdinalTable> New() { |
| return ::std::make_unique<ReverseOrdinalTable>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, ReverseOrdinalTable* _value, |
| size_t _offset); |
| zx_status_t Clone(ReverseOrdinalTable* _result) const; |
| |
| private: |
| template <class T, class... Args> |
| void Construct(T* p, Args&&... args) { |
| new (p) T(std::forward<Args>(args)...); |
| } |
| |
| template <class T> |
| void Destruct(T* p) { |
| p->~T(); |
| } |
| bool has_z_ : 1; |
| bool has_y_ : 1; |
| bool has_x_ : 1; |
| union ValueUnion_z { |
| ValueUnion_z() {} |
| ~ValueUnion_z() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_z z_value_; |
| union ValueUnion_y { |
| ValueUnion_y() {} |
| ~ValueUnion_y() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_y y_value_; |
| union ValueUnion_x { |
| ValueUnion_x() {} |
| ~ValueUnion_x() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_x x_value_; |
| }; |
| |
| using ReverseOrdinalTablePtr = ::std::unique_ptr<ReverseOrdinalTable>; |
| |
| class OlderSimpleTable final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| const int64_t& x() const { |
| ZX_ASSERT(has_x_); |
| return x_value_.value; |
| } |
| bool has_x() const { return has_x_; } |
| |
| int64_t* mutable_x() { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value); |
| } |
| return &x_value_.value; |
| } |
| OlderSimpleTable& set_x(int64_t _value) { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value, std::move(_value)); |
| } else { |
| x_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_x() { |
| if (!has_x_) { |
| return; |
| } |
| has_x_ = false; |
| Destruct(&x_value_.value); |
| } |
| |
| OlderSimpleTable(); |
| OlderSimpleTable(OlderSimpleTable&& other); |
| ~OlderSimpleTable(); |
| OlderSimpleTable& operator=(OlderSimpleTable&& other); |
| |
| static inline ::std::unique_ptr<OlderSimpleTable> New() { |
| return ::std::make_unique<OlderSimpleTable>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, OlderSimpleTable* _value, |
| size_t _offset); |
| zx_status_t Clone(OlderSimpleTable* _result) const; |
| |
| private: |
| template <class T, class... Args> |
| void Construct(T* p, Args&&... args) { |
| new (p) T(std::forward<Args>(args)...); |
| } |
| |
| template <class T> |
| void Destruct(T* p) { |
| p->~T(); |
| } |
| bool has_x_ : 1; |
| union ValueUnion_x { |
| ValueUnion_x() {} |
| ~ValueUnion_x() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_x x_value_; |
| }; |
| |
| using OlderSimpleTablePtr = ::std::unique_ptr<OlderSimpleTable>; |
| |
| class NewerSimpleTable final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| const int64_t& x() const { |
| ZX_ASSERT(has_x_); |
| return x_value_.value; |
| } |
| bool has_x() const { return has_x_; } |
| |
| int64_t* mutable_x() { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value); |
| } |
| return &x_value_.value; |
| } |
| NewerSimpleTable& set_x(int64_t _value) { |
| if (!has_x_) { |
| has_x_ = true; |
| Construct(&x_value_.value, std::move(_value)); |
| } else { |
| x_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_x() { |
| if (!has_x_) { |
| return; |
| } |
| has_x_ = false; |
| Destruct(&x_value_.value); |
| } |
| |
| const int64_t& y() const { |
| ZX_ASSERT(has_y_); |
| return y_value_.value; |
| } |
| bool has_y() const { return has_y_; } |
| |
| int64_t* mutable_y() { |
| if (!has_y_) { |
| has_y_ = true; |
| Construct(&y_value_.value); |
| } |
| return &y_value_.value; |
| } |
| NewerSimpleTable& set_y(int64_t _value) { |
| if (!has_y_) { |
| has_y_ = true; |
| Construct(&y_value_.value, std::move(_value)); |
| } else { |
| y_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_y() { |
| if (!has_y_) { |
| return; |
| } |
| has_y_ = false; |
| Destruct(&y_value_.value); |
| } |
| |
| const int64_t& z() const { |
| ZX_ASSERT(has_z_); |
| return z_value_.value; |
| } |
| bool has_z() const { return has_z_; } |
| |
| int64_t* mutable_z() { |
| if (!has_z_) { |
| has_z_ = true; |
| Construct(&z_value_.value); |
| } |
| return &z_value_.value; |
| } |
| NewerSimpleTable& set_z(int64_t _value) { |
| if (!has_z_) { |
| has_z_ = true; |
| Construct(&z_value_.value, std::move(_value)); |
| } else { |
| z_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_z() { |
| if (!has_z_) { |
| return; |
| } |
| has_z_ = false; |
| Destruct(&z_value_.value); |
| } |
| |
| NewerSimpleTable(); |
| NewerSimpleTable(NewerSimpleTable&& other); |
| ~NewerSimpleTable(); |
| NewerSimpleTable& operator=(NewerSimpleTable&& other); |
| |
| static inline ::std::unique_ptr<NewerSimpleTable> New() { |
| return ::std::make_unique<NewerSimpleTable>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, NewerSimpleTable* _value, |
| size_t _offset); |
| zx_status_t Clone(NewerSimpleTable* _result) const; |
| |
| private: |
| template <class T, class... Args> |
| void Construct(T* p, Args&&... args) { |
| new (p) T(std::forward<Args>(args)...); |
| } |
| |
| template <class T> |
| void Destruct(T* p) { |
| p->~T(); |
| } |
| bool has_x_ : 1; |
| bool has_y_ : 1; |
| bool has_z_ : 1; |
| union ValueUnion_x { |
| ValueUnion_x() {} |
| ~ValueUnion_x() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_x x_value_; |
| union ValueUnion_y { |
| ValueUnion_y() {} |
| ~ValueUnion_y() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_y y_value_; |
| union ValueUnion_z { |
| ValueUnion_z() {} |
| ~ValueUnion_z() {} |
| |
| int64_t value; |
| }; |
| ValueUnion_z z_value_; |
| }; |
| |
| using NewerSimpleTablePtr = ::std::unique_ptr<NewerSimpleTable>; |
| |
| class EmptyTable final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| EmptyTable(); |
| EmptyTable(EmptyTable&& other); |
| ~EmptyTable(); |
| EmptyTable& operator=(EmptyTable&& other); |
| |
| static inline ::std::unique_ptr<EmptyTable> New() { |
| return ::std::make_unique<EmptyTable>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, EmptyTable* _value, |
| size_t _offset); |
| zx_status_t Clone(EmptyTable* _result) const; |
| |
| private: |
| template <class T, class... Args> |
| void Construct(T* p, Args&&... args) { |
| new (p) T(std::forward<Args>(args)...); |
| } |
| |
| template <class T> |
| void Destruct(T* p) { |
| p->~T(); |
| } |
| }; |
| |
| using EmptyTablePtr = ::std::unique_ptr<EmptyTable>; |
| } // namespace json |
| } // namespace test |
| } // namespace fidl |
| namespace fidl { |
| |
| template <> |
| struct CodingTraits<::fidl::test::json::SimpleTable> |
| : public EncodableCodingTraits<::fidl::test::json::SimpleTable, 16> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::SimpleTable& _value, |
| ::fidl::test::json::SimpleTable* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::fidl::test::json::SimpleTable> { |
| bool operator()(const ::fidl::test::json::SimpleTable& _lhs, |
| const ::fidl::test::json::SimpleTable& _rhs) const { |
| if (_lhs.has_x()) { |
| if (!_rhs.has_x()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.x(), _rhs.x())) { |
| return false; |
| } |
| } else if (_rhs.has_x()) { |
| return false; |
| } |
| if (_lhs.has_y()) { |
| if (!_rhs.has_y()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.y(), _rhs.y())) { |
| return false; |
| } |
| } else if (_rhs.has_y()) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::fidl::test::json::ReverseOrdinalTable> |
| : public EncodableCodingTraits<::fidl::test::json::ReverseOrdinalTable, |
| 16> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::ReverseOrdinalTable& _value, |
| ::fidl::test::json::ReverseOrdinalTable* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::fidl::test::json::ReverseOrdinalTable> { |
| bool operator()(const ::fidl::test::json::ReverseOrdinalTable& _lhs, |
| const ::fidl::test::json::ReverseOrdinalTable& _rhs) const { |
| if (_lhs.has_z()) { |
| if (!_rhs.has_z()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.z(), _rhs.z())) { |
| return false; |
| } |
| } else if (_rhs.has_z()) { |
| return false; |
| } |
| if (_lhs.has_y()) { |
| if (!_rhs.has_y()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.y(), _rhs.y())) { |
| return false; |
| } |
| } else if (_rhs.has_y()) { |
| return false; |
| } |
| if (_lhs.has_x()) { |
| if (!_rhs.has_x()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.x(), _rhs.x())) { |
| return false; |
| } |
| } else if (_rhs.has_x()) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::fidl::test::json::OlderSimpleTable> |
| : public EncodableCodingTraits<::fidl::test::json::OlderSimpleTable, 16> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::OlderSimpleTable& _value, |
| ::fidl::test::json::OlderSimpleTable* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::fidl::test::json::OlderSimpleTable> { |
| bool operator()(const ::fidl::test::json::OlderSimpleTable& _lhs, |
| const ::fidl::test::json::OlderSimpleTable& _rhs) const { |
| if (_lhs.has_x()) { |
| if (!_rhs.has_x()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.x(), _rhs.x())) { |
| return false; |
| } |
| } else if (_rhs.has_x()) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::fidl::test::json::NewerSimpleTable> |
| : public EncodableCodingTraits<::fidl::test::json::NewerSimpleTable, 16> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::NewerSimpleTable& _value, |
| ::fidl::test::json::NewerSimpleTable* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::fidl::test::json::NewerSimpleTable> { |
| bool operator()(const ::fidl::test::json::NewerSimpleTable& _lhs, |
| const ::fidl::test::json::NewerSimpleTable& _rhs) const { |
| if (_lhs.has_x()) { |
| if (!_rhs.has_x()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.x(), _rhs.x())) { |
| return false; |
| } |
| } else if (_rhs.has_x()) { |
| return false; |
| } |
| if (_lhs.has_y()) { |
| if (!_rhs.has_y()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.y(), _rhs.y())) { |
| return false; |
| } |
| } else if (_rhs.has_y()) { |
| return false; |
| } |
| if (_lhs.has_z()) { |
| if (!_rhs.has_z()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.z(), _rhs.z())) { |
| return false; |
| } |
| } else if (_rhs.has_z()) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::fidl::test::json::EmptyTable> |
| : public EncodableCodingTraits<::fidl::test::json::EmptyTable, 16> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::EmptyTable& _value, |
| ::fidl::test::json::EmptyTable* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::fidl::test::json::EmptyTable> { |
| bool operator()(const ::fidl::test::json::EmptyTable& _lhs, |
| const ::fidl::test::json::EmptyTable& _rhs) const { |
| return true; |
| } |
| }; |
| } // namespace fidl |