18 struct EndoDebugToXmlFileData
20 EndoDebug* m_EndoDebug;
21 const std::string* m_FileName;
25 const std::string* _FileName)
26 : d( new EndoDebugToXmlFileData )
28 d->m_EndoDebug = _EndoDebug;
29 d->m_FileName = _FileName;
39 std::string _FileName = *d->m_FileName;
41 TiXmlDocument doc( _FileName.c_str() );
42 TiXmlElement* root =
nullptr;
43 TiXmlElement* elem =
nullptr;
47 root = doc.FirstChildElement(
"data");
50 elem = root->FirstChildElement(
"EndoDebug" );
52 root->RemoveChild(elem);
59 auto decl =
new TiXmlDeclaration(
"1.0",
"",
"" );
60 doc.LinkEndChild( decl );
62 root =
new TiXmlElement(
"data" );
63 doc.LinkEndChild( root );
67 elem =
new TiXmlElement(
"EndoDebug" );
69 elem->SetAttribute(
"DebugEnabled",
70 (d->m_EndoDebug->GetDebugEnabled()? 1:0) );
71 elem->SetAttribute(
"ShowImagesInDebug",
72 (d->m_EndoDebug->GetShowImagesInDebug()? 1:0) );
73 elem->SetAttribute(
"ShowImagesTimeOut",
74 (static_cast<int>(d->m_EndoDebug->GetShowImagesTimeOut())) );
75 elem->SetAttribute(
"DebugImagesOutputDirectory",
76 d->m_EndoDebug->GetDebugImagesOutputDirectory() );
78 std::set<std::string> _FilesToDebug = d->m_EndoDebug->GetFilesToDebug();
79 std::string _FilesToDebugString;
80 auto it = _FilesToDebug.begin();
81 while( it != _FilesToDebug.end() )
83 if( it != _FilesToDebug.begin() )
84 _FilesToDebugString.append(
";" );
85 _FilesToDebugString.append( *it );
88 elem->SetAttribute(
"FilesToDebug", _FilesToDebugString );
90 std::set<std::string> _SymbolsToDebug = d->m_EndoDebug->GetSymbolsToDebug();
91 std::string _SymbolsToDebugString;
92 it = _SymbolsToDebug.begin();
93 while( it != _SymbolsToDebug.end() )
95 if( it != _SymbolsToDebug.begin() )
96 _SymbolsToDebugString.append(
";" );
97 _SymbolsToDebugString.append( *it );
100 elem->SetAttribute(
"SymbolsToDebug", _SymbolsToDebugString );
102 endodebug(
"adding the EndoDebug as child element of the data node")
103 root->LinkEndChild(elem);
106 if( !doc.SaveFile( _FileName ) )
108 endodebug(
"File " << _FileName <<
" could not be written. Please check permissions.");
114 d->m_EndoDebug = _EndoDebug;
119 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()