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