15 #ifndef INCG_IRIS_IUTEST_DEFAULT_XML_GENERATOR_HPP_791DCB98_05CC_49BA_8518_0EC9CA2B5450_
16 #define INCG_IRIS_IUTEST_DEFAULT_XML_GENERATOR_HPP_791DCB98_05CC_49BA_8518_0EC9CA2B5450_
26 class DefaultXmlGeneratorListener :
public EmptyTestEventListener
28 ::std::string m_output_path_format;
29 ::std::string m_output_path;
45 TestEnv::event_listeners().set_default_xml_generator(NULL);
51 const ::std::string&
GetFilePath()
const {
return m_output_path; }
57 void SetFilePath(const ::std::string& path)
61 m_output_path_format.clear();
62 m_output_path = detail::kStrings::DefaultXmlReportFileName;
66 m_output_path_format = path;
67 const ::std::string::size_type pos = path.find(
'.');
68 if( pos == ::std::string::npos
69 || pos == path.length()-1 )
71 m_output_path_format += detail::GetPathSeparator();
72 m_output_path_format += detail::kStrings::DefaultXmlReportFileName;
74 m_output_path = m_output_path_format;
83 virtual bool IsReportable(
const UnitTest& test) { IUTEST_UNUSED_VAR(test);
return true; }
84 virtual void OnReportTest(IFile* file,
const UnitTest& test);
87 static void OnReportTestCase(IFile* file,
const TestCase& test_case);
88 static void OnReportTestInfo(IFile* file,
const TestInfo& test_info);
89 static void OnReportTestProperty(IFile* file,
const TestResult& test_result
90 ,
bool (*pfnValidate)(const ::std::string&));
91 static void OnReportTestSkipped(IFile* file,
const TestInfo& test_info);
94 virtual bool FileOpen(
const char* path);
95 virtual void FileClose();
98 static void OutputXmlCDataSection(IFile* file,
const char* data);
99 static void OutputXmlAttribute(IFile* file,
const char* name,
const char* value);
102 static ::std::string EscapeXmlAttribute(
const char* str)
106 static ::std::string EscapeXmlAttribute(const ::std::string str)
110 static ::std::string EscapeXmlText(
const char* str)
117 static ::std::string
EscapeXml(
const char* str,
bool is_attribute);
125 return c == 0x9 || c == 0xA || c == 0xD;
133 IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_BEGIN()
135 IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_END()
143 if( !xmlpath.empty() )
155 # include "../impl/iutest_default_xml_generator.ipp"
158 #endif // INCG_IRIS_IUTEST_DEFAULT_XML_GENERATOR_HPP_791DCB98_05CC_49BA_8518_0EC9CA2B5450_