22 struct EndoDebugToXmlFileData
24 EndoDebug* m_EndoDebug;
25 const std::string* m_FileName;
29 const std::string* _FileName)
30 : d( new EndoDebugToXmlFileData )
32 d->m_EndoDebug = _EndoDebug;
33 d->m_FileName = _FileName;
43 std::string _FileName = *d->m_FileName;
45 TiXmlDocument doc( _FileName.c_str() );
46 TiXmlElement* root =
nullptr;
47 TiXmlElement* elem =
nullptr;
51 root = doc.FirstChildElement(
"data");
54 elem = root->FirstChildElement(
"EndoDebug" );
56 root->RemoveChild(elem);
63 auto decl =
new TiXmlDeclaration(
"1.0",
"",
"" );
64 doc.LinkEndChild( decl );
66 root =
new TiXmlElement(
"data" );
67 doc.LinkEndChild( root );
71 elem =
new TiXmlElement(
"EndoDebug" );
73 elem->SetAttribute(
"DebugEnabled",
74 (d->m_EndoDebug->GetDebugEnabled()? 1:0) );
75 elem->SetAttribute(
"ShowImagesInDebug",
76 (d->m_EndoDebug->GetShowImagesInDebug()? 1:0) );
77 elem->SetAttribute(
"ShowImagesTimeOut",
78 (static_cast<int>(d->m_EndoDebug->GetShowImagesTimeOut())) );
79 elem->SetAttribute(
"DebugImagesOutputDirectory",
80 d->m_EndoDebug->GetDebugImagesOutputDirectory() );
82 std::set<std::string> _FilesToDebug = d->m_EndoDebug->GetFilesToDebug();
83 std::string _FilesToDebugString;
84 auto it = _FilesToDebug.begin();
85 while( it != _FilesToDebug.end() )
87 if( it != _FilesToDebug.begin() )
88 _FilesToDebugString.append(
";" );
89 _FilesToDebugString.append( *it );
92 elem->SetAttribute(
"FilesToDebug", _FilesToDebugString );
94 std::set<std::string> _SymbolsToDebug = d->m_EndoDebug->GetSymbolsToDebug();
95 std::string _SymbolsToDebugString;
96 it = _SymbolsToDebug.begin();
97 while( it != _SymbolsToDebug.end() )
99 if( it != _SymbolsToDebug.begin() )
100 _SymbolsToDebugString.append(
";" );
101 _SymbolsToDebugString.append( *it );
104 elem->SetAttribute(
"SymbolsToDebug", _SymbolsToDebugString );
106 endodebug(
"adding the EndoDebug as child element of the data node")
107 root->LinkEndChild(elem);
110 if( !doc.SaveFile( _FileName ) )
112 endodebug(
"File " << _FileName <<
" could not be written. Please check permissions.");
118 d->m_EndoDebug = _EndoDebug;
123 d->m_FileName = _FileName;
void SetEndoDebug(EndoDebug *_EndoDebug)
void SetFileName(const std::string *_FileName)
DataCollection - Class to facilitate loading/accessing structured data.
EndoDebugToXmlFile(EndoDebug *_EndoDebug=nullptr, const std::string *_FileName=nullptr)
virtual ~EndoDebugToXmlFile()