FOSSology  4.4.0
Open Source License Compliance by Open Source Software
regexConfParser.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 REGEXCONFPARSER_HPP_
9 #define REGEXCONFPARSER_HPP_
10 
11 #include <map>
12 #include <sstream>
13 #include <fstream>
14 
15 extern "C" {
16 #include "libfossology.h"
17 }
18 
23 typedef std::map<std::string, std::string> RegexMap;
24 
25 RegexMap readConfStreamToMap(std::istringstream& stream,
26  const bool isVerbosityDebug = false);
27 
28 RegexMap readConfStreamToMap(std::ifstream& stream,
29  const bool isVerbosityDebug = false);
30 
31 void addRegexToMap(/*in and out*/ RegexMap& oldMap,
32  const std::string& regexDesc,
33  const bool isVerbosityDebug = false);
34 
35 std::string replaceTokens(/*in*/ RegexMap& dict,
36  const std::string& constInput);
37 
38 #endif /* REGEXCONFPARSER_HPP_ */
The main FOSSology C library.
void addRegexToMap(RegexMap &regexMap, const std::string &regexDesc, const bool isVerbosityDebug)
Given a single line as 'key=value' pair, create a RegexMap.
RegexMap readConfStreamToMap(std::istringstream &stream, const bool isVerbosityDebug)
Read a string stream and crate a RegexMap.
string replaceTokens(RegexMap &regexMap, const string &constInput)
Removes tokens separated by RGX_SEPARATOR_LEFT in constInput using regexMap.