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
37 static_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;
110 std::vector<uint8_t>,
111 std::vector<int32_t>,
112 std::vector<int64_t>,
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
264 friend std::partial_ordering operator<=>(
const EncodableValue& lhs,
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)
std::optional< int64_t > TryGetLongValue() const
EncodableValue & operator=(const char *other)
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::variant< std::monostate, bool, int32_t, int64_t, double, std::string, std::vector< uint8_t >, std::vector< int32_t >, std::vector< int64_t >, std::vector< double >, EncodableList, EncodableMap, CustomEncodableValue, std::vector< float > > EncodableValueVariant
std::vector< EncodableValue > EncodableList
std::map< EncodableValue, EncodableValue > EncodableMap