blob: fc76663e3effa2746760eda13220e133e5340654 [file] [log] [blame]
// mojo/public/interfaces/bindings/tests/test_constants.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_INTERFACES_BINDINGS_TESTS_TEST_CONSTANTS_MOJOM_H_
#define MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_TEST_CONSTANTS_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/interfaces/bindings/tests/test_constants.mojom-features.h"
#include "mojo/public/interfaces/bindings/tests/test_constants.mojom-shared.h"
#include "mojo/public/interfaces/bindings/tests/test_constants.mojom-forward.h"
#include <string>
#include <vector>
#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/lib/message_size_estimator.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
#ifdef KYTHE_IS_RUNNING
#pragma kythe_inline_metadata "Metadata comment"
#endif
namespace mojo::test {
class InterfaceWithConstantsProxy;
template <typename ImplRefTraits>
class InterfaceWithConstantsStub;
class InterfaceWithConstantsRequestValidator;
// @generated_from: mojo.test.InterfaceWithConstants
class InterfaceWithConstants
: public InterfaceWithConstantsInterfaceBase {
public:
using IPCStableHashFunction = uint32_t(*)();
static const char Name_[];
static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
static const char* MessageToMethodName_(mojo::Message& message);
static constexpr uint32_t Version_ = 0;
static constexpr bool PassesAssociatedKinds_ = false;
static constexpr bool HasUninterruptableMethods_ = false;
using Base_ = InterfaceWithConstantsInterfaceBase;
using Proxy_ = InterfaceWithConstantsProxy;
template <typename ImplRefTraits>
using Stub_ = InterfaceWithConstantsStub<ImplRefTraits>;
using RequestValidator_ = InterfaceWithConstantsRequestValidator;
using ResponseValidator_ = mojo::PassThroughFilter;
enum MethodMinVersions : uint32_t {
};
// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
#endif // !BUILDFLAG(IS_FUCHSIA)
// @generated_from: mojo.test.InterfaceWithConstants.kUint32Value
static constexpr uint32_t kUint32Value = 20100722U;
// @generated_from: mojo.test.InterfaceWithConstants.kDoubleValue
static constexpr double kDoubleValue = 12.34567;
// @generated_from: mojo.test.InterfaceWithConstants.kStringValue
static const char kStringValue[];
virtual ~InterfaceWithConstants() = default;
};
// @generated_from: mojo.test.InterfaceWithConstants
class InterfaceWithConstantsProxy
: public InterfaceWithConstants {
public:
using InterfaceType = InterfaceWithConstants;
explicit InterfaceWithConstantsProxy(mojo::MessageReceiverWithResponder* receiver);
private:
mojo::MessageReceiverWithResponder* receiver_;
};
class InterfaceWithConstantsStubDispatch {
public:
static bool Accept(InterfaceWithConstants* impl, mojo::Message* message);
static bool AcceptWithResponder(
InterfaceWithConstants* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};
template <typename ImplRefTraits =
mojo::RawPtrImplRefTraits<InterfaceWithConstants>>
class InterfaceWithConstantsStub
: public mojo::MessageReceiverWithResponderStatus {
public:
using ImplPointerType = typename ImplRefTraits::PointerType;
InterfaceWithConstantsStub() = default;
~InterfaceWithConstantsStub() override = default;
void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
ImplPointerType& sink() { return sink_; }
bool Accept(mojo::Message* message) override {
if (ImplRefTraits::IsNull(sink_))
return false;
return InterfaceWithConstantsStubDispatch::Accept(
ImplRefTraits::GetRawPointer(&sink_), message);
}
bool AcceptWithResponder(
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
if (ImplRefTraits::IsNull(sink_))
return false;
return InterfaceWithConstantsStubDispatch::AcceptWithResponder(
ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
}
private:
ImplPointerType sink_;
};
class InterfaceWithConstantsRequestValidator : public mojo::MessageReceiver {
public:
bool Accept(mojo::Message* message) override;
};
// @generated_from: mojo.test.StructWithConstants
class StructWithConstants {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<StructWithConstants, T>::value>;
using DataView = StructWithConstantsDataView;
using Data_ = internal::StructWithConstants_Data;
// @generated_from: mojo.test.StructWithConstants.kInt8Value
static constexpr int8_t kInt8Value = 5;
// @generated_from: mojo.test.StructWithConstants.kFloatValue
static constexpr float kFloatValue = 765.432f;
// @generated_from: mojo.test.StructWithConstants.kStringValue
static const char kStringValue[];
template <typename... Args>
static StructWithConstantsPtr New(Args&&... args) {
return StructWithConstantsPtr(
std::in_place, std::forward<Args>(args)...);
}
template <typename U>
static StructWithConstantsPtr From(const U& u) {
return mojo::TypeConverter<StructWithConstantsPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, StructWithConstants>::Convert(*this);
}
StructWithConstants();
~StructWithConstants();
// 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 = StructWithConstantsPtr>
StructWithConstantsPtr 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, StructWithConstants::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, StructWithConstants::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, StructWithConstants::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<
StructWithConstants::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
StructWithConstants::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::StructWithConstants_UnserializedMessageContext<
UserType, StructWithConstants::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<StructWithConstants::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return StructWithConstants::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::StructWithConstants_UnserializedMessageContext<
UserType, StructWithConstants::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<StructWithConstants::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
// 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, StructWithConstants::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, StructWithConstants::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, StructWithConstants::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, StructWithConstants::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
StructWithConstantsPtr StructWithConstants::Clone() const {
return New(
);
}
template <typename T, StructWithConstants::EnableIfSame<T>*>
bool StructWithConstants::Equals(const T& other_struct) const {
return true;
}
template <typename T, StructWithConstants::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
return false;
}
} // mojo::test
namespace mojo {
template <>
struct StructTraits<::mojo::test::StructWithConstants::DataView,
::mojo::test::StructWithConstantsPtr> {
static bool IsNull(const ::mojo::test::StructWithConstantsPtr& input) { return !input; }
static void SetToNull(::mojo::test::StructWithConstantsPtr* output) { output->reset(); }
static bool Read(::mojo::test::StructWithConstants::DataView input, ::mojo::test::StructWithConstantsPtr* output);
};
} // namespace mojo
#endif // MOJO_PUBLIC_INTERFACES_BINDINGS_TESTS_TEST_CONSTANTS_MOJOM_H_
/* Metadata comment
eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi
ZWdpbiI6IDE3NDIsICJlbmQiOiAxNzY0LCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1vam9tIiwg
ImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hyb21pdW0v
c3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJtb2pvLnRlc3QuSW50ZXJmYWNlV2l0aENvbnN0YW50
cyJ9LCAiZWRnZSI6ICIlL2t5dGhlL2VkZ2UvZ2VuZXJhdGVzIn0sIHsidHlwZSI6ICJhbmNob3Jf
ZGVmaW5lcyIsICJiZWdpbiI6IDI4NDgsICJlbmQiOiAyODYwLCAidm5hbWUiOiB7Imxhbmd1YWdl
IjogIm1vam9tIiwgImNvcnB1cyI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