issue #1310: deleted some functions which can't be implemented in C++. Moved arrayMakeObjectsPerformSelector to CCArray.h.

This commit is contained in:
James Chen 2012-06-08 15:17:15 +08:00
parent 4a887ac598
commit 6cf608effd
4 changed files with 34 additions and 96 deletions

View File

@ -57,40 +57,6 @@ enum {
kCCNodeOnExit
};
#define arrayMakeObjectsPerformSelector(pArray, func, elementType) \
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(); \
} \
} \
} \
} \
while(false)
#define arrayMakeObjectsPerformSelectorWithObject(pArray, func, pObject, elementType) \
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child = NULL; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(pObject); \
} \
} \
} \
} \
while(false)
/** @brief CCNode is the main element. Anything thats gets drawn or contains things that get drawn is a CCNode.
The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.

View File

@ -67,6 +67,40 @@ I found that it's not work in C++. So it keep what it's look like in version 1.0
#define CCARRAY_VERIFY_TYPE(__array__, __type__) void(0)
#endif
#define arrayMakeObjectsPerformSelector(pArray, func, elementType) \
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(); \
} \
} \
} \
} \
while(false)
#define arrayMakeObjectsPerformSelectorWithObject(pArray, func, pObject, elementType) \
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child = NULL; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(pObject); \
} \
} \
} \
} \
while(false)
NS_CC_BEGIN

View File

@ -256,60 +256,6 @@ void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr)
arr->num -= back;
}
/** Sends to each object in arr the message identified by given selector. */
void ccArrayMakeObjectsPerformSelector(ccArray *arr, SEL_CallFunc sel)
{
unsigned int i;
for( i = 0; i < arr->num; i++)
{
// #pragma clang diagnostic push
// #if defined(__has_feature) && __has_feature(objc_arc)
// #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
// #endif
(arr->arr[i]->*sel)();
//[arr->arr[i] performSelector:sel];
//#pragma clang diagnostic pop
}
}
void ccArrayMakeObjectsPerformSelectorWithObject(ccArray *arr, SEL_CallFuncO sel, CCObject* object)
{
unsigned int i;
for( i = 0; i < arr->num; i++)
{
// #pragma clang diagnostic push
//
// #if defined(__has_feature) && __has_feature(objc_arc)
// #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
// #endif
(arr->arr[i]->*sel)(object);
//[arr->arr[i] performSelector:sel withObject:object];
//#pragma clang diagnostic pop
}
}
void ccArrayMakeObjectPerformSelectorWithArrayObjects(ccArray *arr, SEL_CallFuncO sel, CCObject* object)
{
unsigned int i;
for( i = 0; i < arr->num; i++)
{
// #pragma clang diagnostic push
//
// #if defined(__has_feature) && __has_feature(objc_arc)
// #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
// #endif
// [object performSelector:sel withObject:arr->arr[i]];
(object->*sel)(arr->arr[i]);
//#pragma clang diagnostic pop
}
}
// #pragma mark -
// #pragma mark ccCArray for Values (c structures)

View File

@ -146,14 +146,6 @@ void ccArrayRemoveArray(ccArray *arr, ccArray *minusArr);
matching instances in arr will be removed. */
void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr);
/** Sends to each object in arr the message identified by given selector. */
void ccArrayMakeObjectsPerformSelector(ccArray *arr, SEL_CallFunc sel);
void ccArrayMakeObjectsPerformSelectorWithObject(ccArray *arr, SEL_CallFuncO sel, CCObject* object);
void ccArrayMakeObjectPerformSelectorWithArrayObjects(ccArray *arr, SEL_CallFuncO sel, CCObject* object);
// #pragma mark -
// #pragma mark ccCArray for Values (c structures)