mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
New Session class to contain the list of sources. Loading and Saving of
session files in XML. Verified deletion of Nodes, Groups and Sources.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include "tinyxml2Toolkit.h"
|
||||
#include "SystemToolkit.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <tinyxml2.h>
|
||||
#include "tinyxml2Toolkit.h"
|
||||
using namespace tinyxml2;
|
||||
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
@@ -80,11 +81,27 @@ void tinyxml2::XMLElementToGLM(XMLElement *elem, glm::mat4 &matrix)
|
||||
}
|
||||
}
|
||||
|
||||
void tinyxml2::XMLCheckResult(int r)
|
||||
void tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename)
|
||||
{
|
||||
XMLError result = (XMLError) r;
|
||||
if ( result != XML_SUCCESS)
|
||||
{
|
||||
Log::Error("XML error %i: %s", r, tinyxml2::XMLDocument::ErrorIDToName(result));
|
||||
}
|
||||
XMLDeclaration *pDec = doc->NewDeclaration();
|
||||
doc->InsertFirstChild(pDec);
|
||||
|
||||
std::string s = "Save time " + SystemToolkit::date_time_string();
|
||||
XMLComment *pComment = doc->NewComment(s.c_str());
|
||||
doc->InsertEndChild(pComment);
|
||||
|
||||
// save session
|
||||
XMLError eResult = doc->SaveFile(filename.c_str());
|
||||
XMLResultError(eResult);
|
||||
}
|
||||
|
||||
bool tinyxml2::XMLResultError(int result)
|
||||
{
|
||||
XMLError xmlresult = (XMLError) result;
|
||||
if ( xmlresult != XML_SUCCESS)
|
||||
{
|
||||
Log::Warning("XML error %i: %s", result, tinyxml2::XMLDocument::ErrorIDToName(xmlresult));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user