Flutter Engine
 
Loading...
Searching...
No Matches
tonic::DartConverter< std::u16string > Struct Reference

#include <dart_converter.h>

Public Types

using NativeType = std::u16string
 
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 327 of file dart_converter.h.

Member Typedef Documentation

◆ FfiType

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

Definition at line 329 of file dart_converter.h.

◆ NativeType

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

Definition at line 328 of file dart_converter.h.

Member Function Documentation

◆ AllowedInLeafCall()

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

Definition at line 364 of file dart_converter.h.

364{ return kAllowedInLeafCall; }

◆ FromArguments()

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

Definition at line 354 of file dart_converter.h.

356 {
357 return FromDart(Dart_GetNativeArgument(args, index));
358 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static NativeType FromDart(Dart_Handle handle)

References args.

◆ FromDart()

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

Definition at line 343 of file dart_converter.h.

343 {
344 if (Dart_IsNull(handle)) {
345 return std::u16string();
346 }
347 intptr_t length = 0;
348 Dart_StringLength(handle, &length);
349 std::vector<uint16_t> data(length);
350 Dart_StringToUTF16(handle, data.data(), &length);
351 return std::u16string(reinterpret_cast<char16_t*>(data.data()), length);
352 }
size_t length
std::shared_ptr< const fml::Mapping > data

References data, and length.

◆ FromFfi()

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

Definition at line 360 of file dart_converter.h.

360{ return FromDart(val); }

◆ GetDartRepresentation()

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

Definition at line 363 of file dart_converter.h.

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

◆ GetFfiRepresentation()

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

Definition at line 362 of file dart_converter.h.

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

◆ SetReturnValue()

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

Definition at line 339 of file dart_converter.h.

339 {
340 Dart_SetReturnValue(args, ToDart(val));
341 }
static Dart_Handle ToDart(const NativeType &val)

References args, and tonic::ToDart().

◆ ToDart()

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

Definition at line 334 of file dart_converter.h.

334 {
335 return Dart_NewStringFromUTF16(
336 reinterpret_cast<const uint16_t*>(val.data()), val.length());
337 }

◆ ToFfi()

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

Definition at line 361 of file dart_converter.h.

361{ return ToDart(val); }

References tonic::ToDart().

Member Data Documentation

◆ kAllowedInLeafCall

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

Definition at line 332 of file dart_converter.h.

◆ kDartRepresentation

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

Definition at line 331 of file dart_converter.h.

◆ kFfiRepresentation

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

Definition at line 330 of file dart_converter.h.


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