5#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENCODABLE_VALUE_H_
6#define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENCODABLE_VALUE_H_
19#ifndef FLUTTER_ENABLE_RTTI
22#define FLUTTER_ENABLE_RTTI 1
24#elif defined(__clang__)
25#if __has_feature(cxx_rtti)
26#define FLUTTER_ENABLE_RTTI 1
28#elif defined(__GNUC__)
30#define FLUTTER_ENABLE_RTTI 1
37static_assert(
sizeof(double) == 8,
"EncodableValue requires a 64-bit double");
68 operator std::any&() {
return value_; }
70 operator const std::any&()
const {
return value_; }
72#if defined(FLUTTER_ENABLE_RTTI) && FLUTTER_ENABLE_RTTI
74 const std::type_info&
type() const noexcept {
return value_.type(); }
85 return this == &other;
104using EncodableValueVariant = std::variant<std::monostate,
110 std::vector<uint8_t>,
111 std::vector<int32_t>,
112 std::vector<int64_t>,
169 using super = internal::EncodableValueVariant;
171 using super::operator=;
179 *
this = std::string(other);
204 bool IsNull()
const {
return std::holds_alternative<std::monostate>(*
this); }
214 if (std::holds_alternative<int32_t>(*
this)) {
215 return std::get<int32_t>(*
this);
217 return std::get<int64_t>(*
this);
228 if (std::holds_alternative<int32_t>(*
this)) {
229 return std::get<int32_t>(*
this);
231 if (std::holds_alternative<int64_t>(*
this)) {
232 return std::get<int64_t>(*
this);
263#if __cplusplus >= 202002L
266 auto& lv =
static_cast<const super&
>(lhs);
267 auto& rv =
static_cast<const super&
>(rhs);
270 return std::partial_ordering::less;
274 return std::partial_ordering::greater;
278 return std::partial_ordering::equivalent;
281 return std::partial_ordering::unordered;
285 return static_cast<const super&
>(lhs) <
static_cast<const super&
>(rhs);
CustomEncodableValue(const std::any &value)
~CustomEncodableValue()=default
bool operator==(const CustomEncodableValue &other) const
bool operator<(const CustomEncodableValue &other) const
EncodableValue(const char *string)
EncodableValue & operator=(const char *other)
std::optional< int64_t > TryGetLongValue() const
internal::EncodableValueVariant super
EncodableValue(const CustomEncodableValue &v)
int64_t LongValue() const
friend bool operator<(const EncodableValue &lhs, const EncodableValue &rhs)
constexpr EncodableValue(T &&t) noexcept
std::vector< EncodableValue > EncodableList
std::map< EncodableValue, EncodableValue > EncodableMap
constexpr auto operator<=>(const EnumType &lhs, const Mask< EnumType > &rhs)