blob: f1f998f40ccb156bca10a1d898eb14f704c34b0c [file] [log] [blame]
// ml/mojom/text_classifier.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 ML_MOJOM_TEXT_CLASSIFIER_MOJOM_H_
#define ML_MOJOM_TEXT_CLASSIFIER_MOJOM_H_
#include <stdint.h>
#include <limits>
#include <type_traits>
#include <utility>
#include "third_party/abseil-cpp/absl/types/optional.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 "ml/mojom/text_classifier.mojom-shared.h"
#include "ml/mojom/text_classifier.mojom-forward.h"
#include "ml/mojom/time.mojom.h"
#include <string>
#include <vector>
#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
namespace chromeos {
namespace machine_learning {
namespace mojom {
class TextClassifierProxy;
template <typename ImplRefTraits>
class TextClassifierStub;
class TextClassifierRequestValidator;
class TextClassifierResponseValidator;
class TextClassifier
: public TextClassifierInterfaceBase {
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_ = TextClassifierInterfaceBase;
using Proxy_ = TextClassifierProxy;
template <typename ImplRefTraits>
using Stub_ = TextClassifierStub<ImplRefTraits>;
using RequestValidator_ = TextClassifierRequestValidator;
using ResponseValidator_ = TextClassifierResponseValidator;
enum MethodMinVersions : uint32_t {
kAnnotateMinVersion = 0,
kFindLanguagesMinVersion = 0,
kREMOVED_1MinVersion = 0,
};
// 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)
struct Annotate_Sym {
NOINLINE static uint32_t IPCStableHash();
};
struct FindLanguages_Sym {
NOINLINE static uint32_t IPCStableHash();
};
struct REMOVED_1_Sym {
NOINLINE static uint32_t IPCStableHash();
};
#endif // !BUILDFLAG(IS_FUCHSIA)
virtual ~TextClassifier() = default;
using AnnotateCallback = base::OnceCallback<void(std::vector<TextAnnotationPtr>)>;
virtual void Annotate(TextAnnotationRequestPtr request, AnnotateCallback callback) = 0;
using FindLanguagesCallback = base::OnceCallback<void(std::vector<TextLanguagePtr>)>;
virtual void FindLanguages(const std::string& text, FindLanguagesCallback callback) = 0;
using REMOVED_1Callback = base::OnceCallback<void(CodepointSpanPtr)>;
virtual void REMOVED_1(REMOVED_TextSuggestSelectionRequestPtr request, REMOVED_1Callback callback) = 0;
};
class TextClassifierProxy
: public TextClassifier {
public:
using InterfaceType = TextClassifier;
explicit TextClassifierProxy(mojo::MessageReceiverWithResponder* receiver);
void Annotate(TextAnnotationRequestPtr request, AnnotateCallback callback) final;
void FindLanguages(const std::string& text, FindLanguagesCallback callback) final;
void REMOVED_1(REMOVED_TextSuggestSelectionRequestPtr request, REMOVED_1Callback callback) final;
private:
mojo::MessageReceiverWithResponder* receiver_;
};
class TextClassifierStubDispatch {
public:
static bool Accept(TextClassifier* impl, mojo::Message* message);
static bool AcceptWithResponder(
TextClassifier* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};
template <typename ImplRefTraits =
mojo::RawPtrImplRefTraits<TextClassifier>>
class TextClassifierStub
: public mojo::MessageReceiverWithResponderStatus {
public:
using ImplPointerType = typename ImplRefTraits::PointerType;
TextClassifierStub() = default;
~TextClassifierStub() 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 TextClassifierStubDispatch::Accept(
ImplRefTraits::GetRawPointer(&sink_), message);
}
bool AcceptWithResponder(
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
if (ImplRefTraits::IsNull(sink_))
return false;
return TextClassifierStubDispatch::AcceptWithResponder(
ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
}
private:
ImplPointerType sink_;
};
class TextClassifierRequestValidator : public mojo::MessageReceiver {
public:
bool Accept(mojo::Message* message) override;
};
class TextClassifierResponseValidator : public mojo::MessageReceiver {
public:
bool Accept(mojo::Message* message) override;
};
class CodepointSpan {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<CodepointSpan, T>::value>;
using DataView = CodepointSpanDataView;
using Data_ = internal::CodepointSpan_Data;
template <typename... Args>
static CodepointSpanPtr New(Args&&... args) {
return CodepointSpanPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static CodepointSpanPtr From(const U& u) {
return mojo::TypeConverter<CodepointSpanPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, CodepointSpan>::Convert(*this);
}
CodepointSpan();
CodepointSpan(
uint32_t start_offset,
uint32_t end_offset);
~CodepointSpan();
// 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 = CodepointSpanPtr>
CodepointSpanPtr 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, CodepointSpan::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, CodepointSpan::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, CodepointSpan::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<
CodepointSpan::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
CodepointSpan::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::CodepointSpan_UnserializedMessageContext<
UserType, CodepointSpan::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<CodepointSpan::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return CodepointSpan::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::CodepointSpan_UnserializedMessageContext<
UserType, CodepointSpan::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<CodepointSpan::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
uint32_t start_offset;
uint32_t end_offset;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto_libchrome::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, CodepointSpan::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, CodepointSpan::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, CodepointSpan::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, CodepointSpan::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
class TextLanguage {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<TextLanguage, T>::value>;
using DataView = TextLanguageDataView;
using Data_ = internal::TextLanguage_Data;
template <typename... Args>
static TextLanguagePtr New(Args&&... args) {
return TextLanguagePtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static TextLanguagePtr From(const U& u) {
return mojo::TypeConverter<TextLanguagePtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, TextLanguage>::Convert(*this);
}
TextLanguage();
TextLanguage(
const std::string& locale,
float confidence);
~TextLanguage();
// 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 = TextLanguagePtr>
TextLanguagePtr 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, TextLanguage::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, TextLanguage::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, TextLanguage::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<
TextLanguage::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
TextLanguage::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::TextLanguage_UnserializedMessageContext<
UserType, TextLanguage::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<TextLanguage::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return TextLanguage::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::TextLanguage_UnserializedMessageContext<
UserType, TextLanguage::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<TextLanguage::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
std::string locale;
float confidence;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto_libchrome::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, TextLanguage::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, TextLanguage::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, TextLanguage::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, TextLanguage::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
class TextEntityData {
public:
using DataView = TextEntityDataDataView;
using Data_ = internal::TextEntityData_Data;
using Tag = Data_::TextEntityData_Tag;
template <typename... Args>
static TextEntityDataPtr New(Args&&... args) {
static_assert(
sizeof...(args) < 0,
"Do not use Union::New(); to create a union of a given subtype, use "
"New<SubType>(), not New() followed by set_<sub_type>(). To represent "
"an empty union, mark the field or parameter as nullable in the mojom "
"definition.");
return nullptr;
}
// Construct an instance holding |numeric_value|.
static TextEntityDataPtr
NewNumericValue(
double numeric_value) {
auto result = TextEntityDataPtr(absl::in_place);
result->set_numeric_value(std::move(numeric_value));
return result;
}
// Construct an instance holding |string_value|.
static TextEntityDataPtr
NewStringValue(
const std::string& string_value) {
auto result = TextEntityDataPtr(absl::in_place);
result->set_string_value(std::move(string_value));
return result;
}
template <typename U>
static TextEntityDataPtr From(const U& u) {
return mojo::TypeConverter<TextEntityDataPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, TextEntityData>::Convert(*this);
}
TextEntityData();
~TextEntityData();
// Delete the copy constructor and copy assignment operators because `data_`
// contains raw pointers that must not be copied.
TextEntityData(const TextEntityData& other) = delete;
TextEntityData& operator=(const TextEntityData& other) = delete;
// 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 UnionPtrType = TextEntityDataPtr>
TextEntityDataPtr 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,
typename std::enable_if<std::is_same<
T, TextEntityData>::value>::type* = nullptr>
bool Equals(const T& other) const;
template <typename T,
typename std::enable_if<std::is_same<
T, TextEntityData>::value>::type* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
size_t Hash(size_t seed) const;
Tag which() const {
return tag_;
}
bool is_numeric_value() const { return tag_ == Tag::kNumericValue; }
double get_numeric_value() const {
CHECK(tag_ == Tag::kNumericValue);
return data_.numeric_value;
}
void set_numeric_value(
double numeric_value);
bool is_string_value() const { return tag_ == Tag::kStringValue; }
std::string& get_string_value() const {
CHECK(tag_ == Tag::kStringValue);
return *(data_.string_value);
}
void set_string_value(
const std::string& string_value);
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
TextEntityData::DataView>(input);
}
template <typename UserType>
static bool DeserializeFromMessage(mojo::Message input,
UserType* output) {
return mojo::internal::DeserializeImpl<TextEntityData::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
private:
union Union_ {
Union_() = default;
~Union_() = default;
double numeric_value;
std::string* string_value;
};
static bool Validate(const void* data,
mojo::internal::ValidationContext* validation_context);
void DestroyActive();
Tag tag_;
Union_ data_;
};
class TextEntity {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<TextEntity, T>::value>;
using DataView = TextEntityDataView;
using Data_ = internal::TextEntity_Data;
template <typename... Args>
static TextEntityPtr New(Args&&... args) {
return TextEntityPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static TextEntityPtr From(const U& u) {
return mojo::TypeConverter<TextEntityPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, TextEntity>::Convert(*this);
}
TextEntity();
TextEntity(
const std::string& name,
float confidence_score,
TextEntityDataPtr data);
TextEntity(const TextEntity&) = delete;
TextEntity& operator=(const TextEntity&) = delete;
~TextEntity();
// 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 = TextEntityPtr>
TextEntityPtr 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, TextEntity::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, TextEntity::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, TextEntity::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<
TextEntity::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
TextEntity::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::TextEntity_UnserializedMessageContext<
UserType, TextEntity::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<TextEntity::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return TextEntity::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::TextEntity_UnserializedMessageContext<
UserType, TextEntity::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<TextEntity::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
std::string name;
float confidence_score;
TextEntityDataPtr data;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto_libchrome::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, TextEntity::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, TextEntity::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, TextEntity::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, TextEntity::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
class TextAnnotation {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<TextAnnotation, T>::value>;
using DataView = TextAnnotationDataView;
using Data_ = internal::TextAnnotation_Data;
template <typename... Args>
static TextAnnotationPtr New(Args&&... args) {
return TextAnnotationPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static TextAnnotationPtr From(const U& u) {
return mojo::TypeConverter<TextAnnotationPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, TextAnnotation>::Convert(*this);
}
TextAnnotation();
TextAnnotation(
uint32_t start_offset,
uint32_t end_offset,
std::vector<TextEntityPtr> entities);
TextAnnotation(const TextAnnotation&) = delete;
TextAnnotation& operator=(const TextAnnotation&) = delete;
~TextAnnotation();
// 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 = TextAnnotationPtr>
TextAnnotationPtr 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, TextAnnotation::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, TextAnnotation::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, TextAnnotation::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<
TextAnnotation::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
TextAnnotation::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::TextAnnotation_UnserializedMessageContext<
UserType, TextAnnotation::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<TextAnnotation::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return TextAnnotation::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::TextAnnotation_UnserializedMessageContext<
UserType, TextAnnotation::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<TextAnnotation::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
uint32_t start_offset;
uint32_t end_offset;
std::vector<TextEntityPtr> entities;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto_libchrome::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, TextAnnotation::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, TextAnnotation::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, TextAnnotation::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, TextAnnotation::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
class TextAnnotationRequest {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<TextAnnotationRequest, T>::value>;
using DataView = TextAnnotationRequestDataView;
using Data_ = internal::TextAnnotationRequest_Data;
template <typename... Args>
static TextAnnotationRequestPtr New(Args&&... args) {
return TextAnnotationRequestPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static TextAnnotationRequestPtr From(const U& u) {
return mojo::TypeConverter<TextAnnotationRequestPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, TextAnnotationRequest>::Convert(*this);
}
TextAnnotationRequest();
TextAnnotationRequest(
const std::string& text,
const absl::optional<std::string>& default_locales,
const absl::optional<std::string>& detected_text_language_tags,
AnnotationUsecase annotation_usecase,
absl::optional<base::Time> reference_time,
const absl::optional<std::string>& reference_timezone,
absl::optional<std::vector<std::string>> enabled_entities);
TextAnnotationRequest(
const std::string& text,
const absl::optional<std::string>& default_locales,
const absl::optional<std::string>& detected_text_language_tags,
AnnotationUsecase annotation_usecase,
absl::optional<base::Time> reference_time,
const absl::optional<std::string>& reference_timezone,
absl::optional<std::vector<std::string>> enabled_entities,
bool trigger_dictionary_on_beginner_words);
~TextAnnotationRequest();
// 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 = TextAnnotationRequestPtr>
TextAnnotationRequestPtr 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, TextAnnotationRequest::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, TextAnnotationRequest::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, TextAnnotationRequest::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<
TextAnnotationRequest::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
TextAnnotationRequest::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::TextAnnotationRequest_UnserializedMessageContext<
UserType, TextAnnotationRequest::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<TextAnnotationRequest::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return TextAnnotationRequest::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::TextAnnotationRequest_UnserializedMessageContext<
UserType, TextAnnotationRequest::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<TextAnnotationRequest::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
std::string text;
absl::optional<std::string> default_locales;
absl::optional<std::string> detected_text_language_tags;
AnnotationUsecase annotation_usecase;
absl::optional<base::Time> reference_time;
absl::optional<std::string> reference_timezone;
absl::optional<std::vector<std::string>> enabled_entities;
bool trigger_dictionary_on_beginner_words;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto_libchrome::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, TextAnnotationRequest::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, TextAnnotationRequest::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, TextAnnotationRequest::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, TextAnnotationRequest::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
class REMOVED_TextSuggestSelectionRequest {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<REMOVED_TextSuggestSelectionRequest, T>::value>;
using DataView = REMOVED_TextSuggestSelectionRequestDataView;
using Data_ = internal::REMOVED_TextSuggestSelectionRequest_Data;
template <typename... Args>
static REMOVED_TextSuggestSelectionRequestPtr New(Args&&... args) {
return REMOVED_TextSuggestSelectionRequestPtr(
absl::in_place, std::forward<Args>(args)...);
}
template <typename U>
static REMOVED_TextSuggestSelectionRequestPtr From(const U& u) {
return mojo::TypeConverter<REMOVED_TextSuggestSelectionRequestPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, REMOVED_TextSuggestSelectionRequest>::Convert(*this);
}
REMOVED_TextSuggestSelectionRequest();
REMOVED_TextSuggestSelectionRequest(
const std::string& text,
CodepointSpanPtr user_selection,
const absl::optional<std::string>& default_locales,
const absl::optional<std::string>& detected_text_language_tags,
AnnotationUsecase annotation_usecase);
REMOVED_TextSuggestSelectionRequest(const REMOVED_TextSuggestSelectionRequest&) = delete;
REMOVED_TextSuggestSelectionRequest& operator=(const REMOVED_TextSuggestSelectionRequest&) = delete;
~REMOVED_TextSuggestSelectionRequest();
// 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 = REMOVED_TextSuggestSelectionRequestPtr>
REMOVED_TextSuggestSelectionRequestPtr 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, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
template <typename T, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>* = nullptr>
bool operator==(const T& rhs) const { return Equals(rhs); }
template <typename T, REMOVED_TextSuggestSelectionRequest::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<
REMOVED_TextSuggestSelectionRequest::DataView, std::vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
REMOVED_TextSuggestSelectionRequest::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::REMOVED_TextSuggestSelectionRequest_UnserializedMessageContext<
UserType, REMOVED_TextSuggestSelectionRequest::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<REMOVED_TextSuggestSelectionRequest::DataView>(
message, data, data_num_bytes, output, Validate);
}
template <typename UserType>
static bool Deserialize(const std::vector<uint8_t>& input,
UserType* output) {
return REMOVED_TextSuggestSelectionRequest::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::REMOVED_TextSuggestSelectionRequest_UnserializedMessageContext<
UserType, REMOVED_TextSuggestSelectionRequest::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<REMOVED_TextSuggestSelectionRequest::DataView>(
input, input.payload(), input.payload_num_bytes(), output, Validate);
}
std::string text;
CodepointSpanPtr user_selection;
absl::optional<std::string> default_locales;
absl::optional<std::string> detected_text_language_tags;
AnnotationUsecase annotation_usecase;
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto_libchrome::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, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename UnionPtrType>
TextEntityDataPtr TextEntityData::Clone() const {
switch (tag_) {
case Tag::kNumericValue:
return NewNumericValue(
mojo::Clone(data_.numeric_value));
case Tag::kStringValue:
return NewStringValue(
mojo::Clone(*data_.string_value));
}
return nullptr;
}
template <typename T,
typename std::enable_if<std::is_same<
T, TextEntityData>::value>::type*>
bool TextEntityData::Equals(const T& other) const {
if (tag_ != other.which())
return false;
switch (tag_) {
case Tag::kNumericValue:
return mojo::Equals(data_.numeric_value, other.data_.numeric_value);
case Tag::kStringValue:
return mojo::Equals(*(data_.string_value), *(other.data_.string_value));
}
return false;
}
template <typename StructPtrType>
TextEntityPtr TextEntity::Clone() const {
return New(
mojo::Clone(name),
mojo::Clone(confidence_score),
mojo::Clone(data)
);
}
template <typename T, TextEntity::EnableIfSame<T>*>
bool TextEntity::Equals(const T& other_struct) const {
if (!mojo::Equals(this->name, other_struct.name))
return false;
if (!mojo::Equals(this->confidence_score, other_struct.confidence_score))
return false;
if (!mojo::Equals(this->data, other_struct.data))
return false;
return true;
}
template <typename T, TextEntity::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.name < rhs.name)
return true;
if (rhs.name < lhs.name)
return false;
if (lhs.confidence_score < rhs.confidence_score)
return true;
if (rhs.confidence_score < lhs.confidence_score)
return false;
if (lhs.data < rhs.data)
return true;
if (rhs.data < lhs.data)
return false;
return false;
}
template <typename StructPtrType>
TextAnnotationPtr TextAnnotation::Clone() const {
return New(
mojo::Clone(start_offset),
mojo::Clone(end_offset),
mojo::Clone(entities)
);
}
template <typename T, TextAnnotation::EnableIfSame<T>*>
bool TextAnnotation::Equals(const T& other_struct) const {
if (!mojo::Equals(this->start_offset, other_struct.start_offset))
return false;
if (!mojo::Equals(this->end_offset, other_struct.end_offset))
return false;
if (!mojo::Equals(this->entities, other_struct.entities))
return false;
return true;
}
template <typename T, TextAnnotation::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.start_offset < rhs.start_offset)
return true;
if (rhs.start_offset < lhs.start_offset)
return false;
if (lhs.end_offset < rhs.end_offset)
return true;
if (rhs.end_offset < lhs.end_offset)
return false;
if (lhs.entities < rhs.entities)
return true;
if (rhs.entities < lhs.entities)
return false;
return false;
}
template <typename StructPtrType>
TextAnnotationRequestPtr TextAnnotationRequest::Clone() const {
return New(
mojo::Clone(text),
mojo::Clone(default_locales),
mojo::Clone(detected_text_language_tags),
mojo::Clone(annotation_usecase),
mojo::Clone(reference_time),
mojo::Clone(reference_timezone),
mojo::Clone(enabled_entities),
mojo::Clone(trigger_dictionary_on_beginner_words)
);
}
template <typename T, TextAnnotationRequest::EnableIfSame<T>*>
bool TextAnnotationRequest::Equals(const T& other_struct) const {
if (!mojo::Equals(this->text, other_struct.text))
return false;
if (!mojo::Equals(this->default_locales, other_struct.default_locales))
return false;
if (!mojo::Equals(this->detected_text_language_tags, other_struct.detected_text_language_tags))
return false;
if (!mojo::Equals(this->annotation_usecase, other_struct.annotation_usecase))
return false;
if (!mojo::Equals(this->reference_time, other_struct.reference_time))
return false;
if (!mojo::Equals(this->reference_timezone, other_struct.reference_timezone))
return false;
if (!mojo::Equals(this->enabled_entities, other_struct.enabled_entities))
return false;
if (!mojo::Equals(this->trigger_dictionary_on_beginner_words, other_struct.trigger_dictionary_on_beginner_words))
return false;
return true;
}
template <typename T, TextAnnotationRequest::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.text < rhs.text)
return true;
if (rhs.text < lhs.text)
return false;
if (lhs.default_locales < rhs.default_locales)
return true;
if (rhs.default_locales < lhs.default_locales)
return false;
if (lhs.detected_text_language_tags < rhs.detected_text_language_tags)
return true;
if (rhs.detected_text_language_tags < lhs.detected_text_language_tags)
return false;
if (lhs.annotation_usecase < rhs.annotation_usecase)
return true;
if (rhs.annotation_usecase < lhs.annotation_usecase)
return false;
if (lhs.reference_time < rhs.reference_time)
return true;
if (rhs.reference_time < lhs.reference_time)
return false;
if (lhs.reference_timezone < rhs.reference_timezone)
return true;
if (rhs.reference_timezone < lhs.reference_timezone)
return false;
if (lhs.enabled_entities < rhs.enabled_entities)
return true;
if (rhs.enabled_entities < lhs.enabled_entities)
return false;
if (lhs.trigger_dictionary_on_beginner_words < rhs.trigger_dictionary_on_beginner_words)
return true;
if (rhs.trigger_dictionary_on_beginner_words < lhs.trigger_dictionary_on_beginner_words)
return false;
return false;
}
template <typename StructPtrType>
CodepointSpanPtr CodepointSpan::Clone() const {
return New(
mojo::Clone(start_offset),
mojo::Clone(end_offset)
);
}
template <typename T, CodepointSpan::EnableIfSame<T>*>
bool CodepointSpan::Equals(const T& other_struct) const {
if (!mojo::Equals(this->start_offset, other_struct.start_offset))
return false;
if (!mojo::Equals(this->end_offset, other_struct.end_offset))
return false;
return true;
}
template <typename T, CodepointSpan::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.start_offset < rhs.start_offset)
return true;
if (rhs.start_offset < lhs.start_offset)
return false;
if (lhs.end_offset < rhs.end_offset)
return true;
if (rhs.end_offset < lhs.end_offset)
return false;
return false;
}
template <typename StructPtrType>
TextLanguagePtr TextLanguage::Clone() const {
return New(
mojo::Clone(locale),
mojo::Clone(confidence)
);
}
template <typename T, TextLanguage::EnableIfSame<T>*>
bool TextLanguage::Equals(const T& other_struct) const {
if (!mojo::Equals(this->locale, other_struct.locale))
return false;
if (!mojo::Equals(this->confidence, other_struct.confidence))
return false;
return true;
}
template <typename T, TextLanguage::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.locale < rhs.locale)
return true;
if (rhs.locale < lhs.locale)
return false;
if (lhs.confidence < rhs.confidence)
return true;
if (rhs.confidence < lhs.confidence)
return false;
return false;
}
template <typename StructPtrType>
REMOVED_TextSuggestSelectionRequestPtr REMOVED_TextSuggestSelectionRequest::Clone() const {
return New(
mojo::Clone(text),
mojo::Clone(user_selection),
mojo::Clone(default_locales),
mojo::Clone(detected_text_language_tags),
mojo::Clone(annotation_usecase)
);
}
template <typename T, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>*>
bool REMOVED_TextSuggestSelectionRequest::Equals(const T& other_struct) const {
if (!mojo::Equals(this->text, other_struct.text))
return false;
if (!mojo::Equals(this->user_selection, other_struct.user_selection))
return false;
if (!mojo::Equals(this->default_locales, other_struct.default_locales))
return false;
if (!mojo::Equals(this->detected_text_language_tags, other_struct.detected_text_language_tags))
return false;
if (!mojo::Equals(this->annotation_usecase, other_struct.annotation_usecase))
return false;
return true;
}
template <typename T, REMOVED_TextSuggestSelectionRequest::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.text < rhs.text)
return true;
if (rhs.text < lhs.text)
return false;
if (lhs.user_selection < rhs.user_selection)
return true;
if (rhs.user_selection < lhs.user_selection)
return false;
if (lhs.default_locales < rhs.default_locales)
return true;
if (rhs.default_locales < lhs.default_locales)
return false;
if (lhs.detected_text_language_tags < rhs.detected_text_language_tags)
return true;
if (rhs.detected_text_language_tags < lhs.detected_text_language_tags)
return false;
if (lhs.annotation_usecase < rhs.annotation_usecase)
return true;
if (rhs.annotation_usecase < lhs.annotation_usecase)
return false;
return false;
}
} // namespace mojom
} // namespace machine_learning
} // namespace chromeos
namespace mojo {
template <>
struct StructTraits<::chromeos::machine_learning::mojom::TextEntity::DataView,
::chromeos::machine_learning::mojom::TextEntityPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::TextEntityPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::TextEntityPtr* output) { output->reset(); }
static const decltype(::chromeos::machine_learning::mojom::TextEntity::name)& name(
const ::chromeos::machine_learning::mojom::TextEntityPtr& input) {
return input->name;
}
static decltype(::chromeos::machine_learning::mojom::TextEntity::confidence_score) confidence_score(
const ::chromeos::machine_learning::mojom::TextEntityPtr& input) {
return input->confidence_score;
}
static const decltype(::chromeos::machine_learning::mojom::TextEntity::data)& data(
const ::chromeos::machine_learning::mojom::TextEntityPtr& input) {
return input->data;
}
static bool Read(::chromeos::machine_learning::mojom::TextEntity::DataView input, ::chromeos::machine_learning::mojom::TextEntityPtr* output);
};
template <>
struct StructTraits<::chromeos::machine_learning::mojom::TextAnnotation::DataView,
::chromeos::machine_learning::mojom::TextAnnotationPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::TextAnnotationPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::TextAnnotationPtr* output) { output->reset(); }
static decltype(::chromeos::machine_learning::mojom::TextAnnotation::start_offset) start_offset(
const ::chromeos::machine_learning::mojom::TextAnnotationPtr& input) {
return input->start_offset;
}
static decltype(::chromeos::machine_learning::mojom::TextAnnotation::end_offset) end_offset(
const ::chromeos::machine_learning::mojom::TextAnnotationPtr& input) {
return input->end_offset;
}
static const decltype(::chromeos::machine_learning::mojom::TextAnnotation::entities)& entities(
const ::chromeos::machine_learning::mojom::TextAnnotationPtr& input) {
return input->entities;
}
static bool Read(::chromeos::machine_learning::mojom::TextAnnotation::DataView input, ::chromeos::machine_learning::mojom::TextAnnotationPtr* output);
};
template <>
struct StructTraits<::chromeos::machine_learning::mojom::TextAnnotationRequest::DataView,
::chromeos::machine_learning::mojom::TextAnnotationRequestPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::TextAnnotationRequestPtr* output) { output->reset(); }
static const decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::text)& text(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->text;
}
static const decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::default_locales)& default_locales(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->default_locales;
}
static const decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::detected_text_language_tags)& detected_text_language_tags(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->detected_text_language_tags;
}
static decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::annotation_usecase) annotation_usecase(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->annotation_usecase;
}
static const decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::reference_time)& reference_time(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->reference_time;
}
static const decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::reference_timezone)& reference_timezone(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->reference_timezone;
}
static const decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::enabled_entities)& enabled_entities(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->enabled_entities;
}
static decltype(::chromeos::machine_learning::mojom::TextAnnotationRequest::trigger_dictionary_on_beginner_words) trigger_dictionary_on_beginner_words(
const ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr& input) {
return input->trigger_dictionary_on_beginner_words;
}
static bool Read(::chromeos::machine_learning::mojom::TextAnnotationRequest::DataView input, ::chromeos::machine_learning::mojom::TextAnnotationRequestPtr* output);
};
template <>
struct StructTraits<::chromeos::machine_learning::mojom::CodepointSpan::DataView,
::chromeos::machine_learning::mojom::CodepointSpanPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::CodepointSpanPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::CodepointSpanPtr* output) { output->reset(); }
static decltype(::chromeos::machine_learning::mojom::CodepointSpan::start_offset) start_offset(
const ::chromeos::machine_learning::mojom::CodepointSpanPtr& input) {
return input->start_offset;
}
static decltype(::chromeos::machine_learning::mojom::CodepointSpan::end_offset) end_offset(
const ::chromeos::machine_learning::mojom::CodepointSpanPtr& input) {
return input->end_offset;
}
static bool Read(::chromeos::machine_learning::mojom::CodepointSpan::DataView input, ::chromeos::machine_learning::mojom::CodepointSpanPtr* output);
};
template <>
struct StructTraits<::chromeos::machine_learning::mojom::TextLanguage::DataView,
::chromeos::machine_learning::mojom::TextLanguagePtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::TextLanguagePtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::TextLanguagePtr* output) { output->reset(); }
static const decltype(::chromeos::machine_learning::mojom::TextLanguage::locale)& locale(
const ::chromeos::machine_learning::mojom::TextLanguagePtr& input) {
return input->locale;
}
static decltype(::chromeos::machine_learning::mojom::TextLanguage::confidence) confidence(
const ::chromeos::machine_learning::mojom::TextLanguagePtr& input) {
return input->confidence;
}
static bool Read(::chromeos::machine_learning::mojom::TextLanguage::DataView input, ::chromeos::machine_learning::mojom::TextLanguagePtr* output);
};
template <>
struct StructTraits<::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::DataView,
::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr* output) { output->reset(); }
static const decltype(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::text)& text(
const ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr& input) {
return input->text;
}
static const decltype(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::user_selection)& user_selection(
const ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr& input) {
return input->user_selection;
}
static const decltype(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::default_locales)& default_locales(
const ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr& input) {
return input->default_locales;
}
static const decltype(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::detected_text_language_tags)& detected_text_language_tags(
const ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr& input) {
return input->detected_text_language_tags;
}
static decltype(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::annotation_usecase) annotation_usecase(
const ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr& input) {
return input->annotation_usecase;
}
static bool Read(::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequest::DataView input, ::chromeos::machine_learning::mojom::REMOVED_TextSuggestSelectionRequestPtr* output);
};
template <>
struct UnionTraits<::chromeos::machine_learning::mojom::TextEntityData::DataView,
::chromeos::machine_learning::mojom::TextEntityDataPtr> {
static bool IsNull(const ::chromeos::machine_learning::mojom::TextEntityDataPtr& input) { return !input; }
static void SetToNull(::chromeos::machine_learning::mojom::TextEntityDataPtr* output) { output->reset(); }
static ::chromeos::machine_learning::mojom::TextEntityData::Tag GetTag(const ::chromeos::machine_learning::mojom::TextEntityDataPtr& input) {
return input->which();
}
static double numeric_value(const ::chromeos::machine_learning::mojom::TextEntityDataPtr& input) {
return input->get_numeric_value();
}
static const std::string& string_value(const ::chromeos::machine_learning::mojom::TextEntityDataPtr& input) {
return input->get_string_value();
}
static bool Read(::chromeos::machine_learning::mojom::TextEntityData::DataView input, ::chromeos::machine_learning::mojom::TextEntityDataPtr* output);
};
} // namespace mojo
#endif // ML_MOJOM_TEXT_CLASSIFIER_MOJOM_H_