mFrame
載入中...
搜尋中...
無符合項目
Interface.h
1
7#ifndef MFRAME_242D7CFC_C83D_4A29_8BC7_A6FF9CCEDD5D
8#define MFRAME_242D7CFC_C83D_4A29_8BC7_A6FF9CCEDD5D
9
10/* ***************************************************************************************
11 * Include
12 */
13#include <stdarg.h>
14#include <stddef.h>
15#include <stdint.h>
16//----------------------------------------------------------------------------------------
17
18//----------------------------------------------------------------------------------------
19
20/* ***************************************************************************************
21 * Macro
22 */
23
24//----------------------------------------------------------------------------------------
25#ifdef __clang__
26#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
27#pragma clang diagnostic ignored "-Wdeprecated-copy-dtor"
28#pragma clang diagnostic ignored "-Wc++98-compat"
29#pragma clang diagnostic ignored "-Wweak-vtables"
30#pragma clang diagnostic ignored "-Wunused-parameter"
31#pragma clang diagnostic ignored "-Wmissing-noreturn"
32#pragma clang diagnostic ignored "-Wformat-nonliteral"
33#pragma clang diagnostic ignored "-Wpadded"
34#pragma clang diagnostic ignored "-Wc++17-extensions"
35#pragma clang diagnostic ignored "-Wnested-anon-types"
36#pragma clang diagnostic ignored "-Wcovered-switch-default"
37#pragma clang diagnostic ignored "-Wswitch-enum"
38#pragma clang diagnostic ignored "-Wmissing-prototypes"
39#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
40#endif
41
42//----------------------------------------------------------------------------------------
43#define abstract = 0
44
45//----------------------------------------------------------------------------------------
46#define enum_operator(e, t, o) \
47 static inline e operator o(e a, e b) { \
48 return static_cast<e>((static_cast<t>(a) o static_cast<t>(b))); \
49 } \
50 static inline e operator o(e a, t b) { \
51 return static_cast<e>((static_cast<t>(a) o b)); \
52 }
53
54//----------------------------------------------------------------------------------------
55#define enum_auto_operator(e, t) \
56 enum_operator(e, t, |) \
57 enum_operator(e, t, &)
58
59//----------------------------------------------------------------------------------------
60#define tmeplate_auto_convert(_CLASSNAME, _TYPE) \
61 public: \
62 template <typename TNAME> \
63 inline operator const _CLASSNAME<TNAME>&(void) const { \
64 const _CLASSNAME<_TYPE>* src = this; \
65 return *reinterpret_cast<const _CLASSNAME<TNAME>*>(src); \
66 } \
67 template <typename TNAME> \
68 inline operator _CLASSNAME<TNAME>&(void) { \
69 _CLASSNAME<_TYPE>* src = this; \
70 return *reinterpret_cast<_CLASSNAME<TNAME>*>(src); \
71 }
72
73//----------------------------------------------------------------------------------------
74#define tmeplate_auto_convert_default(_CLASSNAME) \
75 public: \
76 template <typename TNAME> \
77 inline operator const _CLASSNAME<TNAME>&(void) const { \
78 const _CLASSNAME<>* src = this; \
79 return *reinterpret_cast<const _CLASSNAME<TNAME>*>(src); \
80 } \
81 template <typename TNAME> \
82 inline operator _CLASSNAME<TNAME>&(void) { \
83 _CLASSNAME<>* src = this; \
84 return *reinterpret_cast<_CLASSNAME<TNAME>*>(src); \
85 }
86
87//----------------------------------------------------------------------------------------
88#ifndef __I
89#define __I volatile
90#endif
91
92#ifndef __O
93#define __O volatile
94#endif
95
96#ifndef __IO
97#define __IO volatile
98#endif
99
100/* following defines should be used for structure members */
101#ifndef __IM
102#define __IM volatile const
103#endif
104
105#ifndef __OM
106#define __OM volatile
107#endif
108
109#ifndef __IOM
110#define __IOM volatile
111#endif
112
113typedef uint8_t uint8;
114typedef uint16_t uint16;
115typedef unsigned int uint32;
116typedef uint64_t uint64;
117
118typedef int8_t int8;
119typedef int16_t int16;
120typedef int32_t int32;
121typedef int64_t int64;
122
123/* ***************************************************************************************
124 * Namespace
125 */
126namespace mframe::lang {
127 struct Interface;
128 class Object;
129} // namespace mframe::lang
130
131/* ***************************************************************************************
132 * Class/struct/Struct/Enum
133 */
135 /* *************************************************************************************
136 * Method
137 */
138
143 virtual ~Interface(void) = default;
144
150 virtual mframe::lang::Object& getObject(void) abstract;
151};
152
154/* ***************************************************************************************
155 * End of file
156 */
157
158#endif /* MFRAME_242D7CFC_C83D_4A29_8BC7_A6FF9CCEDD5D */
Definition Object.h:34
Definition Appendable.h:23
Definition Interface.h:134
virtual mframe::lang::Object & getObject(void) override
取得類Object
virtual ~Interface(void)=default
Destroy the struct object.