FOSSology  4.4.0
Open Source License Compliance by Open Source Software
regexConfProvider.hpp
1 /*
2  SPDX-FileCopyrightText: © 2015 Siemens AG
3  Author: Maximilian Huber
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 #ifndef REGEXCONFPROVIDER_HPP_
9 #define REGEXCONFPROVIDER_HPP_
10 
11 #include <string>
12 #include <vector>
13 #include <map>
14 #include <sstream>
15 #include <fstream>
16 #include <iostream>
17 
18 #include "regexConfParser.hpp"
19 
20 std::string getRegexConfFile(const std::string& identity);
21 
27 {
28 public:
29  explicit RegexConfProvider(const bool isVerbosityDebug = false);
30 
31  void maybeLoad(const std::string& identity);
32  void maybeLoad(const std::string& identity,
33  std::istringstream& stream);
34 
35  const char* getRegexValue(const std::string& name,
36  const std::string& key);
37 
38 private:
39  static std::map<std::string,RegexMap> _regexMapMap;
40 
43  bool getRegexConfStream(const std::string& identity,
44  /*out*/ std::ifstream& stream);
45 };
46 
47 #endif /* REGEXCONFPROVIDER_HPP_ */
Provide regex using conf file.
void maybeLoad(const std::string &identity)
Check if identity already loaded in RegexMap, if not load them.
bool getRegexConfStream(const std::string &identity, std::ifstream &stream)
Get file stream for regex conf file.
RegexConfProvider(const bool isVerbosityDebug=false)
Constructor to set verbosity level.
const char * getRegexValue(const std::string &name, const std::string &key)
Get the regex as string from the RegexMap.
static std::map< std::string, RegexMap > _regexMapMap
Map to store RegexMap with a string key.
string getRegexConfFile(const string &identity)
Get the regex conf file.