|
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 /* |
|
7 * nsWildCard.h: Defines and prototypes for shell exp. match routines |
|
8 * |
|
9 * See nsIZipReader.findEntries docs in nsIZipReader.idl for a description of |
|
10 * the supported expression syntax. |
|
11 * |
|
12 * Note that the syntax documentation explicitly says the results of certain |
|
13 * expressions are undefined. This is intentional to require less robustness |
|
14 * in the code. Regular expression parsing is hard; the smaller the set of |
|
15 * features and interactions this code must support, the easier it is to |
|
16 * ensure it works. |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef nsWildCard_h__ |
|
21 #define nsWildCard_h__ |
|
22 |
|
23 #include "nscore.h" |
|
24 |
|
25 /* --------------------------- Public routines ---------------------------- */ |
|
26 |
|
27 |
|
28 /* |
|
29 * NS_WildCardValid takes a shell expression exp as input. It returns: |
|
30 * |
|
31 * NON_SXP if exp is a standard string |
|
32 * INVALID_SXP if exp is a shell expression, but invalid |
|
33 * VALID_SXP if exp is a valid shell expression |
|
34 */ |
|
35 |
|
36 #define NON_SXP -1 |
|
37 #define INVALID_SXP -2 |
|
38 #define VALID_SXP 1 |
|
39 |
|
40 int NS_WildCardValid(const char *expr); |
|
41 |
|
42 int NS_WildCardValid(const char16_t *expr); |
|
43 |
|
44 /* return values for the search routines */ |
|
45 #define MATCH 0 |
|
46 #define NOMATCH 1 |
|
47 #define ABORTED -1 |
|
48 |
|
49 /* |
|
50 * NS_WildCardMatch |
|
51 * |
|
52 * Takes a prevalidated shell expression exp, and a string str. |
|
53 * |
|
54 * Returns 0 on match and 1 on non-match. |
|
55 */ |
|
56 |
|
57 int NS_WildCardMatch(const char *str, const char *expr, |
|
58 bool case_insensitive); |
|
59 |
|
60 int NS_WildCardMatch(const char16_t *str, const char16_t *expr, |
|
61 bool case_insensitive); |
|
62 |
|
63 #endif /* nsWildCard_h__ */ |