FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
regexConfParser.hpp
1 /*
2  * Copyright (C) 2015, Siemens AG
3  * Author: Maximilian Huber
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2
7  * as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef REGEXCONFPARSER_HPP_
20 #define REGEXCONFPARSER_HPP_
21 
22 #include <map>
23 #include <sstream>
24 #include <fstream>
25 
26 extern "C" {
27 #include "libfossology.h"
28 }
29 
34 typedef std::map<std::string, std::string> RegexMap;
35 
36 RegexMap readConfStreamToMap(std::istringstream& stream,
37  const bool isVerbosityDebug = false);
38 
39 RegexMap readConfStreamToMap(std::ifstream& stream,
40  const bool isVerbosityDebug = false);
41 
42 void addRegexToMap(/*in and out*/ RegexMap& oldMap,
43  const std::string& regexDesc,
44  const bool isVerbosityDebug = false);
45 
46 std::string replaceTokens(/*in*/ RegexMap& dict,
47  const std::string& constInput);
48 
49 #endif /* REGEXCONFPARSER_HPP_ */
RegexMap readConfStreamToMap(std::istringstream &stream, const bool isVerbosityDebug)
Read a string stream and crate a RegexMap.
The main FOSSology C library.
void addRegexToMap(RegexMap &regexMap, const std::string &regexDesc, const bool isVerbosityDebug)
Given a single line as &#39;key=value&#39; pair, create a RegexMap.
string replaceTokens(RegexMap &regexMap, const string &constInput)
Removes tokens separated by RGX_SEPARATOR_LEFT in constInput using regexMap.