1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4 
5 #include "cmConfigure.h" // IWYU pragma: keep
6 
7 #include <string>
8 #include <vector>
9 
10 class cmCTest;
11 class cmCTestCoverageHandlerContainer;
12 
13 /** \class cmParsePythonCoverage
14  * \brief Parse coverage.py Python coverage information
15  *
16  * This class is used to parse the output of the coverage.py tool that
17  * is currently maintained by Ned Batchelder. That tool has a command
18  * that produces xml output in the format typically output by the common
19  * Java-based Cobertura coverage application. This helper class parses
20  * that XML file to fill the coverage-handler container.
21  */
22 class cmParseCoberturaCoverage
23 {
24 public:
25   //! Create the coverage parser by passing in the coverage handler
26   //! container and the cmCTest object
27   cmParseCoberturaCoverage(cmCTestCoverageHandlerContainer& cont,
28                            cmCTest* ctest);
29 
30   bool inSources;
31   bool inSource;
32   std::vector<std::string> filepaths;
33   //! Read the XML produced by running `coverage xml`
34   bool ReadCoverageXML(const char* xmlFile);
35 
36 private:
37   class XMLParser;
38 
39   cmCTestCoverageHandlerContainer& Coverage;
40   cmCTest* CTest;
41   std::string CurFileName;
42 };
43