mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
loadXMLtoDOM, saveDOMtoXML перенес в Tools
This commit is contained in:
@@ -104,3 +104,37 @@ bool Tools::checkNonStaticData(QString path)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Tools::loadXMLtoDOM(QString nameFile, QDomDocument *commonDOM)
|
||||
{
|
||||
QFile xmlInFile(nameFile);
|
||||
|
||||
if (! xmlInFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||
qDebug() << "loadXMLtoDOM: Couldn't read the file: " + nameFile;
|
||||
return false;
|
||||
}
|
||||
|
||||
commonDOM->setContent(xmlInFile.readAll());
|
||||
xmlInFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Tools::saveDOMtoXML(QString nameFile, QDomDocument *commonDOM)
|
||||
{
|
||||
QFile xmlOutFile(nameFile);
|
||||
if (!xmlOutFile.open(QFile::WriteOnly | QFile::Text))
|
||||
{
|
||||
qDebug() << "saveDOMtoXML: Failed to write a file: " + nameFile;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream outFile(&xmlOutFile);
|
||||
commonDOM->save(outFile, 4);
|
||||
xmlOutFile.close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user