blob: f4c57d72b374120512917982bcedf65267209495 [file] [log] [blame]
// camera/mojo/file_path.mojom.h is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2013 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_H_
#define CAMERA_MOJO_FILE_PATH_MOJOM_H_
#include <stdint.h>
#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "base/types/cxx23_to_underlying.h"
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "camera/mojo/file_path.mojom-features.h"
#include "camera/mojo/file_path.mojom-shared.h"
#include "camera/mojo/file_path.mojom-forward.h"
#include <string>
#include <vector>
namespace mojo_base::mojom {
class RelativeFilePath {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<RelativeFilePath, T>::value>;
using DataView = RelativeFilePathDataView;
using Data_ = internal::RelativeFilePath_Data;
template <typename... Args>
static RelativeFilePathPtr New(Args&&... args) {
return RelativeFilePathPtr(
std::in_place, std::forward<Args>(args)...);
}
template <typename U>
static RelativeFilePathPtr From(const U& u) {
return mojo::TypeConverter<RelativeFilePathPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, RelativeFilePath>::Convert(*this);
}
RelativeFilePath();
explicit RelativeFilePath(
const std::string& path);
~RelativeFilePath();
// Clone() is a template so it is only instantiated if it is used. Thus, the
// bindings generator does not need to know whether Clone() or copy
// constructor/assignment are available for members.
template <typename StructPtrType = RelativeFilePathPtr>
RelativeFilePathPtr Clone() const;
// Equals() is a template so it is only instantiated if it is used. Thus, the
// bindings generator does not need to know whether Equals() or == operator
// are available for members.
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool operator!=(const T& rhs) const { return !operator==(rhs); }
size_t Hash(size_t seed) const;
template <typename UserType>
static std::vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
RelativeFilePath::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
RelativeFilePath::DataView>(input);
}
// The returned Message is serialized only if the message is moved
// cross-process or cross-language. Otherwise if the message is Deserialized
// as the same UserType |input| will just be moved to |output| in
// DeserializeFromMessage.
template <typename UserType>
static mojo::Message WrapAsMessage(UserType input) {
return mojo::Message(std::make_unique<
internal::RelativeFilePath_UnserializedMessageContext<
UserType, RelativeFilePath::DataView>>(0, 0, std::move(input)),
MOJO_CREATE_MESSAGE_FLAG_NONE);
}
template <typename UserType>
static bool Deserialize(const void* data,
size_t data_num_bytes,
UserType* output) {
mojo::Message message;
return mojo::internal::DeserializeImpl<RelativeFilePath::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return RelativeFilePath::Deserialize(
input.size() == 0 ? nullptr : &input.front(), input.size(), output);
}
template <typename UserType>
static bool DeserializeFromMessage(mojo::Message input,
UserType* output) {
auto context = input.TakeUnserializedContext<
internal::RelativeFilePath_UnserializedMessageContext<
UserType, RelativeFilePath::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<RelativeFilePath::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
std::string path;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto::TracedValue traced_context) const;
private:
static bool Validate(const void* data,
mojo::internal::ValidationContext* validation_context);
};
// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, RelativeFilePath::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
RelativeFilePathPtr RelativeFilePath::Clone() const {
return New(
mojo::Clone(path)
);
}
template <typename T, RelativeFilePath::EnableIfSame<T>*>
bool RelativeFilePath::Equals(const T& other_struct) const {
if (!mojo::Equals(this->path, other_struct.path))
return false;
return true;
}
template <typename T, RelativeFilePath::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.path < rhs.path)
return true;
if (rhs.path < lhs.path)
return false;
return false;
}
} // mojo_base::mojom
namespace mojo {
template <>
struct StructTraits<::mojo_base::mojom::RelativeFilePath::DataView,
::mojo_base::mojom::RelativeFilePathPtr> {
static bool IsNull(const ::mojo_base::mojom::RelativeFilePathPtr& input) { return !input; }
static void SetToNull(::mojo_base::mojom::RelativeFilePathPtr* output) { output->reset(); }
static const decltype(::mojo_base::mojom::RelativeFilePath::path)& path(
const ::mojo_base::mojom::RelativeFilePathPtr& input) {
return input->path;
}
static bool Read(::mojo_base::mojom::RelativeFilePath::DataView input, ::mojo_base::mojom::RelativeFilePathPtr* output);
};
} // namespace mojo
#endif // CAMERA_MOJO_FILE_PATH_MOJOM_H_