FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
regscan.hpp
1 /*
2  * Copyright (C) 2015, Siemens AG
3  * Author: Florian Krügel
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 REGSCAN_HPP_
20 #define REGSCAN_HPP_
21 
22 #include "scanners.hpp"
23 #include "regex.hpp"
24 #include "regexConfProvider.hpp"
25 #include <sstream>
26 
31 class regexScanner : public scanner
32 {
37  rx::regex _reg;
44  const string _type, _identity;
49  int _index;
50 
51 public:
52  void ScanString(const string& str, list<match>& results) const;
53 
54  regexScanner(const string& type,
55  const string& identity,
56  int index = 0);
57  regexScanner(const string& type,
58  std::istringstream& stream,
59  int index = 0);
60 } ;
61 
62 
63 #endif
64 
rx::regex _reg
Definition: regscan.hpp:37
const string _identity
Definition: regscan.hpp:44
const string _type
Definition: regscan.hpp:44
Utilities to help scanners.
Provides a regex scanner using predefined regexs.
Definition: regscan.hpp:31
Abstract class to provide interface to scanners.
Definition: scanners.hpp:62
void ScanString(const string &str, list< match > &results) const
Scan a string using regex defined during initialization.
Definition: regscan.cc:62
regexScanner(const string &type, const string &identity, int index=0)
Initialize RegexConfProvider and regex based on type and identity.
Definition: regscan.cc:25
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321