1 #ifndef CYCRIPT_INTERNAL_HPP
2 #define CYCRIPT_INTERNAL_HPP
6 #include <JavaScriptCore/JSBase.h>
7 #include <JavaScriptCore/JSValueRef.h>
9 #include <sig/parse.hpp>
10 #include <sig/ffi_type.hpp>
12 void Structor_(apr_pool_t *pool, const char *name, const char *types, sig::Type *&type);
14 struct Type_privateData :
17 static JSClassRef Class_;
22 void Set(sig::Type *type) {
23 type_ = new(pool_) sig::Type;
24 sig::Copy(pool_, *type_, *type);
27 Type_privateData(apr_pool_t *pool, const char *type) :
33 sig::Signature signature;
34 sig::Parse(pool_, &signature, type, &Structor_);
35 type_ = signature.elements[0].type;
38 Type_privateData(sig::Type *type) :
45 Type_privateData(sig::Type *type, ffi_type *ffi) {
46 ffi_ = new(pool_) ffi_type;
47 sig::Copy(pool_, *ffi_, *ffi);
53 ffi_ = new(pool_) ffi_type;
60 sig::Signature signature;
61 signature.elements = &element;
65 sig::sig_ffi_cif(pool_, &sig::ObjectiveC, &signature, &cif);
81 CYValue(const void *value) :
82 value_(const_cast<void *>(value))
86 CYValue(const CYValue &rhs) :
91 virtual Type_privateData *GetType() const {
100 JSContextRef context_;
104 CYOwned(void *value, JSContextRef context, JSObjectRef owner) :
110 JSValueProtect(context_, owner_);
115 JSValueUnprotect(context_, owner_);
118 JSObjectRef GetOwner() const {
123 #endif/*CYCRIPT_INTERNAL_HPP*/