ValueMap dictionaryWithDataOfFile(const char* filedata, int filesize) { _resultType = SAX_RESULT_DICT; SAXParser parser; CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); parser.setDelegator(this); parser.parse(filedata, filesize); return _rootDict; }
ValueVector arrayWithContentsOfFile(const std::string& fileName) { _resultType = SAX_RESULT_ARRAY; SAXParser parser; CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); parser.setDelegator(this); parser.parse(fileName); return _rootArray; }
ValueMap dictionaryWithContentsOfFile(const std::string& fileName) { _resultType = SAX_RESULT_DICT; SAXParser parser; CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); parser.setDelegator(this); parser.parse(fileName); return _rootDict; }
Vector<SpriteFrame*> getFrames(const std::string& fileName) { SAXParser parser; parser.init("UTF-8"); parser.setDelegator(this); parser.parse(fileName); return _frames; }
TMXFile::TMXFile(const char* pPath) { TMXFileParser tParser(this, pPath); SAXParser tSAXParser; tSAXParser.setDelegator(&tParser); tSAXParser.parse(pPath); if (tParser.Failed()) { CHU_LOGERROR("failed to load tmx from '%s'.", pPath); throw std::logic_error("LoadFailed"); } }
bool TMXMapInfo::parseXMLFile(const std::string& xmlFilename) { SAXParser parser; if (false == parser.init("UTF-8") ) { return false; } parser.setDelegator(this); return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename)); }
bool TMXMapInfo::parseXMLString(const std::string& xmlString) { size_t len = xmlString.size(); if (len <= 0) return false; SAXParser parser; if (false == parser.init("UTF-8") ) { return false; } parser.setDelegator(this); return parser.parse(xmlString.c_str(), len); }