cocos2d-x  3.0alpha1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataReaderHelper Class Reference

#include <CCDataReaderHelper.h>

Inheritance diagram for DataReaderHelper:
Object

Public Member Functions

 DataReaderHelper ()
 ~DataReaderHelper ()
void addDataFromFile (const char *filePath)
void addDataFromFileAsync (const char *imagePath, const char *plistPath, const char *filePath, cocos2d::Object *target, cocos2d::SEL_SCHEDULE selector)
void addDataAsyncCallBack (float dt)
void removeConfigFile (const char *configFile)

Static Public Member Functions

static CC_DEPRECATED_ATTRIBUTE
DataReaderHelper
sharedDataReaderHelper ()
 @ More...
 
static DataReaderHelpergetInstance ()
static void setPositionReadScale (float scale)
 Scale the position data, used for multiresolution adapter It won't effect the data already read. More...
 
static float getPositionReadScale ()
static void purge ()
static void addDataFromCache (const char *pFileContent, DataInfo *dataInfo=nullptr)
 Translate XML export from Dragon Bone flash tool to datas, and save them. More...
 
static ArmatureDatadecodeArmature (tinyxml2::XMLElement *armatureXML, DataInfo *dataInfo)
 Decode Armature Datas from xml export from Dragon Bone flash tool. More...
 
static BoneDatadecodeBone (tinyxml2::XMLElement *boneXML, tinyxml2::XMLElement *parentXML, DataInfo *dataInfo)
static DisplayDatadecodeBoneDisplay (tinyxml2::XMLElement *displayXML, DataInfo *dataInfo)
static AnimationDatadecodeAnimation (tinyxml2::XMLElement *animationXML, DataInfo *dataInfo)
 Decode ArmatureAnimation Datas from xml export from Dragon Bone flash tool. More...
 
static MovementDatadecodeMovement (tinyxml2::XMLElement *movementXML, ArmatureData *armatureData, DataInfo *dataInfo)
static MovementBoneDatadecodeMovementBone (tinyxml2::XMLElement *movBoneXml, tinyxml2::XMLElement *parentXml, BoneData *boneData, DataInfo *dataInfo)
static FrameDatadecodeFrame (tinyxml2::XMLElement *frameXML, tinyxml2::XMLElement *parentFrameXml, BoneData *boneData, DataInfo *dataInfo)
static TextureDatadecodeTexture (tinyxml2::XMLElement *textureXML, DataInfo *dataInfo)
 Decode Texture Datas from xml export from Dragon Bone flash tool. More...
 
static ContourDatadecodeContour (tinyxml2::XMLElement *contourXML, DataInfo *dataInfo)
 Decode Contour Datas from xml export from Dragon Bone flash tool. More...
 
static void addDataFromJsonCache (const char *fileContent, DataInfo *dataInfo=nullptr)
static ArmatureDatadecodeArmature (JsonDictionary &json, DataInfo *dataInfo)
static BoneDatadecodeBone (JsonDictionary &json, DataInfo *dataInfo)
static DisplayDatadecodeBoneDisplay (JsonDictionary &json, DataInfo *dataInfo)
static AnimationDatadecodeAnimation (JsonDictionary &json, DataInfo *dataInfo)
static MovementDatadecodeMovement (JsonDictionary &json, DataInfo *dataInfo)
static MovementBoneDatadecodeMovementBone (JsonDictionary &json, DataInfo *dataInfo)
static FrameDatadecodeFrame (JsonDictionary &json, DataInfo *dataInfo)
static TextureDatadecodeTexture (JsonDictionary &json)
static ContourDatadecodeContour (JsonDictionary &json)
static void decodeNode (BaseData *node, JsonDictionary &json, DataInfo *dataInfo)

Protected Types

enum  ConfigType { DragonBone_XML, CocoStudio_JSON }
 

Protected Member Functions

void loadData ()

Protected Attributes

std::condition_variable _sleepCondition
std::thread * _loadingThread
std::mutex _sleepMutex
std::mutex _asyncStructQueueMutex
std::mutex _dataInfoMutex
std::mutex _addDataMutex
std::mutex _getFileMutex
unsigned long _asyncRefCount
unsigned long _asyncRefTotalCount
bool need_quit
std::queue< AsyncStruct * > * _asyncStructQueue
std::queue< DataInfo * > * _dataQueue

Static Protected Attributes

static std::vector< std::string > _configFileList
static DataReaderHelper_dataReaderHelper

Additional Inherited Members

- Private Member Functions inherited from Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)
virtual void update (float dt)
- Private Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 
unsigned int _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 

Member Enumeration Documentation

enum ConfigType
protected
Enumerator
DragonBone_XML 
CocoStudio_JSON 

Constructor & Destructor Documentation

Member Function Documentation

void addDataAsyncCallBack ( float  dt)
static void addDataFromCache ( const char *  pFileContent,
DataInfo dataInfo = nullptr 
)
static

Translate XML export from Dragon Bone flash tool to datas, and save them.

When you add a new xml, the data already saved will be keeped.

Parameters
xmlPathThe cache of the xml
void addDataFromFile ( const char *  filePath)
void addDataFromFileAsync ( const char *  imagePath,
const char *  plistPath,
const char *  filePath,
cocos2d::Object target,
cocos2d::SEL_SCHEDULE  selector 
)
static void addDataFromJsonCache ( const char *  fileContent,
DataInfo dataInfo = nullptr 
)
static
static AnimationData*
decodeAnimation
( tinyxml2::XMLElement *  animationXML,
DataInfo dataInfo 
)
static

Decode ArmatureAnimation Datas from xml export from Dragon Bone flash tool.

static AnimationData*
decodeAnimation
( JsonDictionary json,
DataInfo dataInfo 
)
static
static ArmatureData* decodeArmature ( tinyxml2::XMLElement *  armatureXML,
DataInfo dataInfo 
)
static

Decode Armature Datas from xml export from Dragon Bone flash tool.

static ArmatureData* decodeArmature ( JsonDictionary json,
DataInfo dataInfo 
)
static
static BoneData* decodeBone ( tinyxml2::XMLElement *  boneXML,
tinyxml2::XMLElement *  parentXML,
DataInfo dataInfo 
)
static
static BoneData* decodeBone ( JsonDictionary json,
DataInfo dataInfo 
)
static
static DisplayData*
decodeBoneDisplay
( tinyxml2::XMLElement *  displayXML,
DataInfo dataInfo 
)
static
static DisplayData*
decodeBoneDisplay
( JsonDictionary json,
DataInfo dataInfo 
)
static
static ContourData* decodeContour ( tinyxml2::XMLElement *  contourXML,
DataInfo dataInfo 
)
static

Decode Contour Datas from xml export from Dragon Bone flash tool.

static ContourData* decodeContour ( JsonDictionary json)
static
static FrameData* decodeFrame ( tinyxml2::XMLElement *  frameXML,
tinyxml2::XMLElement *  parentFrameXml,
BoneData boneData,
DataInfo dataInfo 
)
static
static FrameData* decodeFrame ( JsonDictionary json,
DataInfo dataInfo 
)
static
static MovementData* decodeMovement ( tinyxml2::XMLElement *  movementXML,
ArmatureData armatureData,
DataInfo dataInfo 
)
static
static MovementData* decodeMovement ( JsonDictionary json,
DataInfo dataInfo 
)
static
static MovementBoneData*
decodeMovementBone
( tinyxml2::XMLElement *  movBoneXml,
tinyxml2::XMLElement *  parentXml,
BoneData boneData,
DataInfo dataInfo 
)
static
static MovementBoneData*
decodeMovementBone
( JsonDictionary json,
DataInfo dataInfo 
)
static
static void decodeNode ( BaseData node,
JsonDictionary json,
DataInfo dataInfo 
)
static
static TextureData* decodeTexture ( tinyxml2::XMLElement *  textureXML,
DataInfo dataInfo 
)
static

Decode Texture Datas from xml export from Dragon Bone flash tool.

static TextureData* decodeTexture ( JsonDictionary json)
static
static DataReaderHelper*
getInstance
( )
static
static float getPositionReadScale ( )
static
void loadData ( )
protected
static void purge ( )
static
void removeConfigFile ( const char *  configFile)
static void setPositionReadScale ( float  scale)
static

Scale the position data, used for multiresolution adapter It won't effect the data already read.

static CC_DEPRECATED_ATTRIBUTE
DataReaderHelper*
sharedDataReaderHelper
( )
inlinestatic

@

Member Data Documentation

std::mutex _addDataMutex
protected
unsigned long _asyncRefCount
protected
unsigned long _asyncRefTotalCount
protected
std::queue<AsyncStruct *>
* _asyncStructQueue
protected
std::mutex _asyncStructQueueMutex
protected
std::vector<std::string>
_configFileList
staticprotected
std::mutex _dataInfoMutex
protected
std::queue<DataInfo *>* _dataQueue
protected
DataReaderHelper* _dataReaderHelper
staticprotected
std::mutex _getFileMutex
protected
std::thread* _loadingThread
protected
std::condition_variable
_sleepCondition
protected
std::mutex _sleepMutex
protected
bool need_quit
protected

The documentation for this class was generated from the following file: