//------------------------------------------------------------------------------------------------------------- ///XML save entire object bool pMolLayer::save(QTextStream* stream) { XMLsaveOpen(stream, "pMolLayer"); saveContents(stream); XMLsaveClose(stream,"pMolLayer"); return true; };
bool pMolStackObject::save(QTextStream* stream) { XMLsaveOpen(stream, "pMolStackObject"); saveContents(stream); XMLsaveClose(stream,"pMolStackObject"); return true; };
// --- void VSWContentPrjSaver::saveProject (VSWContentProjectPt cntPrj, const std::string& fName, QBOOLEAN saveAll) { #ifdef __DEBUGSYSTEM __KEEPENTRYSIMPLETRACE #endif // Gets the real name of the file... // Initialy it is the name received as parameter, // but it is null, it will be the name keeped // into the aditional data of the content project object. // if that data does not exist, it will be not possible to open the file // and an exception will be thrown. // The method can be used to save an to save as a content project. std::string fileName = fName; if (fName == std::string (__NULL_STRING__)) if (cntPrj -> _aditionalData.exists (std::string (__GENVALUE_DESCRIPTORPATH__))) fileName = cntPrj -> _aditionalData.getStr (std::string (__GENVALUE_DESCRIPTORPATH__)) -> value ().asString (); else throw VSWContentSaverError (__DATAEXCEP (_IMPOSIBLEOPENAFILE_TXTERROR_)); // Extract the location path of the reproduction project description file... std::string pathForFile = onlyPath (fileName); // Open the file. // If not an exception will be thrown... std::ofstream file; std::string txtToSave (__NULL_STRING__); file.open (fileName.c_str ()); if (!file) throw VSWContentSaverError (__DATAEXCEP (_IMPOSIBLEOPENAFILE_TXTERROR_)); // Save the contents, schedulings, and sequences, // and create the list of them for this file. try { // Gets the docType tag, only if exists... std::string docType (__NULL_STRING__); if (cntPrj -> _aditionalData.exists (std::string (__GENVALUE_DOCTYPENAME__))) docType = std::string ("<!DOCTYPE ") + std::string (cntPrj -> _aditionalData.getStr (std::string (__GENVALUE_DOCTYPENAME__)) -> value ().asString ()) + std::string (" SYSTEM \"") + relPathFor (cntPrj -> _aditionalData.getStr (std::string (__GENVALUE_DOCTYPEDTD__)) -> value ().asString (), pathForFile) + std::string ("\">\n"); txtToSave += std::string ("\t<") + std::string (__ELEMENTSXML_TAGNAME__) + std::string (">\n"); txtToSave += saveContents (cntPrj, pathForFile, saveAll); txtToSave += saveSequences (cntPrj, pathForFile, saveAll); txtToSave += saveSchedulings (cntPrj, pathForFile, saveAll); txtToSave += saveEvents (cntPrj); txtToSave += std::string ("\t</") + std::string (__ELEMENTSXML_TAGNAME__) + std::string (">\n"); txtToSave = // Saves the header, and the paths... std::string (__HEADERXML_TAGNAME__) + docType + std::string ("<") + std::string (__CONTENTPROJECTXML_TAGNAME__) + std::string (" name=\"") + cntPrj -> name () + std::string ("\">\n") + std::string ("\t<") + std::string (__PRJPATHXML_TAGNAME__) + std::string (">\n") + extractPathsFrom (cntPrj, pathForFile) + std::string ("\t</") + std::string (__PRJPATHXML_TAGNAME__) + std::string (">\n") + txtToSave + std::string ("</") + std::string (__CONTENTPROJECTXML_TAGNAME__) + std::string (">\n"); } catch (CMTYException& excep) { throw VSWContentSaverError (excep, /* more deep in the history */ __DATAEXCEP (_IMPOSIBLETOSAVEFILE_TXTERROR_)); } // Save the content... file << txtToSave; file.close (); // ...and finaly close the file. #ifdef __DEBUGSYSTEM __KEEPEXITSIMPLETRACE #endif }