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

#include <CCDataReaderHelper.h>

Inheritance diagram for DataReaderHelper:
Ref

Public Member Functions

 DataReaderHelper ()
 ~DataReaderHelper ()
void addDataFromFile (const std::string &filePath)
void addDataFromFileAsync (const std::string &imagePath, const std::string &plistPath, const std::string &filePath, cocos2d::Ref *target, cocos2d::SEL_SCHEDULE selector)
void addDataAsyncCallBack (float dt)
void removeConfigFile (const std::string &configFile)

Static Public Member Functions

static CC_DEPRECATED_ATTRIBUTE
DataReaderHelper * 
sharedDataReaderHelper ()
 @ More...
 
static DataReaderHelper * getInstance ()
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 std::string &pFileContent, DataInfo *dataInfo=nullptr)
 Translate XML export from Dragon Bone flash tool to datas, and save them. More...
 
static ArmatureData * decodeArmature (tinyxml2::XMLElement *armatureXML, DataInfo *dataInfo)
 Decode Armature Datas from xml export from Dragon Bone flash tool. More...
 
static BoneData * decodeBone (tinyxml2::XMLElement *boneXML, tinyxml2::XMLElement *parentXML, DataInfo *dataInfo)
static DisplayData * decodeBoneDisplay (tinyxml2::XMLElement *displayXML, DataInfo *dataInfo)
static AnimationData * decodeAnimation (tinyxml2::XMLElement *animationXML, DataInfo *dataInfo)
 Decode ArmatureAnimation Datas from xml export from Dragon Bone flash tool. More...
 
static MovementData * decodeMovement (tinyxml2::XMLElement *movementXML, ArmatureData *armatureData, DataInfo *dataInfo)
static MovementBoneData * decodeMovementBone (tinyxml2::XMLElement *movBoneXml, tinyxml2::XMLElement *parentXml, BoneData *boneData, DataInfo *dataInfo)
static FrameData * decodeFrame (tinyxml2::XMLElement *frameXML, tinyxml2::XMLElement *parentFrameXml, BoneData *boneData, DataInfo *dataInfo)
static TextureData * decodeTexture (tinyxml2::XMLElement *textureXML, DataInfo *dataInfo)
 Decode Texture Datas from xml export from Dragon Bone flash tool. More...
 
static ContourData * decodeContour (tinyxml2::XMLElement *contourXML, DataInfo *dataInfo)
 Decode Contour Datas from xml export from Dragon Bone flash tool. More...
 
static void addDataFromJsonCache (const std::string &fileContent, DataInfo *dataInfo=nullptr)
static ArmatureData * decodeArmature (const rapidjson::Value &json, DataInfo *dataInfo)
static BoneData * decodeBone (const rapidjson::Value &json, DataInfo *dataInfo)
static DisplayData * decodeBoneDisplay (const rapidjson::Value &json, DataInfo *dataInfo)
static AnimationData * decodeAnimation (const rapidjson::Value &json, DataInfo *dataInfo)
static MovementData * decodeMovement (const rapidjson::Value &json, DataInfo *dataInfo)
static MovementBoneData * decodeMovementBone (const rapidjson::Value &json, DataInfo *dataInfo)
static FrameData * decodeFrame (const rapidjson::Value &json, DataInfo *dataInfo)
static TextureData * decodeTexture (const rapidjson::Value &json)
static ContourData * decodeContour (const rapidjson::Value &json)
static void decodeNode (BaseData *node, const rapidjson::Value &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 Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Release the ownership immediately. More...
 
local release ()
 Release the ownership immediately. More...
 
Ref * autorelease ()
 Release the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. 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 std::string &  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 std::string &  filePath)
void addDataFromFileAsync ( const std::string &  imagePath,
const std::string &  plistPath,
const std::string &  filePath,
cocos2d::Ref *  target,
cocos2d::SEL_SCHEDULE  selector 
)
static void addDataFromJsonCache ( const std::string &  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
( const rapidjson::Value &  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 ( const rapidjson::Value &  json,
DataInfo *  dataInfo 
)
static
static BoneData* decodeBone ( tinyxml2::XMLElement *  boneXML,
tinyxml2::XMLElement *  parentXML,
DataInfo *  dataInfo 
)
static
static BoneData* decodeBone ( const rapidjson::Value &  json,
DataInfo *  dataInfo 
)
static
static DisplayData*
decodeBoneDisplay
( tinyxml2::XMLElement *  displayXML,
DataInfo *  dataInfo 
)
static
static DisplayData*
decodeBoneDisplay
( const rapidjson::Value &  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 ( const rapidjson::Value &  json)
static
static FrameData* decodeFrame ( tinyxml2::XMLElement *  frameXML,
tinyxml2::XMLElement *  parentFrameXml,
BoneData *  boneData,
DataInfo *  dataInfo 
)
static
static FrameData* decodeFrame ( const rapidjson::Value &  json,
DataInfo *  dataInfo 
)
static
static MovementData* decodeMovement ( tinyxml2::XMLElement *  movementXML,
ArmatureData *  armatureData,
DataInfo *  dataInfo 
)
static
static MovementData* decodeMovement ( const rapidjson::Value &  json,
DataInfo *  dataInfo 
)
static
static MovementBoneData*
decodeMovementBone
( tinyxml2::XMLElement *  movBoneXml,
tinyxml2::XMLElement *  parentXml,
BoneData *  boneData,
DataInfo *  dataInfo 
)
static
static MovementBoneData*
decodeMovementBone
( const rapidjson::Value &  json,
DataInfo *  dataInfo 
)
static
static void decodeNode ( BaseData *  node,
const rapidjson::Value &  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 ( const rapidjson::Value &  json)
static
static DataReaderHelper*
getInstance
( )
static
static float getPositionReadScale ( )
static
void loadData ( )
protected
static void purge ( )
static
void removeConfigFile ( const std::string &  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: