blob: 53e31f4edc4ab1a3272239e30af25d4cf063f7d7 (
plain) (
blame)
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
|
#pragma once
#include "types.hh"
#include <sys/types.h>
#include <regex.h>
#include <map>
namespace nix {
MakeError(RegexError, Error)
class Regex
{
public:
Regex(const string & pattern, bool subs = false);
~Regex();
bool matches(const string & s);
typedef std::map<unsigned int, string> Subs;
bool matches(const string & s, Subs & subs);
private:
unsigned nrParens;
regex_t preg;
string showError(int err);
};
}
|