Flutter Engine
tonic::DartConverter< T *, typename std::enable_if< std::is_convertible< T *, const DartWrappable * >::value >::type > Struct Template Reference

#include <dart_wrappable.h>

Static Public Member Functions

static Dart_Handle ToDart (DartWrappable *val)
 
static void SetReturnValue (Dart_NativeArguments args, DartWrappable *val, bool auto_scope=true)
 
static T * FromDart (Dart_Handle handle)
 
static T * FromArguments (Dart_NativeArguments args, int index, Dart_Handle &exception, bool auto_scope=true)
 

Detailed Description

template<typename T>
struct tonic::DartConverter< T *, typename std::enable_if< std::is_convertible< T *, const DartWrappable * >::value >::type >

Definition at line 101 of file dart_wrappable.h.

Member Function Documentation

◆ FromArguments()

template<typename T >
static T* tonic::DartConverter< T *, typename std::enable_if< std::is_convertible< T *, const DartWrappable * >::value >::type >::FromArguments ( Dart_NativeArguments  args,
int  index,
Dart_Handle &  exception,
bool  auto_scope = true 
)
inlinestatic

Definition at line 129 of file dart_wrappable.h.

References tonic::DartConverterWrappable::FromArguments().

132  {
133  // TODO(abarth): We're missing a type check.
134  return static_cast<T*>(
135  DartConverterWrappable::FromArguments(args, index, exception));
136  }
G_BEGIN_DECLS FlValue * args
static DartWrappable * FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)

◆ FromDart()

template<typename T >
static T* tonic::DartConverter< T *, typename std::enable_if< std::is_convertible< T *, const DartWrappable * >::value >::type >::FromDart ( Dart_Handle  handle)
inlinestatic

Definition at line 124 of file dart_wrappable.h.

References tonic::DartConverterWrappable::FromDart().

124  {
125  // TODO(abarth): We're missing a type check.
126  return static_cast<T*>(DartConverterWrappable::FromDart(handle));
127  }
static DartWrappable * FromDart(Dart_Handle handle)

◆ SetReturnValue()

template<typename T >
static void tonic::DartConverter< T *, typename std::enable_if< std::is_convertible< T *, const DartWrappable * >::value >::type >::SetReturnValue ( Dart_NativeArguments  args,
DartWrappable val,
bool  auto_scope = true 
)
inlinestatic

Definition at line 113 of file dart_wrappable.h.

References tonic::DartWrappable::CreateDartWrapper(), tonic::DartState::Current(), and tonic::DartWrappable::dart_wrapper().

115  {
116  if (!val)
117  Dart_SetReturnValue(args, Dart_Null());
118  else if (Dart_WeakPersistentHandle wrapper = val->dart_wrapper())
119  Dart_SetWeakHandleReturnValue(args, wrapper);
120  else
121  Dart_SetReturnValue(args, val->CreateDartWrapper(DartState::Current()));
122  }
G_BEGIN_DECLS FlValue * args
static DartState * Current()
Definition: dart_state.cc:55

◆ ToDart()

template<typename T >
static Dart_Handle tonic::DartConverter< T *, typename std::enable_if< std::is_convertible< T *, const DartWrappable * >::value >::type >::ToDart ( DartWrappable val)
inlinestatic

Definition at line 105 of file dart_wrappable.h.

References tonic::DartWrappable::CreateDartWrapper(), tonic::DartState::Current(), and tonic::DartWrappable::dart_wrapper().

105  {
106  if (!val)
107  return Dart_Null();
108  if (Dart_WeakPersistentHandle wrapper = val->dart_wrapper())
109  return Dart_HandleFromWeakPersistent(wrapper);
110  return val->CreateDartWrapper(DartState::Current());
111  }
static DartState * Current()
Definition: dart_state.cc:55

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