Loading...
Searching...
No Matches
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
16 template <> struct _nout tgenericMarshaling<node&, true>: public metaIf {
17 typedef getExpr mgdType;
18
19 template <typename E> static str toMgd(E& it) { return it; }
20
21 static node& toNative(node& it) { return it; }
22
23 static mgdType& onAddParam() { return *new mgdType("T"); }
24
25 static mgdType* onGetRet() { return new mgdType("T"); }
26
27 static yes canMarshal();
28 };
29
30 template <> struct _nout tgenericMarshaling<node*, true>: public metaIf {
31 typedef getExpr mgdType;
32
33 template <typename E> static str toMgd(E* it) { return it; }
34
35 static node* toNative(node& it) { return &it; }
36
37 static mgdType& onAddParam() { return *new mgdType("T"); }
38
39 static mgdType* onGetRet() { return new mgdType("T"); }
40
41 static yes canMarshal();
42 };
43
44 template <> struct _nout tgenericMarshaling<const node&, true>: public metaIf {
45 typedef getExpr mgdType;
46
47 template <typename E> static str toMgd(E& it) { return it; }
48
49 static node& toNative(node& it) { return it; }
50
51 static mgdType& onAddParam() { return *new mgdType("T"); }
52
53 static mgdType* onGetRet() { return new mgdType("T"); }
54
55 static yes canMarshal();
56 };
57
58 template <> struct _nout tgenericMarshaling<const node*, true>: public metaIf {
59 typedef getExpr mgdType;
60
61 template <typename E> static str toMgd(E* it) { return it; }
62
63 static node* toNative(node& it) { return &it; }
64
65 static mgdType& onAddParam() { return *new mgdType("T"); }
66
67 static mgdType* onGetRet() { return new mgdType("T"); }
68
69 static yes canMarshal();
70 };
71} // namespace by
Expression for property and method access.
Definition getExpr.hpp:18
Base class for all AST nodes in the byeol language.
Definition node.hpp:195
Definition tnarr.hpp:9
Definition tgenericMarshaling.hpp:10
Template marshaling interface for C++ bridge.
Definition tmarshaling.hpp:19
to Top