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:

classes derived from scapix::bridge::object

void
bool
std::int8_t
std::int16_t
std::int32_t
std::int64_t
std::uint8_t
std::uint16_t
std::uint32_t
std::uint64_t
float
double
std::shared_ptr<T>
std::string (always in UTF-8 encoding)
std::vector<T>
std::map<K,V>
std::set<K>
std::unordered_map<K,V>
std::unordered_set<K>
std::function<F>
enum (as underlying integer type)
struct (all non-static data members are public)

Non-portable types:

char
signed char
short
int
long
long long
unsigned char
unsigned short
unsigned int
unsigned long
unsigned long long
  • 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++JavaObjCC#
voidvoidvoidvoid
boolbooleanBOOLbool
std::int8_tbyteint8_tsbyte
std::int16_tshortint16_tshort
std::int32_tintint32_tint
std::int64_tlongint64_tlong
std::uint8_tbyteuint8_tbyte
std::uint16_tshortuint16_tushort
std::uint32_tintuint32_tuint
std::uint64_tlonguint64_tulong
floatfloatfloatfloat
doubledoubledoubledouble
std::stringjava.lang.StringNSString*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>@FunctionalInterfaceblockdelegate

Example:

#include <scapix/bridge/object.h>

class test : public scapix::bridge::object<test>
{
public:

    // these functions are bridged: all parameter and return value types are supported

    void func1(const std::vector<std::shared_ptr<test>>&);
    void func2(std::function<void(std::vector<std::shared_ptr<test>)>);
    std::map<std::string, std::shared_ptr<test>> func3();

    // these functions are not bridged: not all parameter and return value types are supported

    void func10(void*);

};