mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-09 01:09:59 +01:00
SessionCreator xmldoc not by pointer.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "MediaPlayer.h"
|
||||
|
||||
#include <tinyxml2.h>
|
||||
#include "tinyxml2Toolkit.h"
|
||||
using namespace tinyxml2;
|
||||
|
||||
|
||||
@@ -40,22 +41,20 @@ std::string SessionCreator::info(const std::string& filename)
|
||||
|
||||
SessionCreator::SessionCreator(Session *session): Visitor(), session_(session)
|
||||
{
|
||||
xmlDoc_ = new XMLDocument;
|
||||
|
||||
}
|
||||
|
||||
SessionCreator::~SessionCreator()
|
||||
{
|
||||
delete xmlDoc_;
|
||||
}
|
||||
|
||||
bool SessionCreator::load(const std::string& filename)
|
||||
{
|
||||
XMLError eResult = xmlDoc_->LoadFile(filename.c_str());
|
||||
XMLError eResult = xmlDoc_.LoadFile(filename.c_str());
|
||||
if ( XMLResultError(eResult))
|
||||
return false;
|
||||
|
||||
XMLElement *header = xmlDoc_->FirstChildElement(APP_NAME);
|
||||
XMLElement *header = xmlDoc_.FirstChildElement(APP_NAME);
|
||||
if (header == nullptr) {
|
||||
Log::Warning("%s is not a %s session file.", filename.c_str(), APP_NAME);
|
||||
return false;
|
||||
@@ -70,10 +69,10 @@ bool SessionCreator::load(const std::string& filename)
|
||||
}
|
||||
|
||||
// ok, ready to read sources
|
||||
loadSession( xmlDoc_->FirstChildElement("Session") );
|
||||
loadSession( xmlDoc_.FirstChildElement("Session") );
|
||||
// excellent, session was created: load optionnal config
|
||||
if (session_){
|
||||
loadConfig( xmlDoc_->FirstChildElement("Views") );
|
||||
loadConfig( xmlDoc_.FirstChildElement("Views") );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#define SESSIONCREATOR_H
|
||||
|
||||
#include "Visitor.h"
|
||||
#include "tinyxml2Toolkit.h"
|
||||
#include <tinyxml2.h>
|
||||
|
||||
class Session;
|
||||
|
||||
class SessionCreator : public Visitor {
|
||||
|
||||
tinyxml2::XMLDocument *xmlDoc_;
|
||||
tinyxml2::XMLDocument xmlDoc_;
|
||||
tinyxml2::XMLElement *xmlCurrent_;
|
||||
Session *session_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user