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#if __has_warning("-Wunsafe-buffer-usage")
41 #pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
42#endif
43#endif
44
45//----------------------------------------------------------------------------------------
46#define abstract = 0
47
48//----------------------------------------------------------------------------------------
49#define enum_operator(e, t, o) \
50 static inline e operator o(e a, e b) { \
51 return static_cast<e>((static_cast<t>(a) o static_cast<t>(b))); \
52 } \
53 static inline e operator o(e a, t b) { \
54 return static_cast<e>((static_cast<t>(a) o b)); \
55 }
56
57//----------------------------------------------------------------------------------------
58#define enum_auto_operator(e, t) enum_operator(e, t, |) enum_operator(e, t, &)
59
60//----------------------------------------------------------------------------------------
61#define tmeplate_auto_convert(_CLASSNAME, _TYPE) \
62 public: \
63 template <typename TNAME> \
64 inline operator const _CLASSNAME<TNAME>&(void) const { \
65 const _CLASSNAME<_TYPE>* src = this; \
66 return *reinterpret_cast<const _CLASSNAME<TNAME>*>(src); \
67 } \
68 template <typename TNAME> \
69 inline operator _CLASSNAME<TNAME>&(void) { \
70 _CLASSNAME<_TYPE>* src = this; \
71 return *reinterpret_cast<_CLASSNAME<TNAME>*>(src); \
72 }
73
74//----------------------------------------------------------------------------------------
75#define tmeplate_auto_convert_default(_CLASSNAME) \
76 public: \
77 template <typename TNAME> \
78 inline operator const _CLASSNAME<TNAME>&(void) const { \
79 const _CLASSNAME<>* src = this; \
80 return *reinterpret_cast<const _CLASSNAME<TNAME>*>(src); \
81 } \
82 template <typename TNAME> \
83 inline operator _CLASSNAME<TNAME>&(void) { \
84 _CLASSNAME<>* src = this; \
85 return *reinterpret_cast<_CLASSNAME<TNAME>*>(src); \
86 }
87
88//----------------------------------------------------------------------------------------
89#ifndef __I
90#define __I volatile
91#endif
92
93#ifndef __O
94#define __O volatile
95#endif
96
97#ifndef __IO
98#define __IO volatile
99#endif
100
101/* following defines should be used for structure members */
102#ifndef __IM
103#define __IM volatile const
104#endif
105
106#ifndef __OM
107#define __OM volatile
108#endif
109
110#ifndef __IOM
111#define __IOM volatile
112#endif
113
114typedef uint8_t uint8;
115typedef uint16_t uint16;
116typedef unsigned int uint32;
117typedef uint64_t uint64;
118typedef uintptr_t uintptr;
119
120typedef int8_t int8;
121typedef int16_t int16;
122typedef int32_t int32;
123typedef int64_t int64;
124typedef intptr_t intptr;
125
126/* ***************************************************************************************
127 * Namespace
128 */
129namespace ufm::lang {
135 struct Interface;
136 class Object;
137} // namespace ufm::lang
138
139/* ***************************************************************************************
140 * Class/struct/Struct/Enum
141 */
142
153 /* *************************************************************************************
154 * Method
155 */
156
162 virtual ~Interface(void) = default;
163
169 virtual ufm::lang::Object& getObject(void) abstract;
170};
171
173/* ***************************************************************************************
174 * End of file
175 */
176
177#endif /* MFRAME_242D7CFC_C83D_4A29_8BC7_A6FF9CCEDD5D */
物件基底類別
Definition Object.h:63
Definition Appendable.h:23
類別共用基礎介面
Definition Interface.h:152
virtual ufm::lang::Object & getObject(void) override
取得對應的 Object 物件
virtual ~Interface(void)=default
虛擬析構函式