Flutter Engine
 
Loading...
Searching...
No Matches
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

References tonic::DartConverterInteger< T >::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;
113 Dart_GetNativeIntegerArgument(args, index, &result);
114 return static_cast<T>(result);
115 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

References args.

◆ 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 }

◆ 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

References tonic::DartConverterInteger< T >::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

References TONIC_DCHECK.

◆ SetReturnValue()

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

Definition at line 99 of file dart_converter.h.

99 {
100 Dart_SetIntegerReturnValue(args, val);
101 }

References args.

◆ ToDart()

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

Definition at line 97 of file dart_converter.h.

97{ return Dart_NewInteger(val); }

◆ ToFfi()

template<typename T >
static FfiType tonic::DartConverterInteger< T >::ToFfi ( 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

◆ kDartRepresentation

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

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