| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2000-2014 Ericsson Telecom AB |
| 3 | // All rights reserved. This program and the accompanying materials |
| 4 | // are made available under the terms of the Eclipse Public License v1.0 |
| 5 | // which accompanies this distribution, and is available at |
| 6 | // http://www.eclipse.org/legal/epl-v10.html |
| 7 | /////////////////////////////////////////////////////////////////////////////// |
| 8 | #ifndef TCOV2LCOV_HH |
| 9 | #define TCOV2LCOV_HH |
| 10 | |
| 11 | #include <string> |
| 12 | #include <map> |
| 13 | #include <vector> |
| 14 | |
| 15 | // File specific data. |
| 16 | class TcovData |
| 17 | { |
| 18 | public: |
| 19 | void inc_function(const std::string& function, int n); |
| 20 | void inc_line(int line, int n); |
| 21 | inline const std::map<std::string, int>& get_functions() const { return m_functions; } |
| 22 | inline const std::map<int, int>& get_lines() const { return m_lines; } |
| 23 | private: |
| 24 | std::map<std::string, int> m_functions; |
| 25 | std::map<int, int> m_lines; |
| 26 | }; |
| 27 | |
| 28 | class Tcov2Lcov { |
| 29 | public: |
| 30 | Tcov2Lcov(const char *code_base, const char *input_dir, const char *output_file, const char *xsd_file); |
| 31 | ~Tcov2Lcov(); |
| 32 | int collect(); |
| 33 | int validate() const; |
| 34 | int merge(); |
| 35 | int generate(); |
| 36 | void d_print_files() const; |
| 37 | private: |
| 38 | int collect_dir(std::string dir); |
| 39 | |
| 40 | std::map<std::string, TcovData *> m_data; |
| 41 | std::vector<std::string> m_files; // Relative paths. |
| 42 | std::string m_code_base; |
| 43 | std::string m_input_dir; |
| 44 | std::string m_output_file; |
| 45 | std::string m_xsd_file; |
| 46 | int m_ver_major; |
| 47 | int m_ver_minor; |
| 48 | }; |
| 49 | |
| 50 | #endif // TCOV2LCOV_HH |
| 51 | |