Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
dart_list.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef LIB_TONIC_DART_LIST_H_
6#define LIB_TONIC_DART_LIST_H_
7
8#include <cstddef>
9
10#include "third_party/dart/runtime/include/dart_api.h"
12
13namespace tonic {
14
15class DartList {
16 public:
17 DartList(DartList&& other);
18
19 void Set(size_t index, Dart_Handle value);
20 Dart_Handle Get(size_t index);
21
22 template <class T>
23 void Set(size_t index, T value) {
25 }
26
27 template <class T>
28 T Get(size_t index) {
29 return DartConverter<T>::FromDart(Get(index));
30 }
31
32 Dart_Handle dart_handle() const { return dart_handle_; }
33 size_t size() const { return size_; }
34 bool is_valid() const { return is_valid_; }
35
36 explicit operator bool() const { return is_valid_; }
37
38 private:
39 explicit DartList(Dart_Handle list);
40 friend struct DartConverter<DartList>;
41
42 DartList();
43 Dart_Handle dart_handle_;
44 size_t size_;
45 bool is_valid_;
46
47 DartList(const DartList& other) = delete;
48};
49
50template <>
52 static DartList FromArguments(Dart_NativeArguments args,
53 int index,
54 Dart_Handle& exception);
55};
56
57} // namespace tonic
58
59#endif // LIB_TONIC_DART_LIST_H_
void Set(size_t index, Dart_Handle value)
Definition dart_list.cc:34
bool is_valid() const
Definition dart_list.h:34
Dart_Handle dart_handle() const
Definition dart_list.h:32
void Set(size_t index, T value)
Definition dart_list.h:23
Dart_Handle Get(size_t index)
T Get(size_t index)
Definition dart_list.h:28
size_t size() const
Definition dart_list.h:33
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
struct _Dart_NativeArguments * Dart_NativeArguments
Definition dart_api.h:3010
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint8_t value
#define T