bool checkDocError (tinyxml2::XMLDocument &rDoc) { if (rDoc.ErrorID()!=0) { std::cout << "doc.ErrorID(): " << rDoc.ErrorID() << std::endl; return false; } return true; }
CSnapshot(const void *pointer, const size_t size) { memcpy(&m_eCurrentGameState, pointer, sizeof(CGameState::EGameStates)); char *pChar = new char[size]; memcpy(pChar, static_cast<const CGameState::EGameStates*>(pointer) + 1, size - sizeof(CGameState::EGameStates)); m_XMLDoc.Parse(pChar); if (m_XMLDoc.Error()) { throw Ogre::Exception(Ogre::Exception::ERR_FILE_NOT_FOUND, "Save state xml document cout not be parsed. Error code" + Ogre::StringConverter::toString(m_XMLDoc.ErrorID()) + " File content:\n" + Ogre::String(pChar), __FILE__); } delete [] pChar; // read the document readDocument(); }