Move helper function out of QueryParser.h
They live in the new QueryParserUtils.{h,cpp} now.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Axel Dörfler, [email protected].
|
||||
* Copyright 2010, Clemens Zeidler <[email protected]>
|
||||
* Copyright 2011, Ingo Weinhold, [email protected].
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FILE_SYSTEMS_QUERY_PARSER_UTILS_H
|
||||
#define _FILE_SYSTEMS_QUERY_PARSER_UTILS_H
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
namespace QueryParser {
|
||||
|
||||
|
||||
enum match {
|
||||
NO_MATCH = 0,
|
||||
MATCH_OK = 1,
|
||||
|
||||
MATCH_BAD_PATTERN = -2,
|
||||
MATCH_INVALID_CHARACTER
|
||||
};
|
||||
|
||||
// return values from isValidPattern()
|
||||
enum {
|
||||
PATTERN_INVALID_ESCAPE = -3,
|
||||
PATTERN_INVALID_RANGE,
|
||||
PATTERN_INVALID_SET
|
||||
};
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
void skipWhitespace(char** expr, int32 skip = 0);
|
||||
void skipWhitespaceReverse(char** expr, char* stop);
|
||||
int compareKeys(uint32 type, const void* key1, size_t length1,
|
||||
const void* key2, size_t length2);
|
||||
uint32 utf8ToUnicode(char** string);
|
||||
int32 getFirstPatternSymbol(char* string);
|
||||
status_t isValidPattern(char* pattern);
|
||||
status_t matchString(char* pattern, char* string);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
static inline bool
|
||||
isPattern(char* string)
|
||||
{
|
||||
return getFirstPatternSymbol(string) >= 0 ? true : false;
|
||||
}
|
||||
|
||||
|
||||
} // namespace QueryParser
|
||||
|
||||
|
||||
#endif // _FILE_SYSTEMS_QUERY_PARSER_UTILS_H
|
||||
Reference in New Issue
Block a user