-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
abi_specific.dart
57 lines (53 loc) · 1.7 KB
/
abi_specific.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of dart.ffi;
/// The supertype of all [Abi]-specific integer types.
///
/// [Abi]-specific integers should extend this class and annotate it with
/// [AbiSpecificIntegerMapping] to declare the integer size and signedness
/// for [Abi.values].
///
/// For example:
///
/// ```
/// /// The C `uintptr_t` type.
/// ///
/// /// The [UintPtr] type is a native type, and should not be constructed in
/// /// Dart code.
/// /// It occurs only in native type signatures and as annotation on [Struct]
/// /// and [Union] fields.
/// @AbiSpecificIntegerMapping({
/// Abi.androidArm: Uint32(),
/// Abi.androidArm64: Uint64(),
/// Abi.androidIA32: Uint32(),
/// Abi.androidX64: Uint64(),
/// Abi.fuchsiaArm64: Uint64(),
/// Abi.fuchsiaX64: Uint64(),
/// Abi.iosArm: Uint32(),
/// Abi.iosArm64: Uint64(),
/// Abi.linuxArm: Uint32(),
/// Abi.linuxArm64: Uint64(),
/// Abi.linuxIA32: Uint32(),
/// Abi.linuxX64: Uint64(),
/// Abi.linuxRiscv32: Uint32(),
/// Abi.linuxRiscv64: Uint64(),
/// Abi.macosArm64: Uint64(),
/// Abi.macosX64: Uint64(),
/// Abi.windowsIA32: Uint32(),
/// Abi.windowsX64: Uint64(),
/// })
/// class UintPtr extends AbiSpecificInteger {
/// const UintPtr();
/// }
/// ```
class AbiSpecificInteger extends NativeType {
const AbiSpecificInteger();
}
/// Mapping for a subtype of [AbiSpecificInteger].
///
/// See documentation on [AbiSpecificInteger].
class AbiSpecificIntegerMapping {
final Map<Abi, NativeType> mapping;
const AbiSpecificIntegerMapping(this.mapping);
}