Flutter iOS Embedder
flutter::EncodableValue Class Reference

#include <encodable_value.h>

Inheritance diagram for flutter::EncodableValue:

Public Types

using super = internal::EncodableValueVariant
 

Public Member Functions

 EncodableValue ()=default
 
 EncodableValue (const char *string)
 
EncodableValueoperator= (const char *other)
 
 EncodableValue (const CustomEncodableValue &v)
 
template<class T >
constexpr EncodableValue (T &&t) noexcept
 
bool IsNull () const
 
int64_t LongValue () const
 
std::optional< int64_t > TryGetLongValue () const
 

Friends

bool operator< (const EncodableValue &lhs, const EncodableValue &rhs)
 

Detailed Description

Definition at line 166 of file encodable_value.h.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ EncodableValue() [1/4]

flutter::EncodableValue::EncodableValue ( )
explicitdefault

◆ EncodableValue() [2/4]

flutter::EncodableValue::EncodableValue ( const char *  string)
inlineexplicit

Definition at line 177 of file encodable_value.h.

177 : super(std::string(string)) {}
internal::EncodableValueVariant super

◆ EncodableValue() [3/4]

flutter::EncodableValue::EncodableValue ( const CustomEncodableValue v)
inline

Definition at line 189 of file encodable_value.h.

189 : super(v) {}

◆ EncodableValue() [4/4]

template<class T >
constexpr flutter::EncodableValue::EncodableValue ( T &&  t)
inlineexplicitconstexprnoexcept

Definition at line 200 of file encodable_value.h.

200 : super(t) {}

Member Function Documentation

◆ IsNull()

bool flutter::EncodableValue::IsNull ( ) const
inline

Definition at line 204 of file encodable_value.h.

204 { return std::holds_alternative<std::monostate>(*this); }

Referenced by flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), and flutter::TEST().

◆ LongValue()

int64_t flutter::EncodableValue::LongValue ( ) const
inline

Definition at line 213 of file encodable_value.h.

213  {
214  if (std::holds_alternative<int32_t>(*this)) {
215  return std::get<int32_t>(*this);
216  }
217  return std::get<int64_t>(*this);
218  }

Referenced by flutter::TEST().

◆ operator=()

EncodableValue& flutter::EncodableValue::operator= ( const char *  other)
inline

Definition at line 178 of file encodable_value.h.

178  {
179  *this = std::string(other);
180  return *this;
181  }

◆ TryGetLongValue()

std::optional<int64_t> flutter::EncodableValue::TryGetLongValue ( ) const
inline

Definition at line 227 of file encodable_value.h.

227  {
228  if (std::holds_alternative<int32_t>(*this)) {
229  return std::get<int32_t>(*this);
230  }
231  if (std::holds_alternative<int64_t>(*this)) {
232  return std::get<int64_t>(*this);
233  }
234  return std::nullopt;
235  }

Friends And Related Function Documentation

◆ operator<

bool operator< ( const EncodableValue lhs,
const EncodableValue rhs 
)
friend

Definition at line 284 of file encodable_value.h.

284  {
285  return static_cast<const super&>(lhs) < static_cast<const super&>(rhs);
286  }

The documentation for this class was generated from the following file: