diff --git a/cocos/2d/CCAnimationCache.cpp b/cocos/2d/CCAnimationCache.cpp index 4a600504ce..c76ccec235 100644 --- a/cocos/2d/CCAnimationCache.cpp +++ b/cocos/2d/CCAnimationCache.cpp @@ -226,7 +226,7 @@ void AnimationCache::addAnimationsWithFile(const std::string& plist) CCASSERT( plist.size()>0, "Invalid texture file name"); std::string path = FileUtils::getInstance()->fullPathForFilename(plist); - ValueMap dict = FileUtils::getInstance()->fileToValueMap(path); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(path); CCASSERT( !dict.empty(), "CCAnimationCache: File could not be found"); diff --git a/cocos/2d/CCParticleSystem.cpp b/cocos/2d/CCParticleSystem.cpp index 392452d1cf..9c58e15c9a 100644 --- a/cocos/2d/CCParticleSystem.cpp +++ b/cocos/2d/CCParticleSystem.cpp @@ -169,7 +169,7 @@ bool ParticleSystem::initWithFile(const std::string& plistFile) { bool bRet = false; _plistFile = FileUtils::getInstance()->fullPathForFilename(plistFile); - ValueMap dict = FileUtils::getInstance()->fileToValueMap(_plistFile.c_str()); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile.c_str()); CCASSERT( !dict.empty(), "Particles: file not found"); diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index 3d58ab6001..d16802ffec 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -199,7 +199,7 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu void SpriteFrameCache::addSpriteFramesWithFile(const std::string& pszPlist, Texture2D *pobTexture) { std::string fullPath = FileUtils::getInstance()->fullPathForFilename(pszPlist); - ValueMap dict = FileUtils::getInstance()->fileToValueMap(fullPath); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); addSpriteFramesWithDictionary(dict, pobTexture); } @@ -226,7 +226,7 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& pszPlist) if (_loadedFileNames->find(pszPlist) == _loadedFileNames->end()) { std::string fullPath = FileUtils::getInstance()->fullPathForFilename(pszPlist); - ValueMap dict = FileUtils::getInstance()->fileToValueMap(fullPath); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); string texturePath(""); @@ -335,7 +335,7 @@ void SpriteFrameCache::removeSpriteFrameByName(const std::string& name) void SpriteFrameCache::removeSpriteFramesFromFile(const std::string& plist) { std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist); - ValueMap dict = FileUtils::getInstance()->fileToValueMap(fullPath); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); if (dict.empty()) { CCLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFile: create dict by %s fail.",plist.c_str()); diff --git a/cocos/2d/platform/CCFileUtils.cpp b/cocos/2d/platform/CCFileUtils.cpp index 58ef862c59..3959ee98f5 100644 --- a/cocos/2d/platform/CCFileUtils.cpp +++ b/cocos/2d/platform/CCFileUtils.cpp @@ -303,14 +303,14 @@ public: } }; -ValueMap FileUtils::fileToValueMap(const std::string& filename) +ValueMap FileUtils::getValueMapFromFile(const std::string& filename) { std::string fullPath = fullPathForFilename(filename.c_str()); DictMaker tMaker; return std::move(tMaker.dictionaryWithContentsOfFile(fullPath.c_str())); } -ValueVector FileUtils::fileToValueVector(const std::string& filename) +ValueVector FileUtils::getValueVectorFromFile(const std::string& filename) { std::string fullPath = fullPathForFilename(filename.c_str()); DictMaker tMaker; @@ -456,8 +456,8 @@ static tinyxml2::XMLElement* generateElementForArray(ValueVector& array, tinyxml NS_CC_BEGIN /* The subclass FileUtilsApple should override these two method. */ -ValueMap FileUtils::fileToValueMap(const std::string& filename) {return ValueMap();} -ValueVector FileUtils::fileToValueVector(const std::string& filename) {return ValueVector();} +ValueMap FileUtils::getValueMapFromFile(const std::string& filename) {return ValueMap();} +ValueVector FileUtils::getValueVectorFromFile(const std::string& filename) {return ValueVector();} bool FileUtils::writeToFile(ValueMap& dict, const std::string &fullPath) {return false;} #endif /* (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) */ @@ -749,7 +749,7 @@ void FileUtils::loadFilenameLookupDictionaryFromFile(const std::string &filename std::string fullPath = fullPathForFilename(filename); if (fullPath.length() > 0) { - ValueMap dict = FileUtils::getInstance()->fileToValueMap(fullPath); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); if (!dict.empty()) { ValueMap& metadata = dict["metadata"].asValueMap(); diff --git a/cocos/2d/platform/CCFileUtils.h b/cocos/2d/platform/CCFileUtils.h index 9bdf4f632d..be2f3f2af7 100644 --- a/cocos/2d/platform/CCFileUtils.h +++ b/cocos/2d/platform/CCFileUtils.h @@ -300,7 +300,7 @@ public: * Converts the contents of a file to a ValueMap. * @note This method is used internally. */ - virtual ValueMap fileToValueMap(const std::string& filename); + virtual ValueMap getValueMapFromFile(const std::string& filename); /** * Write a ValueMap to a plist file. @@ -312,7 +312,7 @@ public: * Converts the contents of a file to a ValueVector. * @note This method is used internally. */ - virtual ValueVector fileToValueVector(const std::string& filename); + virtual ValueVector getValueVectorFromFile(const std::string& filename); protected: /** diff --git a/cocos/2d/platform/apple/CCFileUtilsApple.h b/cocos/2d/platform/apple/CCFileUtilsApple.h index 5bcb76732d..b80a54b908 100644 --- a/cocos/2d/platform/apple/CCFileUtilsApple.h +++ b/cocos/2d/platform/apple/CCFileUtilsApple.h @@ -46,10 +46,10 @@ public: virtual bool isFileExist(const std::string& strFilePath) const override; virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) override; - virtual ValueMap fileToValueMap(const std::string& filename) override; + virtual ValueMap getValueMapFromFile(const std::string& filename) override; virtual bool writeToFile(ValueMap& dict, const std::string& fullPath) override; - virtual ValueVector fileToValueVector(const std::string& filename) override; + virtual ValueVector getValueVectorFromFile(const std::string& filename) override; }; // end of platform group diff --git a/cocos/2d/platform/apple/CCFileUtilsApple.mm b/cocos/2d/platform/apple/CCFileUtilsApple.mm index 0b18e49b7e..11b2644a6b 100644 --- a/cocos/2d/platform/apple/CCFileUtilsApple.mm +++ b/cocos/2d/platform/apple/CCFileUtilsApple.mm @@ -308,7 +308,7 @@ std::string FileUtilsApple::getFullPathForDirectoryAndFilename(const std::string return ""; } -ValueMap FileUtilsApple::fileToValueMap(const std::string& filename) +ValueMap FileUtilsApple::getValueMapFromFile(const std::string& filename) { std::string fullPath = fullPathForFilename(filename); NSString* path = [NSString stringWithUTF8String:fullPath.c_str()]; @@ -344,7 +344,7 @@ bool FileUtilsApple::writeToFile(ValueMap& dict, const std::string &fullPath) return true; } -ValueVector FileUtilsApple::fileToValueVector(const std::string& filename) +ValueVector FileUtilsApple::getValueVectorFromFile(const std::string& filename) { // NSString* pPath = [NSString stringWithUTF8String:pFileName]; // NSString* pathExtension= [pPath pathExtension]; diff --git a/cocos/base/CCArray.cpp b/cocos/base/CCArray.cpp index c137a21970..27b04422a6 100644 --- a/cocos/base/CCArray.cpp +++ b/cocos/base/CCArray.cpp @@ -478,7 +478,7 @@ Array* Array::createWithContentsOfFile(const char* fileName) Array* Array::createWithContentsOfFileThreadSafe(const char* fileName) { - ValueVector arr = FileUtils::getInstance()->fileToValueVector(fileName); + ValueVector arr = FileUtils::getInstance()->getValueVectorFromFile(fileName); Array* ret = Array::createWithCapacity(arr.size()); diff --git a/cocos/base/CCDictionary.cpp b/cocos/base/CCDictionary.cpp index aca15e4a0b..107203285f 100644 --- a/cocos/base/CCDictionary.cpp +++ b/cocos/base/CCDictionary.cpp @@ -444,7 +444,7 @@ static Array* visitArray(const ValueVector& array) Dictionary* Dictionary::createWithContentsOfFileThreadSafe(const char *pFileName) { - return visitDict(FileUtils::getInstance()->fileToValueMap(pFileName)); + return visitDict(FileUtils::getInstance()->getValueMapFromFile(pFileName)); } void Dictionary::acceptVisitor(DataVisitor &visitor)