mirror of https://github.com/axmolengine/axmol.git
Cleaned up public interface of CCNodeLoaderLibrary (now takes either const char * or CCString, instead of std::string).
This commit is contained in:
parent
cdd1fb50ac
commit
4c6bf89167
|
@ -285,7 +285,7 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
|
||||||
memberVarAssignmentName = this->readCachedString();
|
memberVarAssignmentName = this->readCachedString();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCNodeLoader * ccNodeLoader = this->mCCNodeLoaderLibrary->getCCNodeLoader(className->m_sString);
|
CCNodeLoader * ccNodeLoader = this->mCCNodeLoaderLibrary->getCCNodeLoader(className);
|
||||||
CCNode * node = ccNodeLoader->loadCCNode(pParent, this);
|
CCNode * node = ccNodeLoader->loadCCNode(pParent, this);
|
||||||
|
|
||||||
/* Set root node, if not set yet. */
|
/* Set root node, if not set yet. */
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
|
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
|
||||||
#define PROPERTY_VISIBLE "visible"
|
#define PROPERTY_VISIBLE "visible"
|
||||||
|
|
||||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLOG("Unexpected property: '%s'!\n", PROPERTY->getCString()); assert(false)
|
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLog("Unexpected property: '%s'!\n", PROPERTY->getCString()); assert(false)
|
||||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) CCLOG("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
|
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) CCLog("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
|
|
|
@ -41,19 +41,24 @@ void CCNodeLoaderLibrary::registerDefaultCCNodeLoaders() {
|
||||||
this->registerCCNodeLoader("CCParticleSystemQuad", CCParticleSystemQuadLoader::loader());
|
this->registerCCNodeLoader("CCParticleSystemQuad", CCParticleSystemQuadLoader::loader());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCNodeLoaderLibrary::registerCCNodeLoader(std::string pClassName, CCNodeLoader * pCCNodeLoader) {
|
void CCNodeLoaderLibrary::registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader) {
|
||||||
pCCNodeLoader->retain();
|
pCCNodeLoader->retain();
|
||||||
this->mCCNodeLoaders.insert(std::pair<std::string, CCNodeLoader *>(pClassName, pCCNodeLoader));
|
this->mCCNodeLoaders.insert(std::pair<std::string, CCNodeLoader *>(pClassName, pCCNodeLoader));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCNodeLoaderLibrary::unregisterCCNodeLoader(std::string pClassName) {
|
void CCNodeLoaderLibrary::registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader) {
|
||||||
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
|
pCCNodeLoader->retain();
|
||||||
|
this->mCCNodeLoaders.insert(std::pair<std::string, CCNodeLoader *>(pClassName->m_sString, pCCNodeLoader));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCNodeLoaderLibrary::unregisterCCNodeLoader(CCString * pClassName) {
|
||||||
|
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName->m_sString);
|
||||||
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
|
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
|
||||||
ccNodeLoadersIterator->second->release();
|
ccNodeLoadersIterator->second->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(std::string pClassName) {
|
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(CCString * pClassName) {
|
||||||
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
|
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName->m_sString);
|
||||||
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
|
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
|
||||||
return ccNodeLoadersIterator->second;
|
return ccNodeLoadersIterator->second;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,12 @@ class CC_DLL CCNodeLoaderLibrary : public CCObject {
|
||||||
~CCNodeLoaderLibrary();
|
~CCNodeLoaderLibrary();
|
||||||
|
|
||||||
void registerDefaultCCNodeLoaders();
|
void registerDefaultCCNodeLoaders();
|
||||||
void registerCCNodeLoader(std::string pClassName, CCNodeLoader * pCCNodeLoader);
|
void registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader);
|
||||||
void unregisterCCNodeLoader(std::string pClassName);
|
void registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader);
|
||||||
CCNodeLoader * getCCNodeLoader(std::string pClassName);
|
void unregisterCCNodeLoader(const char * pClassName);
|
||||||
|
void unregisterCCNodeLoader(CCString * pClassName);
|
||||||
|
CCNodeLoader * getCCNodeLoader(const char * pClassName);
|
||||||
|
CCNodeLoader * getCCNodeLoader(CCString * pClassName);
|
||||||
void purge(bool pDelete);
|
void purge(bool pDelete);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue