Flutter Engine
tonic::DartConverter< std::u16string > Struct Template Reference

#include <dart_converter.h>

Static Public Member Functions

static Dart_Handle ToDart (const std::u16string &val)
 
static void SetReturnValue (Dart_NativeArguments args, const std::u16string &val)
 
static std::u16string FromDart (Dart_Handle handle)
 
static std::u16string FromArguments (Dart_NativeArguments args, int index, Dart_Handle &exception)
 

Detailed Description

template<>
struct tonic::DartConverter< std::u16string >

Definition at line 232 of file dart_converter.h.

Member Function Documentation

◆ FromArguments()

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

Definition at line 251 of file dart_converter.h.

253  {
254  return FromDart(Dart_GetNativeArgument(args, index));
255  }
G_BEGIN_DECLS FlValue * args
static std::u16string FromDart(Dart_Handle handle)

◆ FromDart()

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

Definition at line 243 of file dart_converter.h.

References length.

243  {
244  intptr_t length = 0;
245  Dart_StringLength(handle, &length);
246  std::vector<uint16_t> data(length);
247  Dart_StringToUTF16(handle, data.data(), &length);
248  return std::u16string(reinterpret_cast<char16_t*>(data.data()), length);
249  }
size_t length

◆ SetReturnValue()

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

Definition at line 238 of file dart_converter.h.

References tonic::ToDart().

239  {
240  Dart_SetReturnValue(args, ToDart(val));
241  }
G_BEGIN_DECLS FlValue * args
static Dart_Handle ToDart(const std::u16string &val)

◆ ToDart()

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

Definition at line 233 of file dart_converter.h.

233  {
234  return Dart_NewStringFromUTF16(
235  reinterpret_cast<const uint16_t*>(val.data()), val.length());
236  }

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