5#include "core/internal/coreInternal.hpp"
10 template <
typename T>
class tbridge;
11 template <
typename T,
typename defaultElemType>
class tarr;
22 template <
typename E>
static str toMgd(
E& it) {
throw marshalErr(); }
26 static const mgd& onAddParam() {
return *
new mgd(); }
28 static const mgd* onGetRet() {
throw marshalErr(); }
30 static no canMarshal();
36 template <
typename E>
static str toMgd(
E& it) {
return it; }
40 static const mgd& onAddParam() {
return *coreInternal::makeBridge(
new T()); }
42 static const mgd* onGetRet() {
return coreInternal::makeBridge(
new T()); }
44 static yes canMarshal();
50 template <
typename E>
static str toMgd(
E& it) {
return it; }
54 static const mgd& onAddParam() {
return *coreInternal::makeBridge(
new T()); }
56 static const mgd* onGetRet() {
return coreInternal::makeBridge(
new T()); }
58 static yes canMarshal();
64 template <
typename E>
static str toMgd(
E& it) {
return it; }
66 static node& toNative(
node& it) {
return it; }
68 static const mgd& onAddParam() {
return *
new mockNode(); }
70 static const mgd* onGetRet() {
return new mockNode(); }
72 static yes canMarshal();
78 template <
typename E>
static str toMgd(
E* it) {
return it; }
80 static node* toNative(
node& it) {
return ⁢ }
82 static const mgd& onAddParam() {
return *
new mockNode(); }
84 static const mgd* onGetRet() {
return new mockNode(); }
86 static yes canMarshal();
89 template <
typename T>
struct tmarshaling<T&,
true>:
public metaIf {
92 template <
typename E>
static str toMgd(
E& it) {
return it; }
94 static T& toNative(
node& it) {
return *it.cast<T>(); }
96 static const mgd& onAddParam() {
return *
new mgd(); }
98 static const mgd* onGetRet() {
return new mgd(); }
100 static yes canMarshal();
103 template <
typename T>
struct tmarshaling<T*,
true>:
public metaIf {
106 template <
typename E>
static str toMgd(
E* it) {
return it; }
108 static T* toNative(
node& it) {
return it.cast<T>(); }
110 static const mgd& onAddParam() {
return *
new mgd(); }
112 static const mgd* onGetRet() {
return new mgd(); }
114 static yes canMarshal();
120 template <
typename E>
static str toMgd(
const E& it) {
return str((
E*) it.clone()); }
122 static T& toNative(
node& it) {
return *it.cast<T>(); }
124 static const mgd& onAddParam() {
return *
new mgd(); }
126 static const mgd* onGetRet() {
return new mgd(); }
128 static yes canMarshal();
135 template <
typename tnativeType,
typename tmarshalType>
struct tnormalMarshaling:
public metaIf {
139 static native toNative(
node& it) {
return ((
mgd&) it).get(); }
143 static const mgd& onAddParam() {
return *
new mgd(); }
145 static const mgd* onGetRet() {
return new mgd(); }
147 static yes canMarshal();
155 const std::string& cast = ((
mgd&) it).get();
156 return cast.length() > 0 ? cast[0] :
'\0';
161 static const mgd& onAddParam() {
return *
new mgd(); }
163 static const mgd* onGetRet() {
return new mgd(); }
165 static yes canMarshal();
170 typedef const char*
native;
172 static native toNative(
node& it) {
return ((
mgd&) it).get().c_str(); }
176 static const mgd& onAddParam() {
return *
new mgd(); }
178 static const mgd* onGetRet() {
return new mgd(); }
180 static yes canMarshal();
193 static const mgd& onAddParam() {
return *
new mgd(); }
195 static const mgd* onGetRet() {
return new mgd(); }
197 static yes canMarshal();
228 template <
typename T>
struct tmarshaling<T, false>:
public metaIf {
231 template <
typename E>
static str toMgd(
const E& it) {
return coreInternal::makeBridge(
new E(it)); }
233 static T& toNative(
node& it) {
return *it.cast<T>(); }
235 static const mgd& onAddParam() {
return *coreInternal::makeBridge<T>(); }
237 static const mgd* onGetRet() {
return coreInternal::makeBridge<T>(); }
239 static yes canMarshal();
242 template <
typename T>
struct tmarshaling<T&,
false>:
public metaIf {
245 template <
typename E>
static str toMgd(
E& it) {
return coreInternal::makeBridge(&it); }
247 static T& toNative(
node& it) {
return *it.cast<
tbridge<T>>()->get(); }
249 static const mgd& onAddParam() {
return *coreInternal::makeBridge<T>(); }
251 static const mgd* onGetRet() {
return coreInternal::makeBridge<T>(); }
253 static yes canMarshal();
256 template <
typename T>
struct tmarshaling<T*,
false>:
public metaIf {
259 template <
typename E>
static str toMgd(
E* it) {
return coreInternal::makeBridge(it); }
261 static T* toNative(
node& it) {
return it.cast<
tbridge<T>>()->get(); }
263 static const mgd& onAddParam() {
return *coreInternal::makeBridge<T>(); }
265 static const mgd* onGetRet() {
return coreInternal::makeBridge<T>(); }
267 static yes canMarshal();
275 template <
typename E2>
static str toMgd(
E2* it);
277 static const mgd& onAddParam();
278 static const mgd* onGetRet();
279 static yes canMarshal();
Scripted array container for byeol language
Definition arr.hpp:15
String primitive type in byeol language
Definition nStr.hpp:14
Void primitive type in byeol language
Definition nVoid.hpp:13
Base class for all AST nodes in the byeol language
Definition node.hpp:195
C++ native class bridge
Definition tbridge.hpp:19
Definition tmarshaling.hpp:9
Template marshaling interface for C++ bridge
Definition tmarshaling.hpp:19
Normal marshaling for primitive types
Definition tmarshaling.hpp:135