summaryrefslogtreecommitdiff
path: root/utils/RegExp.h
blob: 85c9853ba5f0963ee0f9e436dfceb1058b0711b1 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 *	CENA C++ Utilities
 *
 *	by Stephane Chatty
 *
 *	Copyright 1991 - 1994
 *	Laboratoire de Recherche en Informatique (LRI)
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	Regular expressions
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef RegExp_H_
#define RegExp_H_

#ifdef __GNUG__
#pragma interface
#endif

#include "cplus_bugs.h"
#include "bool.h"

#ifdef __hpux /* POSIX */
#define REGCOMP
#else
#if !defined(sun) || !defined(__svr4__)
#define RE_COMP
#endif
#endif

#ifdef REGCOMP

/* POSIX version of regular expressions */

class CcuRegExp {
private:
	const char*	String;
	void*	Compiled;
public:
inline		CcuRegExp (const char* s) : String (s), Compiled (0)	{}
		~CcuRegExp ();
	bool	Compile ();
	bool	Match (const char*);
inline	const char*	GetExpr ()	{return String;}
};

#endif	/* REGCOMP */

#ifdef RE_COMP

class CcuRegExp {
private:
	const char*	String;
static	CcuRegExp*	Compiled;

public:
inline		CcuRegExp (const char* s) : String (s)	{}
inline		~CcuRegExp ()	{};
	bool	Compile ();
	bool	Match (const char*);
inline	const char*	GetExpr ()	{return String;}
};

#endif	/* RE_COMP */

#if !defined(REGCOMP) && !defined(RE_COMP)

class CcuRegExp {
private:
	const char*	String;
	char*	Compiled;

public:
inline		CcuRegExp (const char* s) : String (s), Compiled (0)	{}
		~CcuRegExp ();
	bool	Compile ();
	bool	Match (const char*);
inline	const char*	GetExpr ()	{ return String; }
};

#endif	/* !REGCOMP && !RE_COMP */

#endif	/* RegExp_H_ */