CoxIter  1.3
CoxIter - Computing invariants of hyperbolic Coxeter groups
regexp.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2013, 2014
3 Rafael Guglielmetti, rafael.guglielmetti@unifr.ch
4 */
5 
6 /*
7 This file is part of CoxIter and AlVin.
8 
9 CoxIter is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as
11 published by the Free Software Foundation, either version 3 of the
12 License, or (at your option) any later version.
13 
14 CoxIter is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with CoxIter. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
30 #include <iostream>
31 #include <string>
32 #include <vector>
33 
34 #include <pcre.h>
35 
36 using namespace std;
37 
38 #ifndef __REGEXP_H__
39 #define __REGEXP_H__
40 
41 #include <stdexcept> // std::invalid_argument // TODO: remove
42 
43 typedef vector<vector<string>> PCREResult;
44 
45 class PCRERegexp {
46 private:
47  string error;
48  bool isClassUsed;
49 
50  pcre *regexp;
51  const char *regPattern;
52  const char *regSubject;
53  const char *regError;
54 
57 
58  int *ovector;
60 
61 public:
62  PCRERegexp(int iOvectorSize = 30);
63  ~PCRERegexp();
64 
74  int preg_match_all(const string &pattern, const string &subject,
75  PCREResult &results, const int &optionsCompile = 0);
76 
81  string get_error();
82 };
83 
84 #endif
Definition: regexp.h:45
int * ovector
Information about the result.
Definition: regexp.h:58
int regSubjectLength
Definition: regexp.h:56
bool isClassUsed
True if the class was used.
Definition: regexp.h:48
string error
Eventually, error code.
Definition: regexp.h:47
const char * regError
Definition: regexp.h:53
const char * regPattern
Definition: regexp.h:51
pcre * regexp
Definition: regexp.h:50
const char * regSubject
Definition: regexp.h:52
int regErrorOffset
Definition: regexp.h:55
int iOvectorSize
Size of the ovector array.
Definition: regexp.h:59
vector< vector< string > > PCREResult
Definition: regexp.h:43