로딩중...
검색중...
일치하는것 없음
macro.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
4#include "meta/common/dep.hpp"
5
10// byeolMeta macro's sub-commands:
11// CLONE:
12// defines normal clone func. it have to be defined if you
13// just have declared non abstract class.
14#define __BY__DECL_CLONE(ME) \
15public: \
16 clonable* clone() const override { return new ME(*this); } \
17 \
18private:
19
24// TYPE:
25// you may need to undef and redefine this define only in your repo
26// if you're trying to use your custom type class.
27#define __BY__BASE_TYPE type
28
29// defines super meta type.
30// for instance, if you set TYPE(type), then when you call getType() of your class,
31// it will returns instance of type of type.
32#define __BY__DECL_TYPE(METATYPE) \
33public: \
34 typedef METATYPE metaType; \
35 const __BY__BASE_TYPE& getType() const override { return ttype<me>::get(); } \
36 \
37private:
38
39// INTERFACE:
40// marks that this class is abstract.
41#define __BY__DECL_ADT_1(ME) \
42 __BY__DECL_ME_1(ME) \
43 __BY__DECL_TYPE(__BY__BASE_TYPE) \
44 __BY__DECL_INIT_META(ME)
45#define __BY__DECL_ADT_2(ME, SUPER) __BY__DECL_ADT_3(ME, SUPER, __BY__BASE_TYPE)
46#define __BY__DECL_ADT_3(ME, SUPER, SUPERTYPE) \
47 __BY__DECL_ME_2(ME, SUPER) \
48 __BY__DECL_TYPE(SUPERTYPE) \
49 __BY__DECL_INIT_META(ME)
50#define __BY__DECL_ADT(...) BY_OVERLOAD(__BY__DECL_ADT, __VA_ARGS__)
51
52// CLASS:
53// marks that this class is concrete class.
54#define __BY__DECL_CLASS_1(ME) \
55 __BY__DECL_ADT_1(ME) \
56 __BY__DECL_CLONE(ME)
57#define __BY__DECL_CLASS_2(ME, SUPER) \
58 __BY__DECL_ADT_2(ME, SUPER) \
59 __BY__DECL_CLONE(ME)
60#define __BY__DECL_CLASS_3(ME, SUPER, SUPERTYPE) \
61 __BY__DECL_ADT_3(ME, SUPER, SUPERTYPE) \
62 __BY__DECL_CLONE(ME)
63#define __BY__DECL_CLASS(...) BY_OVERLOAD(__BY__DECL_CLASS, __VA_ARGS__)
to Top