| // camera/mojo/file_path.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 CAMERA_MOJO_FILE_PATH_MOJOM_SHARED_H_ |
| #define CAMERA_MOJO_FILE_PATH_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 "camera/mojo/file_path.mojom-shared-internal.h" |
| |
| |
| |
| |
| |
| |
| |
| namespace mojo_base::mojom { |
| class RelativeFilePathDataView; |
| |
| |
| |
| } // mojo_base::mojom |
| |
| namespace mojo { |
| namespace internal { |
| |
| template <> |
| struct MojomTypeTraits<::mojo_base::mojom::RelativeFilePathDataView> { |
| using Data = ::mojo_base::mojom::internal::RelativeFilePath_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| } // namespace internal |
| } // namespace mojo |
| |
| |
| namespace mojo_base::mojom { |
| |
| |
| class RelativeFilePathDataView { |
| public: |
| RelativeFilePathDataView() = default; |
| |
| RelativeFilePathDataView( |
| internal::RelativeFilePath_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetPathDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadPath(UserType* output) { |
| |
| auto* pointer = data_->path.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::RelativeFilePath_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| } // mojo_base::mojom |
| |
| namespace std { |
| |
| } // namespace std |
| |
| namespace mojo { |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::mojo_base::mojom::RelativeFilePathDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::mojo_base::mojom::RelativeFilePathDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::mojo_base::mojom::internal::RelativeFilePath_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::path(input)) in_path = Traits::path(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->path)::BaseType> path_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_path, path_fragment); |
| fragment->path.Set( |
| path_fragment.is_null() ? nullptr : path_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->path.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null path in RelativeFilePath struct"); |
| } |
| |
| static bool Deserialize(::mojo_base::mojom::internal::RelativeFilePath_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::mojo_base::mojom::RelativeFilePathDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| } // namespace mojo |
| |
| |
| namespace mojo_base::mojom { |
| |
| inline void RelativeFilePathDataView::GetPathDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->path.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| |
| |
| |
| } // mojo_base::mojom |
| |
| // Declare TraceFormatTraits for enums, which should be defined in ::perfetto |
| // namespace. |
| |
| #endif // CAMERA_MOJO_FILE_PATH_MOJOM_SHARED_H_ |