Flutter Engine
The Flutter Engine
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
tonic::DartConverterInteger< T > Struct Template Reference

#include <dart_converter.h>

Public Types

using FfiType = T
 

Static Public Member Functions

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

Static Public Attributes

static constexpr const char * kDartRepresentation = "int"
 
static constexpr bool kAllowedInLeafCall = true
 

Detailed Description

template<typename T>
struct tonic::DartConverterInteger< T >

Definition at line 92 of file dart_converter.h.

Member Typedef Documentation

◆ FfiType

template<typename T >
using tonic::DartConverterInteger< T >::FfiType = T

Definition at line 93 of file dart_converter.h.

Member Function Documentation

◆ AllowedInLeafCall()

template<typename T >
static bool tonic::DartConverterInteger< T >::AllowedInLeafCall ( )
inlinestatic

Definition at line 133 of file dart_converter.h.

133{ return kAllowedInLeafCall; }
static constexpr bool kAllowedInLeafCall

◆ FromArguments()

template<typename T >
static T tonic::DartConverterInteger< T >::FromArguments ( Dart_NativeArguments  args,
int  index,
Dart_Handle exception 
)
inlinestatic

Definition at line 109 of file dart_converter.h.

111 {
112 int64_t result = 0;
114 return static_cast<T>(result);
115 }
DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, int index, int64_t *value)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GAsyncResult * result
#define T
Definition: precompiler.cc:65

◆ FromDart()

template<typename T >
static T tonic::DartConverterInteger< T >::FromDart ( Dart_Handle  handle)
inlinestatic

Definition at line 103 of file dart_converter.h.

103 {
104 int64_t result = 0;
105 Dart_IntegerToInt64(handle, &result);
106 return static_cast<T>(result);
107 }
DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, int64_t *value)

◆ FromFfi()

template<typename T >
static T tonic::DartConverterInteger< T >::FromFfi ( FfiType  val)
inlinestatic

Definition at line 116 of file dart_converter.h.

116{ return val; }

◆ GetDartRepresentation()

template<typename T >
static const char * tonic::DartConverterInteger< T >::GetDartRepresentation ( )
inlinestatic

Definition at line 118 of file dart_converter.h.

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

◆ GetFfiRepresentation()

template<typename T >
static const char * tonic::DartConverterInteger< T >::GetFfiRepresentation ( )
inlinestatic

Definition at line 120 of file dart_converter.h.

120 {
121 if (sizeof(T) == 4) {
122 if (std::is_signed<T>()) {
123 return "Int32";
124 }
125 return "Uint32";
126 }
127 TONIC_DCHECK(sizeof(T) == 8);
128 if (std::is_signed<T>()) {
129 return "Int64";
130 }
131 return "Uint64";
132 }
#define TONIC_DCHECK
Definition: macros.h:32

◆ SetReturnValue()

template<typename T >
static void tonic::DartConverterInteger< T >::SetReturnValue ( Dart_NativeArguments  args,
T  val 
)
inlinestatic

Definition at line 99 of file dart_converter.h.

99 {
101 }
DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, int64_t retval)

◆ ToDart()

template<typename T >
static Dart_Handle tonic::DartConverterInteger< T >::ToDart ( T  val)
inlinestatic

Definition at line 97 of file dart_converter.h.

97{ return Dart_NewInteger(val); }
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)

◆ ToFfi()

template<typename T >
static FfiType tonic::DartConverterInteger< T >::ToFfi ( T  val)
inlinestatic

Definition at line 117 of file dart_converter.h.

117{ return val; }

Member Data Documentation

◆ kAllowedInLeafCall

template<typename T >
constexpr bool tonic::DartConverterInteger< T >::kAllowedInLeafCall = true
staticconstexpr

Definition at line 95 of file dart_converter.h.

◆ kDartRepresentation

template<typename T >
constexpr const char* tonic::DartConverterInteger< T >::kDartRepresentation = "int"
staticconstexpr

Definition at line 94 of file dart_converter.h.


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