aboutsummaryrefslogtreecommitdiff
path: root/src/regexp.h
blob: 96f37470cc623c7c0cbf3457ce4f30eebb55dbad (plain)
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
#ifndef REG_EXP_H
#define REG_EXP_H

#include <string>
#include <stdint.h>
#include <regex.h>
#include <utility>
#include "staticstring.h"

class RegExp
{
public:
	RegExp();
	RegExp( const char *sSrc );
	virtual ~RegExp();

	void compile( const char *sSrc );
	int getNumSubStrings();
	bool execute( const char *sSrc );
	std::pair<int,int> getSubStringRange( int nIndex );
	std::string getSubString( int nIndex );
	const char *getSource()
	{
		return sSrc;
	}

private:
	StaticString sSrc;
	StaticString sTest;
	regex_t re;
	bool bCompiled;
	int nSubStr;
	regmatch_t *aSubStr;
};

#endif