ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/utils/wildcards.hpp
Revision: 2204
Committed: Fri Apr 15 22:04:00 2005 UTC (19 years, 2 months ago) by gezelter
File size: 1469 byte(s)
Log Message:
xemacs has been drafted to perform our indentation services

File Contents

# Content
1 #ifndef WILDCARD_H_INCLUDED
2 #define WILDCARD_H_INCLUDED
3
4 // Copyright (C) 1996 - 2002 Florian Schintke
5 //
6 // This is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation; either version 2, or (at your option) any later
9 // version.
10 //
11 // Thanks to the E.S.O. - ACS project that has done this C++ interface
12 // to the wildcards pttern matching algorithm
13
14 //#ifndef __cplusplus
15 //#error This is a C++ include file and cannot be used from plain C
16 //#endif
17
18 // Implementation of the UN*X wildcards
19 // Supported wild-characters: '*', '?'; sets: [a-z], '!' negation
20 // Examples:
21 // '[a-g]l*i?n' matches 'florian'
22 // '[!abc]*e' matches 'smile'
23 // '[-z] matches 'a'
24
25 class Wildcard
26 {
27 public:
28 // This function implements the UN*X wildcards and returns:
29 // 0 - if *wildcard does not match *test
30 // 1 - if *wildcard matches *test
31 static int wildcardfit (const char *wildcard, const char *test);
32
33 private:
34 // Scans a set of characters and returns 0 if the set mismatches at this
35 // position in the teststring and 1 if it is matching
36 // wildcard is set to the closing ] and test is unmodified if mismatched
37 // and otherwise the char pointer is pointing to the next character
38 static int set (const char **wildcard, const char **test);
39
40 // Scans an asterisk
41 static int asterisk (const char **wildcard, const char **test);
42 };
43
44 #endif