| 1852 | } |
| 1853 | |
| 1854 | bool CAUIEditorParser::initWithPath(const std::string& filePath, CAView* superview) |
| 1855 | { |
| 1856 | this->init(); |
| 1857 | |
| 1858 | unsigned long size = 0; |
| 1859 | const char* data = (const char*)CCFileUtils::sharedFileUtils()->getFileData(filePath.c_str(), "rb", &size); |
| 1860 | if (size > 0) |
| 1861 | { |
| 1862 | std::string str; |
| 1863 | str.resize(size); |
| 1864 | for (size_t i = 0; i < size; i++) |
| 1865 | { |
| 1866 | str[i] = data[i]; |
| 1867 | } |
| 1868 | |
| 1869 | m_pMyDocument = new tinyxml2::XMLDocument(); |
| 1870 | m_pMyDocument->Parse(data, size); |
| 1871 | tinyxml2::XMLElement* rootElement = m_pMyDocument->RootElement(); |
| 1872 | |
| 1873 | tinyxml2::XMLElement* entity = NULL; |
| 1874 | if (rootElement) |
| 1875 | { |
| 1876 | entity = rootElement->FirstChildElement("ViewList"); |
| 1877 | } |
| 1878 | |
| 1879 | tinyxml2::XMLElement* viewXml = ((tinyxml2::XMLElement*)entity->FirstChildElement()); |
| 1880 | parserXml(viewXml, superview, m_mViews); |
| 1881 | } |
| 1882 | |
| 1883 | return true; |
| 1884 | } |
| 1885 | |
| 1886 | void CAUIEditorParser::parseViewControllItems(CAViewController* viewController) |
| 1887 | { |
no test coverage detected