tgenericMarshaling.hpp
Go to the documentation of this file.
1
2#pragma once
3
5#include "core/ast/obj.hpp"
7
8namespace by {
9 template <typename T, nbool isNode = tifSub<T, node>::is>
10 struct tgenericMarshaling: public tmarshaling<T, isNode> {};
11
15 template <> struct _nout tgenericMarshaling<node&, true>: public metaIf {
16 typedef getExpr mgdType;
17
18 template <typename E> static str toMgd(E& it) { return it; }
19
20 static node& toNative(node& it) { return it; }
21
22 static mgdType& onAddParam() { return *new mgdType("T"); }
23
24 static mgdType* onGetRet() { return new mgdType("T"); }
25
26 static yes canMarshal();
27 };
28
29 template <> struct _nout tgenericMarshaling<node*, true>: public metaIf {
30 typedef getExpr mgdType;
31
32 template <typename E> static str toMgd(E* it) { return it; }
33
34 static node* toNative(node& it) { return &it; }
35
36 static mgdType& onAddParam() { return *new mgdType("T"); }
37
38 static mgdType* onGetRet() { return new mgdType("T"); }
39
40 static yes canMarshal();
41 };
42
43 template <> struct _nout tgenericMarshaling<const node&, true>: public metaIf {
44 typedef getExpr mgdType;
45
46 template <typename E> static str toMgd(E& it) { return it; }
47
48 static node& toNative(node& it) { return it; }
49
50 static mgdType& onAddParam() { return *new mgdType("T"); }
51
52 static mgdType* onGetRet() { return new mgdType("T"); }
53
54 static yes canMarshal();
55 };
56
57 template <> struct _nout tgenericMarshaling<const node*, true>: public metaIf {
58 typedef getExpr mgdType;
59
60 template <typename E> static str toMgd(E* it) { return it; }
61
62 static node* toNative(node& it) { return &it; }
63
64 static mgdType& onAddParam() { return *new mgdType("T"); }
65
66 static mgdType* onGetRet() { return new mgdType("T"); }
67
68 static yes canMarshal();
69 };
70} // namespace by
Expression for property and method access.
Definition: getExpr.hpp:17
Base class for all AST nodes in byeol language.
Definition: node.hpp:30
Base interface for SFINAE-based type checking.
Definition: rtti.hpp:15
Definition: tgenericMarshaling.hpp:10
Template marshaling interface for C++ bridge.
Definition: tmarshaling.hpp:18