Flutter Engine
The Flutter Engine
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
tonic::DartConverter< std::string > Struct Reference

#include <dart_converter.h>

Public Types

using NativeType = std::string
 
using FfiType = Dart_Handle
 

Static Public Member Functions

static Dart_Handle ToDart (const NativeType &val)
 
static void SetReturnValue (Dart_NativeArguments args, const NativeType &val)
 
static NativeType FromDart (Dart_Handle handle)
 
static NativeType FromArguments (Dart_NativeArguments args, int index, Dart_Handle &exception)
 
static NativeType FromFfi (FfiType val)
 
static FfiType ToFfi (NativeType val)
 
static const char * GetFfiRepresentation ()
 
static const char * GetDartRepresentation ()
 
static bool AllowedInLeafCall ()
 

Static Public Attributes

static constexpr const char * kFfiRepresentation = "Handle"
 
static constexpr const char * kDartRepresentation = "String"
 
static constexpr bool kAllowedInLeafCall = false
 

Detailed Description

Definition at line 286 of file dart_converter.h.

Member Typedef Documentation

◆ FfiType

using tonic::DartConverter< std::string >::FfiType = Dart_Handle

Definition at line 288 of file dart_converter.h.

◆ NativeType

using tonic::DartConverter< std::string >::NativeType = std::string

Definition at line 287 of file dart_converter.h.

Member Function Documentation

◆ AllowedInLeafCall()

static bool tonic::DartConverter< std::string >::AllowedInLeafCall ( )
inlinestatic

Definition at line 323 of file dart_converter.h.

323{ return kAllowedInLeafCall; }
static constexpr bool kAllowedInLeafCall

◆ FromArguments()

static NativeType tonic::DartConverter< std::string >::FromArguments ( Dart_NativeArguments  args,
int  index,
Dart_Handle exception 
)
inlinestatic

Definition at line 313 of file dart_converter.h.

315 {
316 return FromDart(Dart_GetNativeArgument(args, index));
317 }
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static NativeType FromDart(Dart_Handle handle)

◆ FromDart()

static NativeType tonic::DartConverter< std::string >::FromDart ( Dart_Handle  handle)
inlinestatic

Definition at line 302 of file dart_converter.h.

302 {
303 if (Dart_IsNull(handle)) {
304 return std::string();
305 }
306 uint8_t* data = nullptr;
307 intptr_t length = 0;
308 if (Dart_IsError(Dart_StringToUTF8(handle, &data, &length)))
309 return std::string();
310 return std::string(reinterpret_cast<char*>(data), length);
311 }
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
size_t length
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ FromFfi()

static NativeType tonic::DartConverter< std::string >::FromFfi ( FfiType  val)
inlinestatic

Definition at line 319 of file dart_converter.h.

319{ return FromDart(val); }

◆ GetDartRepresentation()

static const char * tonic::DartConverter< std::string >::GetDartRepresentation ( )
inlinestatic

Definition at line 322 of file dart_converter.h.

322{ return kDartRepresentation; }
static constexpr const char * kDartRepresentation

◆ GetFfiRepresentation()

static const char * tonic::DartConverter< std::string >::GetFfiRepresentation ( )
inlinestatic

Definition at line 321 of file dart_converter.h.

321{ return kFfiRepresentation; }
static constexpr const char * kFfiRepresentation

◆ SetReturnValue()

static void tonic::DartConverter< std::string >::SetReturnValue ( Dart_NativeArguments  args,
const NativeType val 
)
inlinestatic

Definition at line 298 of file dart_converter.h.

298 {
300 }
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
static Dart_Handle ToDart(const NativeType &val)

◆ ToDart()

static Dart_Handle tonic::DartConverter< std::string >::ToDart ( const NativeType val)
inlinestatic

Definition at line 293 of file dart_converter.h.

293 {
294 return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(val.data()),
295 val.length());
296 }
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)

◆ ToFfi()

static FfiType tonic::DartConverter< std::string >::ToFfi ( NativeType  val)
inlinestatic

Definition at line 320 of file dart_converter.h.

320{ return ToDart(val); }

Member Data Documentation

◆ kAllowedInLeafCall

constexpr bool tonic::DartConverter< std::string >::kAllowedInLeafCall = false
staticconstexpr

Definition at line 291 of file dart_converter.h.

◆ kDartRepresentation

constexpr const char* tonic::DartConverter< std::string >::kDartRepresentation = "String"
staticconstexpr

Definition at line 290 of file dart_converter.h.

◆ kFfiRepresentation

constexpr const char* tonic::DartConverter< std::string >::kFfiRepresentation = "Handle"
staticconstexpr

Definition at line 289 of file dart_converter.h.


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