Skip to content

Commit 58b8e77

Browse files
Almax27minggo
authored andcommitted
Moved CC_SYNTHESIZE and CC_PROPERTY macros onto a single line (#17765)
This permits comments to be visible in tooltips for the variable and it's associated accessor functions e.g. //The health of the entity, when this reaches zero the entity is dead CC_SYNTHESIZE(float, m_health, Health) Previously the above comment would only be displayed in the tooltip for the member variable
1 parent 07bb0b2 commit 58b8e77

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

cocos/platform/CCPlatformMacros.h

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,10 @@ CC_DEPRECATED_ATTRIBUTE static __TYPE__* node() \
129129
* If you need protected or private, please declare.
130130
*/
131131
#define CC_PROPERTY_READONLY(varType, varName, funName)\
132-
protected: varType varName;\
133-
public: virtual varType get##funName(void) const;
132+
protected: varType varName; public: virtual varType get##funName(void) const;
134133

135134
#define CC_PROPERTY_READONLY_PASS_BY_REF(varType, varName, funName)\
136-
protected: varType varName;\
137-
public: virtual const varType& get##funName(void) const;
135+
protected: varType varName; public: virtual const varType& get##funName(void) const;
138136

139137
/** @def CC_PROPERTY
140138
* It is used to declare a protected variable.
@@ -149,14 +147,10 @@ public: virtual const varType& get##funName(void) const;
149147
* If you need protected or private, please declare.
150148
*/
151149
#define CC_PROPERTY(varType, varName, funName)\
152-
protected: varType varName;\
153-
public: virtual varType get##funName(void) const;\
154-
public: virtual void set##funName(varType var);
150+
protected: varType varName; public: virtual varType get##funName(void) const; virtual void set##funName(varType var);
155151

156152
#define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\
157-
protected: varType varName;\
158-
public: virtual const varType& get##funName(void) const;\
159-
public: virtual void set##funName(const varType& var);
153+
protected: varType varName; public: virtual const varType& get##funName(void) const; virtual void set##funName(const varType& var);
160154

161155
/** @def CC_SYNTHESIZE_READONLY
162156
* It is used to declare a protected variable. We can use getter to read the variable.
@@ -169,12 +163,10 @@ public: virtual void set##funName(const varType& var);
169163
* If you need protected or private, please declare.
170164
*/
171165
#define CC_SYNTHESIZE_READONLY(varType, varName, funName)\
172-
protected: varType varName;\
173-
public: virtual varType get##funName(void) const { return varName; }
166+
protected: varType varName; public: virtual inline varType get##funName(void) const { return varName; }
174167

175168
#define CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)\
176-
protected: varType varName;\
177-
public: virtual const varType& get##funName(void) const { return varName; }
169+
protected: varType varName; public: virtual inline const varType& get##funName(void) const { return varName; }
178170

179171
/** @def CC_SYNTHESIZE
180172
* It is used to declare a protected variable.
@@ -189,19 +181,13 @@ public: virtual const varType& get##funName(void) const { return varName; }
189181
* If you need protected or private, please declare.
190182
*/
191183
#define CC_SYNTHESIZE(varType, varName, funName)\
192-
protected: varType varName;\
193-
public: virtual varType get##funName(void) const { return varName; }\
194-
public: virtual void set##funName(varType var){ varName = var; }
184+
protected: varType varName; public: virtual inline varType get##funName(void) const { return varName; } virtual inline void set##funName(varType var){ varName = var; }
195185

196186
#define CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\
197-
protected: varType varName;\
198-
public: virtual const varType& get##funName(void) const { return varName; }\
199-
public: virtual void set##funName(const varType& var){ varName = var; }
187+
protected: varType varName; public: virtual inline const varType& get##funName(void) const { return varName; } virtual inline void set##funName(const varType& var){ varName = var; }
200188

201189
#define CC_SYNTHESIZE_RETAIN(varType, varName, funName) \
202-
private: varType varName; \
203-
public: virtual varType get##funName(void) const { return varName; } \
204-
public: virtual void set##funName(varType var) \
190+
private: varType varName; public: virtual inline varType get##funName(void) const { return varName; } virtual inline void set##funName(varType var) \
205191
{ \
206192
if (varName != var) \
207193
{ \

0 commit comments

Comments
 (0)