Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
tonic::DartConverter< std::vector< T > > Struct Template Reference

#include <dart_converter.h>

Public Types

using FfiType = Dart_Handle
 
using ValueType = typename DartConverterTypes< T >::ValueType
 
using ConverterType = typename DartConverterTypes< T >::ConverterType
 

Static Public Member Functions

static Dart_Handle ToDart (const std::vector< ValueType > &val)
 
static void SetReturnValue (Dart_NativeArguments args, const std::vector< ValueType > &val)
 
static std::vector< ValueTypeFromDart (Dart_Handle handle)
 
static std::vector< ValueTypeFromArguments (Dart_NativeArguments args, int index, Dart_Handle &exception)
 
static std::vector< ValueTypeFromFfi (FfiType val)
 
static FfiType ToFfi (std::vector< ValueType > val)
 
static const char * GetFfiRepresentation ()
 
static const char * GetDartRepresentation ()
 
static bool AllowedInLeafCall ()
 

Static Public Attributes

static constexpr const char * kFfiRepresentation = "Handle"
 
static constexpr const char * kDartRepresentation = "List"
 
static constexpr bool kAllowedInLeafCall = false
 

Detailed Description

template<typename T>
struct tonic::DartConverter< std::vector< T > >

Definition at line 474 of file dart_converter.h.

Member Typedef Documentation

◆ ConverterType

template<typename T >
using tonic::DartConverter< std::vector< T > >::ConverterType = typename DartConverterTypes<T>::ConverterType

Definition at line 481 of file dart_converter.h.

◆ FfiType

template<typename T >
using tonic::DartConverter< std::vector< T > >::FfiType = Dart_Handle

Definition at line 475 of file dart_converter.h.

◆ ValueType

template<typename T >
using tonic::DartConverter< std::vector< T > >::ValueType = typename DartConverterTypes<T>::ValueType

Definition at line 480 of file dart_converter.h.

Member Function Documentation

◆ AllowedInLeafCall()

template<typename T >
static bool tonic::DartConverter< std::vector< T > >::AllowedInLeafCall ( )
inlinestatic

Definition at line 538 of file dart_converter.h.

538{ return kAllowedInLeafCall; }

◆ FromArguments()

template<typename T >
static std::vector< ValueType > tonic::DartConverter< std::vector< T > >::FromArguments ( Dart_NativeArguments  args,
int  index,
Dart_Handle exception 
)
inlinestatic

Definition at line 528 of file dart_converter.h.

530 {
531 return FromDart(Dart_GetNativeArgument(args, index));
532 }
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static std::vector< ValueType > FromDart(Dart_Handle handle)

◆ FromDart()

template<typename T >
static std::vector< ValueType > tonic::DartConverter< std::vector< T > >::FromDart ( Dart_Handle  handle)
inlinestatic

Definition at line 502 of file dart_converter.h.

502 {
503 std::vector<ValueType> result;
504
505 if (!Dart_IsList(handle))
506 return result;
507
508 intptr_t length = 0;
509 Dart_ListLength(handle, &length);
510
511 if (length == 0)
512 return result;
513
514 result.reserve(length);
515
516 std::vector<Dart_Handle> items(length);
517 Dart_Handle items_result =
518 Dart_ListGetRange(handle, 0, length, items.data());
519 TONIC_DCHECK(!Dart_IsError(items_result));
520
521 for (intptr_t i = 0; i < length; ++i) {
522 TONIC_DCHECK(items[i]);
523 result.push_back(DartConverter<ConverterType>::FromDart(items[i]));
524 }
525 return result;
526 }
DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, intptr_t offset, intptr_t length, Dart_Handle *result)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *length)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT bool Dart_IsList(Dart_Handle object)
GAsyncResult * result
size_t length
#define TONIC_DCHECK
Definition macros.h:32

◆ FromFfi()

template<typename T >
static std::vector< ValueType > tonic::DartConverter< std::vector< T > >::FromFfi ( FfiType  val)
inlinestatic

Definition at line 534 of file dart_converter.h.

534{ return FromDart(val); }

◆ GetDartRepresentation()

template<typename T >
static const char * tonic::DartConverter< std::vector< T > >::GetDartRepresentation ( )
inlinestatic

Definition at line 537 of file dart_converter.h.

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

◆ GetFfiRepresentation()

template<typename T >
static const char * tonic::DartConverter< std::vector< T > >::GetFfiRepresentation ( )
inlinestatic

Definition at line 536 of file dart_converter.h.

536{ return kFfiRepresentation; }
static constexpr const char * kFfiRepresentation

◆ SetReturnValue()

template<typename T >
static void tonic::DartConverter< std::vector< T > >::SetReturnValue ( Dart_NativeArguments  args,
const std::vector< ValueType > &  val 
)
inlinestatic

Definition at line 497 of file dart_converter.h.

498 {
500 }
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
static Dart_Handle ToDart(const std::vector< ValueType > &val)

◆ ToDart()

template<typename T >
static Dart_Handle tonic::DartConverter< std::vector< T > >::ToDart ( const std::vector< ValueType > &  val)
inlinestatic

Definition at line 483 of file dart_converter.h.

483 {
485 ToDartTypeHandle<ValueType>(), val.size());
486 if (Dart_IsError(list))
487 return list;
488 for (size_t i = 0; i < val.size(); i++) {
490 Dart_ListSetAt(list, i, DartConverter<ConverterType>::ToDart(val[i]));
491 if (Dart_IsError(result))
492 return result;
493 }
494 return list;
495 }
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
static Dart_Handle NewList(Dart_Handle type_handle, intptr_t length)

◆ ToFfi()

template<typename T >
static FfiType tonic::DartConverter< std::vector< T > >::ToFfi ( std::vector< ValueType val)
inlinestatic

Definition at line 535 of file dart_converter.h.

535{ return ToDart(val); }

Member Data Documentation

◆ kAllowedInLeafCall

template<typename T >
constexpr bool tonic::DartConverter< std::vector< T > >::kAllowedInLeafCall = false
staticconstexpr

Definition at line 478 of file dart_converter.h.

◆ kDartRepresentation

template<typename T >
constexpr const char* tonic::DartConverter< std::vector< T > >::kDartRepresentation = "List"
staticconstexpr

Definition at line 477 of file dart_converter.h.

◆ kFfiRepresentation

template<typename T >
constexpr const char* tonic::DartConverter< std::vector< T > >::kFfiRepresentation = "Handle"
staticconstexpr

Definition at line 476 of file dart_converter.h.


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