[go: up one dir, main page]

Menu

[r189]: / tags / 0.10 / lib / porg / rexp.h  Maximize  Restore  History

Download this file

45 lines (32 with data), 857 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//=======================================================================
// rexp.h
//-----------------------------------------------------------------------
// This file is part of the package porg
// Copyright (C) 2015 David Ricart
// For more information visit http://porg.sourceforge.net
//=======================================================================
#ifndef PORG_REXP_H
#define PORG_REXP_H
#include "config.h"
#include <iosfwd>
#include <regex.h>
namespace Porg
{
class Rexp
{
public:
Rexp(std::string const& exp = "", int flags = 0);
~Rexp();
bool compile(std::string const& exp, int flags = 0);
bool exec(std::string const&);
std::string match(int);
private:
static int const MAX_MATCHES = 8;
regex_t m_regex;
regmatch_t m_pmatch[MAX_MATCHES];
std::string m_str;
bool m_matched;
bool m_compiled;
};
}
#endif