summaryrefslogtreecommitdiff
path: root/utils/RegExp.h
blob: ac1321ddd4954c0e2d2e03549d6665f6b1d6372e (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
/*
 *	CENA C++ Utilities
 *
 *	by Stephane Chatty
 *
 *	Copyright 1991 - 1996
 *	Laboratoire de Recherche en Informatique (LRI)
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	Regular expressions
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef RegExp_H_
#define RegExp_H_

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

#if defined(__hpux)  || (defined (sun) && defined (__svr4__))	/* POSIX */
#define REGCOMP
#else
#if 1	/* I'm not aware of systems that use regcmp anymore */
#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_ */