| // chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_exception.mojom-shared-internal.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 CHROMEOS_ASH_SERVICES_CROS_HEALTHD_PUBLIC_MOJOM_CROS_HEALTHD_EXCEPTION_MOJOM_SHARED_INTERNAL_H_ |
| #define CHROMEOS_ASH_SERVICES_CROS_HEALTHD_PUBLIC_MOJOM_CROS_HEALTHD_EXCEPTION_MOJOM_SHARED_INTERNAL_H_ |
| #include "mojo/public/cpp/bindings/lib/array_internal.h" |
| #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| #include "mojo/public/cpp/bindings/lib/map_data_internal.h" |
| #include "mojo/public/cpp/bindings/lib/buffer.h" |
| #include "mojo/public/cpp/bindings/lib/native_enum_data.h" |
| #include "mojo/public/interfaces/bindings/native_struct.mojom-shared-internal.h" |
| |
| |
| |
| namespace mojo { |
| namespace internal { |
| class ValidationContext; |
| } |
| } |
| |
| |
| namespace ash::cros_healthd::mojom { |
| namespace internal { |
| class Exception_Data; |
| class Supported_Data; |
| class Unsupported_Data; |
| class SupportStatus_Data; |
| class UnsupportedReason_Data; |
| |
| struct Exception_Reason_Data { |
| public: |
| static bool constexpr kIsExtensible = true; |
| |
| static bool IsKnownValue(int32_t value) { |
| switch (value) { |
| case 0: |
| case 1: |
| case 2: |
| case 3: |
| return true; |
| } |
| return false; |
| } |
| |
| static bool Validate(int32_t value, |
| mojo::internal::ValidationContext* validation_context) { |
| if (kIsExtensible || IsKnownValue(value)) |
| return true; |
| |
| ReportValidationError(validation_context, |
| mojo::internal::VALIDATION_ERROR_UNKNOWN_ENUM_VALUE); |
| return false; |
| } |
| }; |
| |
| #pragma pack(push, 1) |
| |
| |
| class SupportStatus_Data { |
| public: |
| // Used to identify Mojom Union Data Classes. |
| typedef void MojomUnionDataType; |
| |
| SupportStatus_Data() = default; |
| // Do nothing in the destructor since it won't be called when it is a |
| // non-inlined union. |
| ~SupportStatus_Data() = default; |
| |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context, |
| bool inlined); |
| |
| bool is_null() const { return size == 0; } |
| |
| void set_null() { |
| size = 0U; |
| tag = static_cast<SupportStatus_Tag>(0); |
| data.unknown = 0U; |
| } |
| |
| // TODO(crbug.com/40731316): SHOUTY_CASE values are being deprecated per C++ code style |
| // guidelines (https://google.github.io/styleguide/cppguide.html#Enumerator_Names), |
| // please use kCamelCase values instead. Cleanup NULL_VALUE, BOOL_VALUE, INT_VALUE, etc. |
| // generation once codebase is transitioned to kNullValue, kBoolValue, kIntValue, etc. |
| enum class SupportStatus_Tag : uint32_t { |
| |
| |
| kUnmappedUnionField, |
| |
| kException, |
| |
| kSupported, |
| |
| kUnsupported, |
| }; |
| |
| // A note on layout: |
| // "Each non-static data member is allocated as if it were the sole member of |
| // a struct." - Section 9.5.2 ISO/IEC 14882:2011 (The C++ Spec) |
| union MOJO_ALIGNAS(8) Union_ { |
| Union_() : unknown(0) {} |
| int8_t f_unmapped_union_field; |
| mojo::internal::Pointer<internal::Exception_Data> f_exception; |
| mojo::internal::Pointer<internal::Supported_Data> f_supported; |
| mojo::internal::Pointer<internal::Unsupported_Data> f_unsupported; |
| uint64_t unknown; |
| }; |
| |
| uint32_t size; |
| SupportStatus_Tag tag; |
| Union_ data; |
| }; |
| static_assert(sizeof(SupportStatus_Data) == mojo::internal::kUnionDataSize, |
| "Bad sizeof(SupportStatus_Data)"); |
| |
| |
| class UnsupportedReason_Data { |
| public: |
| // Used to identify Mojom Union Data Classes. |
| typedef void MojomUnionDataType; |
| |
| UnsupportedReason_Data() = default; |
| // Do nothing in the destructor since it won't be called when it is a |
| // non-inlined union. |
| ~UnsupportedReason_Data() = default; |
| |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context, |
| bool inlined); |
| |
| bool is_null() const { return size == 0; } |
| |
| void set_null() { |
| size = 0U; |
| tag = static_cast<UnsupportedReason_Tag>(0); |
| data.unknown = 0U; |
| } |
| |
| // TODO(crbug.com/40731316): SHOUTY_CASE values are being deprecated per C++ code style |
| // guidelines (https://google.github.io/styleguide/cppguide.html#Enumerator_Names), |
| // please use kCamelCase values instead. Cleanup NULL_VALUE, BOOL_VALUE, INT_VALUE, etc. |
| // generation once codebase is transitioned to kNullValue, kBoolValue, kIntValue, etc. |
| enum class UnsupportedReason_Tag : uint32_t { |
| |
| |
| kUnmappedUnionField, |
| }; |
| |
| // A note on layout: |
| // "Each non-static data member is allocated as if it were the sole member of |
| // a struct." - Section 9.5.2 ISO/IEC 14882:2011 (The C++ Spec) |
| union MOJO_ALIGNAS(8) Union_ { |
| Union_() : unknown(0) {} |
| int8_t f_unmapped_union_field; |
| uint64_t unknown; |
| }; |
| |
| uint32_t size; |
| UnsupportedReason_Tag tag; |
| Union_ data; |
| }; |
| static_assert(sizeof(UnsupportedReason_Data) == mojo::internal::kUnionDataSize, |
| "Bad sizeof(UnsupportedReason_Data)"); |
| class Exception_Data { |
| public: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| |
| mojo::internal::StructHeader header_; |
| int32_t reason; |
| uint8_t pad0_[4]; |
| mojo::internal::Pointer<mojo::internal::String_Data> debug_message; |
| |
| private: |
| friend class mojo::internal::MessageFragment<Exception_Data>; |
| |
| Exception_Data(); |
| ~Exception_Data() = delete; |
| }; |
| static_assert(sizeof(Exception_Data) == 24, |
| "Bad sizeof(Exception_Data)"); |
| // Used by Exception::WrapAsMessage to lazily serialize the struct. |
| template <typename UserType, typename DataView> |
| struct Exception_UnserializedMessageContext |
| : public mojo::internal::UnserializedMessageContext { |
| public: |
| static const mojo::internal::UnserializedMessageContext::Tag kMessageTag; |
| |
| Exception_UnserializedMessageContext( |
| uint32_t message_name, |
| uint32_t message_flags, |
| UserType input) |
| : mojo::internal::UnserializedMessageContext(&kMessageTag, message_name, message_flags) |
| , user_data_(std::move(input)) {} |
| ~Exception_UnserializedMessageContext() override = default; |
| |
| UserType TakeData() { |
| return std::move(user_data_); |
| } |
| |
| private: |
| // mojo::internal::UnserializedMessageContext: |
| void Serialize(mojo::Message& message) override { |
| mojo::internal::MessageFragment<Exception_Data> fragment(message); |
| mojo::internal::Serialize<DataView>(user_data_, fragment); |
| } |
| |
| UserType user_data_; |
| }; |
| |
| template <typename UserType, typename DataView> |
| const mojo::internal::UnserializedMessageContext::Tag |
| Exception_UnserializedMessageContext<UserType, DataView>::kMessageTag = {}; |
| class Supported_Data { |
| public: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| |
| mojo::internal::StructHeader header_; |
| |
| private: |
| friend class mojo::internal::MessageFragment<Supported_Data>; |
| |
| Supported_Data(); |
| ~Supported_Data() = delete; |
| }; |
| static_assert(sizeof(Supported_Data) == 8, |
| "Bad sizeof(Supported_Data)"); |
| // Used by Supported::WrapAsMessage to lazily serialize the struct. |
| template <typename UserType, typename DataView> |
| struct Supported_UnserializedMessageContext |
| : public mojo::internal::UnserializedMessageContext { |
| public: |
| static const mojo::internal::UnserializedMessageContext::Tag kMessageTag; |
| |
| Supported_UnserializedMessageContext( |
| uint32_t message_name, |
| uint32_t message_flags, |
| UserType input) |
| : mojo::internal::UnserializedMessageContext(&kMessageTag, message_name, message_flags) |
| , user_data_(std::move(input)) {} |
| ~Supported_UnserializedMessageContext() override = default; |
| |
| UserType TakeData() { |
| return std::move(user_data_); |
| } |
| |
| private: |
| // mojo::internal::UnserializedMessageContext: |
| void Serialize(mojo::Message& message) override { |
| mojo::internal::MessageFragment<Supported_Data> fragment(message); |
| mojo::internal::Serialize<DataView>(user_data_, fragment); |
| } |
| |
| UserType user_data_; |
| }; |
| |
| template <typename UserType, typename DataView> |
| const mojo::internal::UnserializedMessageContext::Tag |
| Supported_UnserializedMessageContext<UserType, DataView>::kMessageTag = {}; |
| class Unsupported_Data { |
| public: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| |
| mojo::internal::StructHeader header_; |
| mojo::internal::Pointer<mojo::internal::String_Data> debug_message; |
| internal::UnsupportedReason_Data reason; |
| |
| private: |
| friend class mojo::internal::MessageFragment<Unsupported_Data>; |
| |
| Unsupported_Data(); |
| ~Unsupported_Data() = delete; |
| }; |
| static_assert(sizeof(Unsupported_Data) == 32, |
| "Bad sizeof(Unsupported_Data)"); |
| // Used by Unsupported::WrapAsMessage to lazily serialize the struct. |
| template <typename UserType, typename DataView> |
| struct Unsupported_UnserializedMessageContext |
| : public mojo::internal::UnserializedMessageContext { |
| public: |
| static const mojo::internal::UnserializedMessageContext::Tag kMessageTag; |
| |
| Unsupported_UnserializedMessageContext( |
| uint32_t message_name, |
| uint32_t message_flags, |
| UserType input) |
| : mojo::internal::UnserializedMessageContext(&kMessageTag, message_name, message_flags) |
| , user_data_(std::move(input)) {} |
| ~Unsupported_UnserializedMessageContext() override = default; |
| |
| UserType TakeData() { |
| return std::move(user_data_); |
| } |
| |
| private: |
| // mojo::internal::UnserializedMessageContext: |
| void Serialize(mojo::Message& message) override { |
| mojo::internal::MessageFragment<Unsupported_Data> fragment(message); |
| mojo::internal::Serialize<DataView>(user_data_, fragment); |
| } |
| |
| UserType user_data_; |
| }; |
| |
| template <typename UserType, typename DataView> |
| const mojo::internal::UnserializedMessageContext::Tag |
| Unsupported_UnserializedMessageContext<UserType, DataView>::kMessageTag = {}; |
| |
| #pragma pack(pop) |
| |
| } // namespace internal |
| |
| } // ash::cros_healthd::mojom |
| |
| #endif // CHROMEOS_ASH_SERVICES_CROS_HEALTHD_PUBLIC_MOJOM_CROS_HEALTHD_EXCEPTION_MOJOM_SHARED_INTERNAL_H_ |