MCPcopy Create free account
hub / github.com/9miao/CrossApp / initWithPath

Method initWithPath

CrossApp/support/CAUIEditorParser.cpp:1854–1884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1852}
1853
1854bool 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
1886void CAUIEditorParser::parseViewControllItems(CAViewController* viewController)
1887{

Callers 2

parserMethod · 0.80
parserMethod · 0.80

Calls 7

parserXmlFunction · 0.85
ParseMethod · 0.80
FirstChildElementMethod · 0.80
initMethod · 0.45
getFileDataMethod · 0.45
c_strMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected