blob: 7b582288385fce7cc52138fdd794dcf2580cb0ed [file] [log] [blame]
// mojo/public/mojom/base/safe_base_name.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 MOJO_PUBLIC_MOJOM_BASE_SAFE_BASE_NAME_MOJOM_H_
#define MOJO_PUBLIC_MOJOM_BASE_SAFE_BASE_NAME_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 "mojo/public/mojom/base/safe_base_name.mojom-features.h"
#include "mojo/public/mojom/base/safe_base_name.mojom-shared.h"
#include "mojo/public/mojom/base/safe_base_name.mojom-forward.h"
#include "mojo/public/mojom/base/file_path.mojom.h"
#include <string>
#include <vector>
#include "mojo/public/cpp/base/safe_base_name_mojom_traits.h"
#include "base/component_export.h"
#ifdef KYTHE_IS_RUNNING
#pragma kythe_inline_metadata "Metadata comment"
#endif
namespace mojo_base::mojom {
// @generated_from: mojo_base.mojom.SafeBaseName
class COMPONENT_EXPORT(MOJO_BASE_MOJOM) SafeBaseName {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<SafeBaseName, T>::value>;
using DataView = SafeBaseNameDataView;
using Data_ = internal::SafeBaseName_Data;
template <typename... Args>
static SafeBaseNamePtr New(Args&&... args) {
return SafeBaseNamePtr(
std::in_place, std::forward<Args>(args)...);
}
template <typename U>
static SafeBaseNamePtr From(const U& u) {
return mojo::TypeConverter<SafeBaseNamePtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, SafeBaseName>::Convert(*this);
}
SafeBaseName();
explicit SafeBaseName(
const ::base::FilePath& path);
~SafeBaseName();
// 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 = SafeBaseNamePtr>
SafeBaseNamePtr 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, SafeBaseName::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, SafeBaseName::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, SafeBaseName::EnableIfSame<T>* = nullptr>
bool operator!=(const T& rhs) const { return !operator==(rhs); }
template <typename UserType>
static std::vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
SafeBaseName::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
SafeBaseName::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::SafeBaseName_UnserializedMessageContext<
UserType, SafeBaseName::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<SafeBaseName::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return SafeBaseName::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::SafeBaseName_UnserializedMessageContext<
UserType, SafeBaseName::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<SafeBaseName::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
// @generated_from: mojo_base.mojom.SafeBaseName.path
::base::FilePath 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, SafeBaseName::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, SafeBaseName::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, SafeBaseName::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, SafeBaseName::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
SafeBaseNamePtr SafeBaseName::Clone() const {
return New(
mojo::Clone(path)
);
}
template <typename T, SafeBaseName::EnableIfSame<T>*>
bool SafeBaseName::Equals(const T& other_struct) const {
if (!mojo::Equals(this->path, other_struct.path))
return false;
return true;
}
template <typename T, SafeBaseName::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 COMPONENT_EXPORT(MOJO_BASE_MOJOM) StructTraits<::mojo_base::mojom::SafeBaseName::DataView,
::mojo_base::mojom::SafeBaseNamePtr> {
static bool IsNull(const ::mojo_base::mojom::SafeBaseNamePtr& input) { return !input; }
static void SetToNull(::mojo_base::mojom::SafeBaseNamePtr* output) { output->reset(); }
static const decltype(::mojo_base::mojom::SafeBaseName::path)& path(
const ::mojo_base::mojom::SafeBaseNamePtr& input) {
return input->path;
}
static bool Read(::mojo_base::mojom::SafeBaseName::DataView input, ::mojo_base::mojom::SafeBaseNamePtr* output);
};
} // namespace mojo
#endif // MOJO_PUBLIC_MOJOM_BASE_SAFE_BASE_NAME_MOJOM_H_
/* Metadata comment
eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi
ZWdpbiI6IDE0OTksICJlbmQiOiAxNTExLCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1vam9tIiwg
ImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hyb21pdW0v
c3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJtb2pvX2Jhc2UubW9qb20uU2FmZUJhc2VOYW1lIn0s
ICJlZGdlIjogIiUva3l0aGUvZWRnZS9nZW5lcmF0ZXMifSwgeyJ0eXBlIjogImFuY2hvcl9kZWZp
bmVzIiwgImJlZ2luIjogNTI1NywgImVuZCI6IDUyNjEsICJ2bmFtZSI6IHsibGFuZ3VhZ2UiOiAi
bW9qb20iLCAiY29ycHVzIjogImNocm9taXVtLmdvb2dsZXNvdXJjZS5jb20vY29kZXNlYXJjaC9j
aHJvbWl1bS9zcmMvL21haW4iLCAic2lnbmF0dXJlIjogIm1vam9fYmFzZS5tb2pvbS5TYWZlQmFz
ZU5hbWUucGF0aCJ9LCAiZWRnZSI6ICIlL2t5dGhlL2VkZ2UvZ2VuZXJhdGVzIn1dfQ==
*/