Types
Scapix generates bindings for functions with supported parameter types and return type. Functions with unsupported types in parameters or return value are ignored.
Portable types:
Non-portable types:
- Supported types may be nested arbitrarily.
- Classes derived from scapix::bridge::object are bridged by reference
and supported in Scapix bindings only when passed as
std::shared_ptr<type>. - All other types are bridged by copy.
- Supported type may be passed or returned by value (Type), by const reference (const Type&) or by rvalue reference (Type&&).
- Non-const lvalue reference (Type&) is intentionally unsupported.
- struct should be defined in the same header where it is used as a parameter or return value (this limitation will be lifted in a future version).
- Use callbacks to call bridged language from C++
Type mappings:
| C++ | Java | ObjC | C# |
|---|---|---|---|
| void | void | void | void |
| bool | boolean | BOOL | bool |
| std::int8_t | byte | int8_t | sbyte |
| std::int16_t | short | int16_t | short |
| std::int32_t | int | int32_t | int |
| std::int64_t | long | int64_t | long |
| std::uint8_t | byte | uint8_t | byte |
| std::uint16_t | short | uint16_t | ushort |
| std::uint32_t | int | uint32_t | uint |
| std::uint64_t | long | uint64_t | ulong |
| float | float | float | float |
| double | double | double | double |
| std::string | java.lang.String | NSString* | string |
| std::vector<T> | T[] | NSArray<T>* | T[] |
| std::map<K,V> | java.util.TreeMap<K,V> | NSDictionary<K,V>* | SortedDictionary<K,V> |
| std::set<K> | java.util.TreeSet<E> | NSOrderedSet<K>* | SortedSet<K> |
| std::unordered_map<K,V> | java.util.HashMap<K,V> | NSDictionary<K,V>* | Dictionary<K,V> |
| std::unordered_set<K> | java.util.HashSet<E> | NSSet<K>* | HashSet<K> |
| std::function<F> | @FunctionalInterface | block | delegate |
Example: