static void readEntities(const std::string &strValue, std::wstring &strResult) { size_t size = 0; std::string strMulti; readEntities(strValue, strMulti); strResult.resize(strMulti.size()); mbstowcs_s(&size, &strResult[0], strResult.size(), strMulti.c_str(), strMulti.size()); strResult.resize(size); }
// retrieve PC Data (free text nodes under an element). bool Reader::readPCData(std::wstring &strData) { bool bOK = false; if (_stack.size() > 0 && _stack.back().Children) { std::string strText; strText.reserve(128); bOK = _parser.readText(strText, '<'); if (bOK) readEntities(strText, strData); } return bOK; }
const Model::NodeList& NodeReader::read(const BBox3& worldBounds) { try { readEntities(m_factory->format(), worldBounds); } catch (const ParserException&) { VectorUtils::clearAndDelete(m_nodes); try { reset(); readBrushes(m_factory->format(), worldBounds); } catch (const ParserException&) { VectorUtils::clearAndDelete(m_nodes); throw; } } return m_nodes; }
// retrieve text for the named attribute. bool Reader::getAttribute(const char *strAttribute, std::wstring &strValue) { strValue.resize(0); std::list< std::pair<std::string, std::string> >::const_iterator it = _attributes.begin(); while (it != _attributes.end() ) { if ( (*it).first.compare(strAttribute) == 0) { // expand entities only when value is requested. readEntities((*it).second, strValue); return true; } it++; } return false; }