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

#include <dart_converter.h>

Static Public Member Functions

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

Detailed Description

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

Definition at line 205 of file dart_converter.h.

Member Function Documentation

◆ FromArguments()

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

Definition at line 224 of file dart_converter.h.

226  {
227  return FromDart(Dart_GetNativeArgument(args, index));
228  }
G_BEGIN_DECLS FlValue * args
static std::string FromDart(Dart_Handle handle)

◆ FromDart()

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

Definition at line 216 of file dart_converter.h.

References length.

216  {
217  uint8_t* data = nullptr;
218  intptr_t length = 0;
219  if (Dart_IsError(Dart_StringToUTF8(handle, &data, &length)))
220  return std::string();
221  return std::string(reinterpret_cast<char*>(data), length);
222  }
size_t length

◆ SetReturnValue()

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

Definition at line 211 of file dart_converter.h.

References tonic::ToDart().

212  {
213  Dart_SetReturnValue(args, ToDart(val));
214  }
G_BEGIN_DECLS FlValue * args
static Dart_Handle ToDart(const std::string &val)

◆ ToDart()

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

Definition at line 206 of file dart_converter.h.

206  {
207  return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(val.data()),
208  val.length());
209  }

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