Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
regexpr.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19// regexpr.h
20
21#if defined(_MSC_VER)
22#pragma once
23#endif
24
25#ifndef REGEXPR_H
26#define REGEXPR_H
27
28
29/*
30** RegularExpressionClass - This class encapsulates regular expression
31** evaluation. It provides a nice and simple wrapper around the
32** unfriendliness that is the GNU regex library. So try not to use
33** gnu_regex.h anywhere, cause it'll make your code rather gross looking.
34**
35** 10/12/2000 AJA - Initial Implementation
36**
37** 01/02/2001 AJA - Added a quick regular expression tutorial to the project.
38** You can find it in your wwlib directory in a file named
39** "Regular Expression Tutorial.html". This file comes from the web at
40** http://www.living-source.com/user/matte/regexp/regexp_tutorial.html
41*/
43{
44public:
45 RegularExpressionClass (const char *expression=0);
48
49 // Before you try to match a string against this regular expression,
50 // you must first compile the expression. This has the logical effect
51 // of assigning the regular expression string to this
52 // RegularExpressionClass object.
53 // If you passed the expression into the constructor of this object,
54 // Compile() was called for you. To ensure the compilation in the
55 // constructor succeeded, check the return value of Is_Valid().
56 // Compile() returns true if the compilation succeeded (ie. the given
57 // expression string formed a valid regular expression).
58 bool Compile (const char *expression);
59
60 // Returns true if a valid regular expression has been assigned to
61 // this object. If you passed a regular expression string into this
62 // object's constructor, make sure you check Is_Valid before calling
63 // Match().
64 bool Is_Valid (void) const;
65
66 // Tests if 'string' matches this regular expression.
67 bool Match (const char *string) const;
68
69 // Standard operators.
71 bool operator == (const RegularExpressionClass &rhs) const;
72 bool operator != (const RegularExpressionClass &rhs) const;
73
74private:
75
76 struct DataStruct;
77 DataStruct *Data;
78};
79
80
81#endif
82
RegularExpressionClass(const char *expression=0)
Definition regexpr.cpp:100
bool Match(const char *string) const
Definition regexpr.cpp:174
bool operator==(const RegularExpressionClass &rhs) const
Definition regexpr.cpp:223
RegularExpressionClass & operator=(const RegularExpressionClass &rhs)
Definition regexpr.cpp:207
bool operator!=(const RegularExpressionClass &rhs) const
Definition regexpr.cpp:245
bool Compile(const char *expression)
Definition regexpr.cpp:136
bool Is_Valid(void) const
Definition regexpr.cpp:167