michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * nsWildCard.h: Defines and prototypes for shell exp. match routines michael@0: * michael@0: * See nsIZipReader.findEntries docs in nsIZipReader.idl for a description of michael@0: * the supported expression syntax. michael@0: * michael@0: * Note that the syntax documentation explicitly says the results of certain michael@0: * expressions are undefined. This is intentional to require less robustness michael@0: * in the code. Regular expression parsing is hard; the smaller the set of michael@0: * features and interactions this code must support, the easier it is to michael@0: * ensure it works. michael@0: * michael@0: */ michael@0: michael@0: #ifndef nsWildCard_h__ michael@0: #define nsWildCard_h__ michael@0: michael@0: #include "nscore.h" michael@0: michael@0: /* --------------------------- Public routines ---------------------------- */ michael@0: michael@0: michael@0: /* michael@0: * NS_WildCardValid takes a shell expression exp as input. It returns: michael@0: * michael@0: * NON_SXP if exp is a standard string michael@0: * INVALID_SXP if exp is a shell expression, but invalid michael@0: * VALID_SXP if exp is a valid shell expression michael@0: */ michael@0: michael@0: #define NON_SXP -1 michael@0: #define INVALID_SXP -2 michael@0: #define VALID_SXP 1 michael@0: michael@0: int NS_WildCardValid(const char *expr); michael@0: michael@0: int NS_WildCardValid(const char16_t *expr); michael@0: michael@0: /* return values for the search routines */ michael@0: #define MATCH 0 michael@0: #define NOMATCH 1 michael@0: #define ABORTED -1 michael@0: michael@0: /* michael@0: * NS_WildCardMatch michael@0: * michael@0: * Takes a prevalidated shell expression exp, and a string str. michael@0: * michael@0: * Returns 0 on match and 1 on non-match. michael@0: */ michael@0: michael@0: int NS_WildCardMatch(const char *str, const char *expr, michael@0: bool case_insensitive); michael@0: michael@0: int NS_WildCardMatch(const char16_t *str, const char16_t *expr, michael@0: bool case_insensitive); michael@0: michael@0: #endif /* nsWildCard_h__ */