2012-06-13 02:59:49 +08:00
|
|
|
#ifndef _CCB_CCNODELOADERLIBRARY_H_
|
|
|
|
#define _CCB_CCNODELOADERLIBRARY_H_
|
2012-06-06 08:15:28 +08:00
|
|
|
|
2016-03-20 21:53:44 +08:00
|
|
|
#include "editor-support/cocosbuilder/CCBReader.h"
|
2012-06-06 08:15:28 +08:00
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
namespace cocosbuilder {
|
2012-06-06 08:15:28 +08:00
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
class NodeLoader;
|
2012-09-24 11:47:33 +08:00
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
typedef std::map<std::string, NodeLoader *> NodeLoaderMap;
|
|
|
|
typedef std::pair<std::string, NodeLoader *> NodeLoaderMapEntry;
|
2012-06-15 04:51:32 +08:00
|
|
|
|
2014-08-27 10:18:44 +08:00
|
|
|
class CC_DLL NodeLoaderLibrary : public cocos2d::Ref
|
2013-07-27 22:31:57 +08:00
|
|
|
{
|
2013-07-24 18:00:02 +08:00
|
|
|
public:
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoaderLibrary, library);
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
NodeLoaderLibrary();
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
virtual ~NodeLoaderLibrary();
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
void registerDefaultNodeLoaders();
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
void registerNodeLoader(const char * pClassName, NodeLoader * pNodeLoader);
|
|
|
|
//void registerNodeLoader(String * pClassName, NodeLoader * pNodeLoader);
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
void unregisterNodeLoader(const char * pClassName);
|
|
|
|
//void unregisterNodeLoader(String * pClassName);
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
NodeLoader * getNodeLoader(const char * pClassName);
|
|
|
|
//CCNodeLoader * getNodeLoader(String * pClassName);
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
void purge(bool pDelete);
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE void registerDefaultCCNodeLoaders() { registerDefaultNodeLoaders(); }
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE void registerCCNodeLoader(const char * pClassName, NodeLoader * pNodeLoader) { registerNodeLoader(pClassName, pNodeLoader); };
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE void unregisterCCNodeLoader(const char * pClassName) { unregisterNodeLoader(pClassName); };
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-25 10:33:19 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE NodeLoader * getCCNodeLoader(const char * pClassName) { return getNodeLoader(pClassName); };
|
2013-07-24 18:00:02 +08:00
|
|
|
|
|
|
|
public:
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
static NodeLoaderLibrary * getInstance();
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
static void destroyInstance();
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
static NodeLoaderLibrary * newDefaultNodeLoaderLibrary();
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static NodeLoaderLibrary * sharedNodeLoaderLibrary() { return NodeLoaderLibrary::getInstance(); };
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static void purgeSharedNodeLoaderLibrary() { NodeLoaderLibrary::destroyInstance(); };
|
2013-09-13 11:41:20 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-24 18:00:02 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static NodeLoaderLibrary * newDefaultCCNodeLoaderLibrary() { return NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); };
|
2013-07-27 22:31:57 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
NodeLoaderMap _nodeLoaders;
|
2012-06-06 08:15:28 +08:00
|
|
|
};
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
}
|
2012-06-06 08:15:28 +08:00
|
|
|
|
|
|
|
#endif
|