| // mojo/public/interfaces/bindings/tests/struct_with_traits.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2016 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_STRUCT_WITH_TRAITS_MOJOM_SHARED_H_ |
| #define MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_STRUCT_WITH_TRAITS_MOJOM_SHARED_H_ |
| |
| #include <stdint.h> |
| |
| #include <functional> |
| #include <iosfwd> |
| #include <type_traits> |
| #include <utility> |
| #include "mojo/public/cpp/bindings/array_data_view.h" |
| #include "mojo/public/cpp/bindings/enum_traits.h" |
| #include "mojo/public/cpp/bindings/interface_data_view.h" |
| #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/map_data_view.h" |
| #include "mojo/public/cpp/bindings/string_data_view.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom-shared-internal.h" |
| #include "mojo/public/cpp/bindings/lib/interface_serialization.h" |
| #include "mojo/public/cpp/system/data_pipe.h" |
| |
| |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace mojo::test { |
| class NestedStructWithTraitsDataView; |
| |
| class StructWithTraitsDataView; |
| |
| class StructWithUnreachableTraitsDataView; |
| |
| class StructWithTraitsContainerDataView; |
| |
| class TrivialStructWithTraitsDataView; |
| |
| class MoveOnlyStructWithTraitsDataView; |
| |
| class MoveOnlyStructWithTraitsContainerDataView; |
| |
| class StructWithTraitsForUniquePtrDataView; |
| |
| class EnumWithTraitsContainerDataView; |
| |
| class StructForceSerializeDataView; |
| |
| class StructNestedForceSerializeDataView; |
| |
| class UnionWithTraitsDataView; |
| |
| |
| } // mojo::test |
| |
| namespace mojo { |
| namespace internal { |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::NestedStructWithTraitsDataView> { |
| using Data = ::mojo::test::internal::NestedStructWithTraits_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructWithTraitsDataView> { |
| using Data = ::mojo::test::internal::StructWithTraits_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructWithUnreachableTraitsDataView> { |
| using Data = ::mojo::test::internal::StructWithUnreachableTraits_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructWithTraitsContainerDataView> { |
| using Data = ::mojo::test::internal::StructWithTraitsContainer_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::TrivialStructWithTraitsDataView> { |
| using Data = ::mojo::test::internal::TrivialStructWithTraits_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::MoveOnlyStructWithTraitsDataView> { |
| using Data = ::mojo::test::internal::MoveOnlyStructWithTraits_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::MoveOnlyStructWithTraitsContainerDataView> { |
| using Data = ::mojo::test::internal::MoveOnlyStructWithTraitsContainer_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructWithTraitsForUniquePtrDataView> { |
| using Data = ::mojo::test::internal::StructWithTraitsForUniquePtr_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::EnumWithTraitsContainerDataView> { |
| using Data = ::mojo::test::internal::EnumWithTraitsContainer_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructForceSerializeDataView> { |
| using Data = ::mojo::test::internal::StructForceSerialize_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::StructNestedForceSerializeDataView> { |
| using Data = ::mojo::test::internal::StructNestedForceSerialize_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::mojo::test::UnionWithTraitsDataView> { |
| using Data = ::mojo::test::internal::UnionWithTraits_Data; |
| using DataAsArrayElement = Data; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion; |
| }; |
| |
| } // namespace internal |
| } // namespace mojo |
| |
| |
| namespace mojo::test { |
| |
| |
| // @generated_from: mojo.test.EnumWithTraits |
| enum class EnumWithTraits : int32_t { |
| |
| // @generated_from: mojo.test.EnumWithTraits.VALUE_0 |
| VALUE_0 = 0, |
| |
| // @generated_from: mojo.test.EnumWithTraits.VALUE_1 |
| VALUE_1 = 1, |
| kMinValue = 0, |
| kMaxValue = 1, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, EnumWithTraits value); |
| inline bool IsKnownEnumValue(EnumWithTraits value) { |
| return internal::EnumWithTraits_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| // Interface base classes. They are used for type safety check. |
| class TraitsTestServiceInterfaceBase {}; |
| |
| using TraitsTestServicePtrDataView = |
| mojo::InterfacePtrDataView<TraitsTestServiceInterfaceBase>; |
| using TraitsTestServiceRequestDataView = |
| mojo::InterfaceRequestDataView<TraitsTestServiceInterfaceBase>; |
| using TraitsTestServiceAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<TraitsTestServiceInterfaceBase>; |
| using TraitsTestServiceAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<TraitsTestServiceInterfaceBase>; |
| class TestUnserializedStructInterfaceBase {}; |
| |
| using TestUnserializedStructPtrDataView = |
| mojo::InterfacePtrDataView<TestUnserializedStructInterfaceBase>; |
| using TestUnserializedStructRequestDataView = |
| mojo::InterfaceRequestDataView<TestUnserializedStructInterfaceBase>; |
| using TestUnserializedStructAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<TestUnserializedStructInterfaceBase>; |
| using TestUnserializedStructAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<TestUnserializedStructInterfaceBase>; |
| class ForceSerializeTesterInterfaceBase {}; |
| |
| using ForceSerializeTesterPtrDataView = |
| mojo::InterfacePtrDataView<ForceSerializeTesterInterfaceBase>; |
| using ForceSerializeTesterRequestDataView = |
| mojo::InterfaceRequestDataView<ForceSerializeTesterInterfaceBase>; |
| using ForceSerializeTesterAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<ForceSerializeTesterInterfaceBase>; |
| using ForceSerializeTesterAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<ForceSerializeTesterInterfaceBase>; |
| |
| |
| class NestedStructWithTraitsDataView { |
| public: |
| NestedStructWithTraitsDataView() = default; |
| |
| NestedStructWithTraitsDataView( |
| internal::NestedStructWithTraits_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| int32_t value() const { |
| return data_->value; |
| } |
| private: |
| internal::NestedStructWithTraits_Data* data_ = nullptr; |
| }; |
| |
| |
| class StructWithTraitsDataView { |
| public: |
| StructWithTraitsDataView() = default; |
| |
| StructWithTraitsDataView( |
| internal::StructWithTraits_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| template <typename UserType> |
| [[nodiscard]] bool ReadFEnum(UserType* output) const { |
| auto data_value = data_->f_enum; |
| return mojo::internal::Deserialize<::mojo::test::EnumWithTraits>( |
| data_value, output); |
| } |
| EnumWithTraits f_enum() const { |
| return ::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::EnumWithTraits>(data_->f_enum)); |
| } |
| bool f_bool() const { |
| return data_->f_bool; |
| } |
| uint32_t f_uint32() const { |
| return data_->f_uint32; |
| } |
| uint64_t f_uint64() const { |
| return data_->f_uint64; |
| } |
| inline void GetFStringDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFString(UserType* output) { |
| |
| auto* pointer = data_->f_string.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetFString2DataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFString2(UserType* output) { |
| |
| auto* pointer = data_->f_string2.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetFStringArrayDataView( |
| mojo::ArrayDataView<mojo::StringDataView>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStringArray(UserType* output) { |
| |
| auto* pointer = data_->f_string_array.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<mojo::StringDataView>>( |
| pointer, output, message_); |
| } |
| inline void GetFStringSetDataView( |
| mojo::ArrayDataView<mojo::StringDataView>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStringSet(UserType* output) { |
| |
| auto* pointer = data_->f_string_set.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<mojo::StringDataView>>( |
| pointer, output, message_); |
| } |
| inline void GetFStructDataView( |
| NestedStructWithTraitsDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStruct(UserType* output) { |
| |
| auto* pointer = data_->f_struct.Get(); |
| return mojo::internal::Deserialize<::mojo::test::NestedStructWithTraitsDataView>( |
| pointer, output, message_); |
| } |
| inline void GetFStructArrayDataView( |
| mojo::ArrayDataView<NestedStructWithTraitsDataView>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStructArray(UserType* output) { |
| |
| auto* pointer = data_->f_struct_array.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<::mojo::test::NestedStructWithTraitsDataView>>( |
| pointer, output, message_); |
| } |
| inline void GetFStructMapDataView( |
| mojo::MapDataView<mojo::StringDataView, NestedStructWithTraitsDataView>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStructMap(UserType* output) { |
| |
| auto* pointer = data_->f_struct_map.Get(); |
| return mojo::internal::Deserialize<mojo::MapDataView<mojo::StringDataView, ::mojo::test::NestedStructWithTraitsDataView>>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructWithTraits_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructWithUnreachableTraitsDataView { |
| public: |
| StructWithUnreachableTraitsDataView() = default; |
| |
| StructWithUnreachableTraitsDataView( |
| internal::StructWithUnreachableTraits_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| bool ignore_me() const { |
| return data_->ignore_me; |
| } |
| private: |
| internal::StructWithUnreachableTraits_Data* data_ = nullptr; |
| }; |
| |
| |
| class StructWithTraitsContainerDataView { |
| public: |
| StructWithTraitsContainerDataView() = default; |
| |
| StructWithTraitsContainerDataView( |
| internal::StructWithTraitsContainer_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetFStructDataView( |
| StructWithTraitsDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStruct(UserType* output) { |
| |
| auto* pointer = data_->f_struct.Get(); |
| return mojo::internal::Deserialize<::mojo::test::StructWithTraitsDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructWithTraitsContainer_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class TrivialStructWithTraitsDataView { |
| public: |
| TrivialStructWithTraitsDataView() = default; |
| |
| TrivialStructWithTraitsDataView( |
| internal::TrivialStructWithTraits_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| int32_t value() const { |
| return data_->value; |
| } |
| private: |
| internal::TrivialStructWithTraits_Data* data_ = nullptr; |
| }; |
| |
| |
| class MoveOnlyStructWithTraitsDataView { |
| public: |
| MoveOnlyStructWithTraitsDataView() = default; |
| |
| MoveOnlyStructWithTraitsDataView( |
| internal::MoveOnlyStructWithTraits_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| mojo::ScopedHandle TakeFHandle() { |
| mojo::ScopedHandle result; |
| bool ret = |
| mojo::internal::Deserialize<mojo::ScopedHandle>( |
| &data_->f_handle, &result, message_); |
| DCHECK(ret); |
| return result; |
| } |
| private: |
| internal::MoveOnlyStructWithTraits_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class MoveOnlyStructWithTraitsContainerDataView { |
| public: |
| MoveOnlyStructWithTraitsContainerDataView() = default; |
| |
| MoveOnlyStructWithTraitsContainerDataView( |
| internal::MoveOnlyStructWithTraitsContainer_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetFStructDataView( |
| MoveOnlyStructWithTraitsDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStruct(UserType* output) { |
| |
| auto* pointer = data_->f_struct.Get(); |
| return mojo::internal::Deserialize<::mojo::test::MoveOnlyStructWithTraitsDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::MoveOnlyStructWithTraitsContainer_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class StructWithTraitsForUniquePtrDataView { |
| public: |
| StructWithTraitsForUniquePtrDataView() = default; |
| |
| StructWithTraitsForUniquePtrDataView( |
| internal::StructWithTraitsForUniquePtr_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| int32_t f_int32() const { |
| return data_->f_int32; |
| } |
| private: |
| internal::StructWithTraitsForUniquePtr_Data* data_ = nullptr; |
| }; |
| |
| |
| class EnumWithTraitsContainerDataView { |
| public: |
| EnumWithTraitsContainerDataView() = default; |
| |
| EnumWithTraitsContainerDataView( |
| internal::EnumWithTraitsContainer_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| template <typename UserType> |
| [[nodiscard]] bool ReadFField(UserType* output) const { |
| auto data_value = data_->f_field; |
| return mojo::internal::Deserialize<::mojo::test::EnumWithTraits>( |
| data_value, output); |
| } |
| EnumWithTraits f_field() const { |
| return ::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::EnumWithTraits>(data_->f_field)); |
| } |
| private: |
| internal::EnumWithTraitsContainer_Data* data_ = nullptr; |
| }; |
| |
| |
| class StructForceSerializeDataView { |
| public: |
| StructForceSerializeDataView() = default; |
| |
| StructForceSerializeDataView( |
| internal::StructForceSerialize_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| int32_t value() const { |
| return data_->value; |
| } |
| private: |
| internal::StructForceSerialize_Data* data_ = nullptr; |
| }; |
| |
| |
| class StructNestedForceSerializeDataView { |
| public: |
| StructNestedForceSerializeDataView() = default; |
| |
| StructNestedForceSerializeDataView( |
| internal::StructNestedForceSerialize_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetForceDataView( |
| StructForceSerializeDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadForce(UserType* output) { |
| |
| auto* pointer = data_->force.Get(); |
| return mojo::internal::Deserialize<::mojo::test::StructForceSerializeDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::StructNestedForceSerialize_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class UnionWithTraitsDataView { |
| public: |
| using Tag = internal::UnionWithTraits_Data::UnionWithTraits_Tag; |
| |
| UnionWithTraitsDataView() = default; |
| |
| UnionWithTraitsDataView( |
| internal::UnionWithTraits_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { |
| // For inlined unions, |data_| is always non-null. In that case we need to |
| // check |data_->is_null()|. |
| return !data_ || data_->is_null(); |
| } |
| |
| Tag tag() const { return data_->tag; } |
| bool is_f_int32() const { return data_->tag == Tag::kFInt32; } |
| int32_t f_int32() const { |
| CHECK(is_f_int32()); |
| return data_->data.f_f_int32; |
| } |
| bool is_f_struct() const { return data_->tag == Tag::kFStruct; } |
| inline void GetFStructDataView( |
| NestedStructWithTraitsDataView* output) const; |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadFStruct(UserType* output) const { |
| |
| CHECK(is_f_struct()); |
| return mojo::internal::Deserialize<::mojo::test::NestedStructWithTraitsDataView>( |
| data_->data.f_f_struct.Get(), output, message_); |
| } |
| |
| private: |
| internal::UnionWithTraits_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| |
| } // mojo::test |
| |
| namespace std { |
| |
| template <> |
| struct hash<::mojo::test::EnumWithTraits> |
| : public mojo::internal::EnumHashImpl<::mojo::test::EnumWithTraits> {}; |
| |
| } // namespace std |
| |
| namespace mojo { |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::EnumWithTraits, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::mojo::test::EnumWithTraits, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::mojo::test::EnumWithTraits>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::NestedStructWithTraitsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::NestedStructWithTraitsDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::NestedStructWithTraits_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->value = Traits::value(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::NestedStructWithTraits_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::NestedStructWithTraitsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructWithTraitsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructWithTraitsDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructWithTraits_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| mojo::internal::Serialize<::mojo::test::EnumWithTraits>( |
| Traits::f_enum(input), &fragment->f_enum); |
| fragment->f_bool = Traits::f_bool(input); |
| fragment->f_uint32 = Traits::f_uint32(input); |
| fragment->f_uint64 = Traits::f_uint64(input); |
| decltype(Traits::f_string(input)) in_f_string = Traits::f_string(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_string)::BaseType> f_string_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_f_string, f_string_fragment); |
| fragment->f_string.Set( |
| f_string_fragment.is_null() ? nullptr : f_string_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_string.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_string in StructWithTraits struct"); |
| decltype(Traits::f_string2(input)) in_f_string2 = Traits::f_string2(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_string2)::BaseType> f_string2_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_f_string2, f_string2_fragment); |
| fragment->f_string2.Set( |
| f_string2_fragment.is_null() ? nullptr : f_string2_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_string2.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_string2 in StructWithTraits struct"); |
| decltype(Traits::f_string_array(input)) in_f_string_array = Traits::f_string_array(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_string_array)::BaseType> |
| f_string_array_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& f_string_array_validate_params = |
| mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>>( |
| in_f_string_array, f_string_array_fragment, &f_string_array_validate_params); |
| fragment->f_string_array.Set( |
| f_string_array_fragment.is_null() ? nullptr : f_string_array_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_string_array.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_string_array in StructWithTraits struct"); |
| decltype(Traits::f_string_set(input)) in_f_string_set = Traits::f_string_set(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_string_set)::BaseType> |
| f_string_set_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& f_string_set_validate_params = |
| mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>>( |
| in_f_string_set, f_string_set_fragment, &f_string_set_validate_params); |
| fragment->f_string_set.Set( |
| f_string_set_fragment.is_null() ? nullptr : f_string_set_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_string_set.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_string_set in StructWithTraits struct"); |
| decltype(Traits::f_struct(input)) in_f_struct = Traits::f_struct(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_struct)::BaseType> f_struct_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::NestedStructWithTraitsDataView>( |
| in_f_struct, f_struct_fragment); |
| fragment->f_struct.Set( |
| f_struct_fragment.is_null() ? nullptr : f_struct_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_struct.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_struct in StructWithTraits struct"); |
| decltype(Traits::f_struct_array(input)) in_f_struct_array = Traits::f_struct_array(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_struct_array)::BaseType> |
| f_struct_array_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& f_struct_array_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<::mojo::test::NestedStructWithTraitsDataView>>( |
| in_f_struct_array, f_struct_array_fragment, &f_struct_array_validate_params); |
| fragment->f_struct_array.Set( |
| f_struct_array_fragment.is_null() ? nullptr : f_struct_array_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_struct_array.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_struct_array in StructWithTraits struct"); |
| decltype(Traits::f_struct_map(input)) in_f_struct_map = Traits::f_struct_map(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_struct_map)::BaseType> |
| f_struct_map_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& f_struct_map_validate_params = |
| mojo::internal::GetMapValidator<*&mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>(), *&mojo::internal::GetArrayValidator<0, false, nullptr>()>(); |
| mojo::internal::Serialize<mojo::MapDataView<mojo::StringDataView, ::mojo::test::NestedStructWithTraitsDataView>>( |
| in_f_struct_map, f_struct_map_fragment, &f_struct_map_validate_params); |
| fragment->f_struct_map.Set( |
| f_struct_map_fragment.is_null() ? nullptr : f_struct_map_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_struct_map.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_struct_map in StructWithTraits struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructWithTraits_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructWithTraitsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructWithUnreachableTraitsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructWithUnreachableTraitsDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructWithUnreachableTraits_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->ignore_me = Traits::ignore_me(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructWithUnreachableTraits_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructWithUnreachableTraitsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructWithTraitsContainerDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructWithTraitsContainerDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructWithTraitsContainer_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::f_struct(input)) in_f_struct = Traits::f_struct(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_struct)::BaseType> f_struct_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::StructWithTraitsDataView>( |
| in_f_struct, f_struct_fragment); |
| fragment->f_struct.Set( |
| f_struct_fragment.is_null() ? nullptr : f_struct_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_struct.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_struct in StructWithTraitsContainer struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructWithTraitsContainer_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructWithTraitsContainerDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::TrivialStructWithTraitsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::TrivialStructWithTraitsDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::TrivialStructWithTraits_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->value = Traits::value(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::TrivialStructWithTraits_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::TrivialStructWithTraitsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::MoveOnlyStructWithTraitsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::MoveOnlyStructWithTraitsDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::MoveOnlyStructWithTraits_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::f_handle(input)) in_f_handle = Traits::f_handle(input); |
| mojo::internal::Serialize<mojo::ScopedHandle>( |
| in_f_handle, &fragment->f_handle, &fragment.message()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| !mojo::internal::IsHandleOrInterfaceValid(fragment->f_handle), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
| "invalid f_handle in MoveOnlyStructWithTraits struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::MoveOnlyStructWithTraits_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::MoveOnlyStructWithTraitsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::MoveOnlyStructWithTraitsContainerDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::MoveOnlyStructWithTraitsContainerDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::MoveOnlyStructWithTraitsContainer_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::f_struct(input)) in_f_struct = Traits::f_struct(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->f_struct)::BaseType> f_struct_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::MoveOnlyStructWithTraitsDataView>( |
| in_f_struct, f_struct_fragment); |
| fragment->f_struct.Set( |
| f_struct_fragment.is_null() ? nullptr : f_struct_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->f_struct.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_struct in MoveOnlyStructWithTraitsContainer struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::MoveOnlyStructWithTraitsContainer_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::MoveOnlyStructWithTraitsContainerDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructWithTraitsForUniquePtrDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructWithTraitsForUniquePtrDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructWithTraitsForUniquePtr_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->f_int32 = Traits::f_int32(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructWithTraitsForUniquePtr_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructWithTraitsForUniquePtrDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::EnumWithTraitsContainerDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::EnumWithTraitsContainerDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::EnumWithTraitsContainer_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| mojo::internal::Serialize<::mojo::test::EnumWithTraits>( |
| Traits::f_field(input), &fragment->f_field); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::EnumWithTraitsContainer_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::EnumWithTraitsContainerDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructForceSerializeDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructForceSerializeDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructForceSerialize_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->value = Traits::value(input); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructForceSerialize_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructForceSerializeDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::StructNestedForceSerializeDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo::test::StructNestedForceSerializeDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo::test::internal::StructNestedForceSerialize_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::force(input)) in_force = Traits::force(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->force)::BaseType> force_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::mojo::test::StructForceSerializeDataView>( |
| in_force, force_fragment); |
| fragment->force.Set( |
| force_fragment.is_null() ? nullptr : force_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->force.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null force in StructNestedForceSerialize struct"); |
| } |
| |
| static bool Deserialize(::mojo::test::internal::StructNestedForceSerialize_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::StructNestedForceSerializeDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo::test::UnionWithTraitsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = UnionTraits<::mojo::test::UnionWithTraitsDataView, UserType>; |
| |
| static void Serialize(MaybeConstUserType& input, |
| MessageFragment<::mojo::test::internal::UnionWithTraits_Data>& fragment, |
| bool inlined) { |
| if (CallIsNullIfExists<Traits>(input)) { |
| if (inlined) |
| fragment->set_null(); |
| return; |
| } |
| |
| if (!inlined) |
| fragment.Allocate(); |
| |
| // TODO(azani): Handle unknown and objects. |
| // Set the not-null flag. |
| fragment->size = kUnionDataSize; |
| fragment->tag = Traits::GetTag(input); |
| switch (fragment->tag) { |
| case ::mojo::test::UnionWithTraitsDataView::Tag::kFInt32: { |
| decltype(Traits::f_int32(input)) |
| in_f_int32 = Traits::f_int32(input); |
| fragment->data.f_f_int32 = in_f_int32; |
| break; |
| } |
| case ::mojo::test::UnionWithTraitsDataView::Tag::kFStruct: { |
| decltype(Traits::f_struct(input)) |
| in_f_struct = Traits::f_struct(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->data.f_f_struct)::BaseType> |
| value_fragment(fragment.message()); |
| mojo::internal::Serialize<::mojo::test::NestedStructWithTraitsDataView>( |
| in_f_struct, value_fragment); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| value_fragment.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null f_struct in UnionWithTraits union"); |
| fragment->data.f_f_struct.Set( |
| value_fragment.is_null() ? nullptr : value_fragment.data()); |
| break; |
| } |
| } |
| } |
| |
| static bool Deserialize(::mojo::test::internal::UnionWithTraits_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input || input->is_null()) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo::test::UnionWithTraitsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| } // namespace mojo |
| |
| |
| namespace mojo::test { |
| |
| |
| |
| inline void StructWithTraitsDataView::GetFStringDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->f_string.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void StructWithTraitsDataView::GetFString2DataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->f_string2.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void StructWithTraitsDataView::GetFStringArrayDataView( |
| mojo::ArrayDataView<mojo::StringDataView>* output) { |
| auto pointer = data_->f_string_array.Get(); |
| *output = mojo::ArrayDataView<mojo::StringDataView>(pointer, message_); |
| } |
| inline void StructWithTraitsDataView::GetFStringSetDataView( |
| mojo::ArrayDataView<mojo::StringDataView>* output) { |
| auto pointer = data_->f_string_set.Get(); |
| *output = mojo::ArrayDataView<mojo::StringDataView>(pointer, message_); |
| } |
| inline void StructWithTraitsDataView::GetFStructDataView( |
| NestedStructWithTraitsDataView* output) { |
| auto pointer = data_->f_struct.Get(); |
| *output = NestedStructWithTraitsDataView(pointer, message_); |
| } |
| inline void StructWithTraitsDataView::GetFStructArrayDataView( |
| mojo::ArrayDataView<NestedStructWithTraitsDataView>* output) { |
| auto pointer = data_->f_struct_array.Get(); |
| *output = mojo::ArrayDataView<NestedStructWithTraitsDataView>(pointer, message_); |
| } |
| inline void StructWithTraitsDataView::GetFStructMapDataView( |
| mojo::MapDataView<mojo::StringDataView, NestedStructWithTraitsDataView>* output) { |
| auto pointer = data_->f_struct_map.Get(); |
| *output = mojo::MapDataView<mojo::StringDataView, NestedStructWithTraitsDataView>(pointer, message_); |
| } |
| |
| |
| |
| |
| inline void StructWithTraitsContainerDataView::GetFStructDataView( |
| StructWithTraitsDataView* output) { |
| auto pointer = data_->f_struct.Get(); |
| *output = StructWithTraitsDataView(pointer, message_); |
| } |
| |
| |
| |
| |
| |
| |
| inline void MoveOnlyStructWithTraitsContainerDataView::GetFStructDataView( |
| MoveOnlyStructWithTraitsDataView* output) { |
| auto pointer = data_->f_struct.Get(); |
| *output = MoveOnlyStructWithTraitsDataView(pointer, message_); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| inline void StructNestedForceSerializeDataView::GetForceDataView( |
| StructForceSerializeDataView* output) { |
| auto pointer = data_->force.Get(); |
| *output = StructForceSerializeDataView(pointer, message_); |
| } |
| |
| |
| inline void UnionWithTraitsDataView::GetFStructDataView( |
| NestedStructWithTraitsDataView* output) const { |
| CHECK(is_f_struct()); |
| *output = NestedStructWithTraitsDataView(data_->data.f_f_struct.Get(), message_); |
| } |
| |
| |
| } // mojo::test |
| |
| // Declare TraceFormatTraits for enums, which should be defined in ::perfetto |
| // namespace. |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::mojo::test::EnumWithTraits> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::mojo::test::EnumWithTraits value); |
| }; |
| |
| } // namespace perfetto |
| |
| #endif // MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_STRUCT_WITH_TRAITS_MOJOM_SHARED_H_
|
| /* Metadata comment
|
| eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi
|
| ZWdpbiI6IDUzMjYsICJlbmQiOiA1MzQwLCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1vam9tIiwg
|
| ImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hyb21pdW0v
|
| c3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJtb2pvLnRlc3QuRW51bVdpdGhUcmFpdHMifSwgImVk
|
| Z2UiOiAiJS9reXRoZS9lZGdlL2dlbmVyYXRlcyJ9LCB7InR5cGUiOiAiYW5jaG9yX2RlZmluZXMi
|
| LCAiYmVnaW4iOiA1NDExLCAiZW5kIjogNTQxOCwgInZuYW1lIjogeyJsYW5ndWFnZSI6ICJtb2pv
|
| bSIsICJjb3JwdXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jb2Rlc2VhcmNoL2Nocm9t
|
| aXVtL3NyYy8vbWFpbiIsICJzaWduYXR1cmUiOiAibW9qby50ZXN0LkVudW1XaXRoVHJhaXRzLlZB
|
| TFVFXzAifSwgImVkZ2UiOiAiJS9reXRoZS9lZGdlL2dlbmVyYXRlcyJ9LCB7InR5cGUiOiAiYW5j
|
| aG9yX2RlZmluZXMiLCAiYmVnaW4iOiA1NDgyLCAiZW5kIjogNTQ4OSwgInZuYW1lIjogeyJsYW5n
|
| dWFnZSI6ICJtb2pvbSIsICJjb3JwdXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jb2Rl
|
| c2VhcmNoL2Nocm9taXVtL3NyYy8vbWFpbiIsICJzaWduYXR1cmUiOiAibW9qby50ZXN0LkVudW1X
|
| aXRoVHJhaXRzLlZBTFVFXzEifSwgImVkZ2UiOiAiJS9reXRoZS9lZGdlL2dlbmVyYXRlcyJ9XX0=
|
| */ |