1 | #pragma once |
2 | |
3 | #include <Poco/DOM/Document.h> |
4 | #include <Poco/Util/XMLConfiguration.h> |
5 | #include <Core/Types.h> |
6 | #include <vector> |
7 | #include <string> |
8 | |
9 | namespace DB |
10 | { |
11 | |
12 | using XMLConfiguration = Poco::Util::XMLConfiguration; |
13 | using XMLConfigurationPtr = Poco::AutoPtr<XMLConfiguration>; |
14 | using XMLDocumentPtr = Poco::AutoPtr<Poco::XML::Document>; |
15 | |
16 | class ConfigPreprocessor |
17 | { |
18 | public: |
19 | ConfigPreprocessor(const Strings & paths_) |
20 | : paths(paths_) |
21 | {} |
22 | |
23 | std::vector<XMLConfigurationPtr> processConfig( |
24 | const Strings & tests_tags, |
25 | const Strings & tests_names, |
26 | const Strings & tests_names_regexp, |
27 | const Strings & skip_tags, |
28 | const Strings & skip_names, |
29 | const Strings & skip_names_regexp) const; |
30 | |
31 | private: |
32 | |
33 | enum class FilterType |
34 | { |
35 | Tag, |
36 | Name, |
37 | Name_regexp |
38 | }; |
39 | |
40 | /// Removes configurations that has a given value. |
41 | /// If leave is true, the logic is reversed. |
42 | void removeConfigurationsIf( |
43 | std::vector<XMLConfigurationPtr> & configs, |
44 | FilterType filter_type, |
45 | const Strings & values, |
46 | bool leave = false) const; |
47 | |
48 | const Strings paths; |
49 | }; |
50 | } |
51 | |