1 {%- import "macros.swift" as swift %}
2 {%- for type_ in ci.iter_types() %}
3 {%- let type_name = type_|type_name %}
4 {%- let ffi_converter_name = type_|ffi_converter_name %}
5 {%- let canonical_type_name = type_|canonical_name %}
6 {%- let contains_object_references = ci.item_contains_object_references(type_) %}
9 # Map `Type` instances to an include statement for that type.
11 # There is a companion match in `KotlinCodeOracle::create_code_type()` which performs a similar function for the
14 # - When adding additional types here, make sure to also add a match arm to that function.
15 # - To keep things manageable, let's try to limit ourselves to these 2 mega-matches
19 {%- when Type::Boolean %}
20 {%- include "BooleanHelper.swift" %}
22 {%- when Type::String %}
23 {%- include "StringHelper.swift" %}
25 {%- when Type::Bytes %}
26 {%- include "DataHelper.swift" %}
28 {%- when Type::Int8 %}
29 {%- include "Int8Helper.swift" %}
31 {%- when Type::Int16 %}
32 {%- include "Int16Helper.swift" %}
34 {%- when Type::Int32 %}
35 {%- include "Int32Helper.swift" %}
37 {%- when Type::Int64 %}
38 {%- include "Int64Helper.swift" %}
40 {%- when Type::UInt8 %}
41 {%- include "UInt8Helper.swift" %}
43 {%- when Type::UInt16 %}
44 {%- include "UInt16Helper.swift" %}
46 {%- when Type::UInt32 %}
47 {%- include "UInt32Helper.swift" %}
49 {%- when Type::UInt64 %}
50 {%- include "UInt64Helper.swift" %}
52 {%- when Type::Float32 %}
53 {%- include "Float32Helper.swift" %}
55 {%- when Type::Float64 %}
56 {%- include "Float64Helper.swift" %}
58 {%- when Type::Timestamp %}
59 {%- include "TimestampHelper.swift" %}
61 {%- when Type::Duration %}
62 {%- include "DurationHelper.swift" %}
64 {%- when Type::CallbackInterface { name, module_path } %}
65 {%- include "CallbackInterfaceTemplate.swift" %}
67 {%- when Type::ForeignExecutor %}
68 {%- include "ForeignExecutorTemplate.swift" %}
70 {%- when Type::Custom { name, module_path, builtin } %}
71 {%- include "CustomType.swift" %}
73 {%- when Type::Enum { name, module_path } %}
74 {%- let e = ci.get_enum_definition(name).unwrap() %}
75 {%- if ci.is_name_used_as_error(name) %}
76 {%- include "ErrorTemplate.swift" %}
78 {%- include "EnumTemplate.swift" %}
81 {%- when Type::Object{ name, module_path, imp } %}
82 {%- include "ObjectTemplate.swift" %}
84 {%- when Type::Record { name, module_path } %}
85 {%- include "RecordTemplate.swift" %}
87 {%- when Type::Optional { inner_type } %}
88 {%- include "OptionalTemplate.swift" %}
90 {%- when Type::Sequence { inner_type } %}
91 {%- include "SequenceTemplate.swift" %}
93 {%- when Type::Map { key_type, value_type } %}
94 {%- include "MapTemplate.swift" %}