windows-nt/Source/XPSP1/NT/admin/wmi/wbem/common/wmiutils/like.h
2020-09-26 16:20:57 +08:00

45 lines
1.2 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//***************************************************************************
//
// (c) 2000 by Microsoft Corp. All Rights Reserved.
//
// like.h
//
// a-davcoo 28-Feb-00 Implements the SQL like operation.
//
//***************************************************************************
#ifndef _LIKE_H_
#define _LIKE_H_
#include <string.h>
// The CLike class implements the SQL "like" operation. To compare test strings
// to an expression, construct an instance of the CLike class using the expression
// and an optional escape character. Then use the Match() method on that instance
// to test each string. Note, this class makes it's own copy of the expression
// used to construct it. This implementation supports the '%' and '_' wildard
// characters as well as the [] and [^] constructs for matching sets of characters
// and ranges of characters.
class CLike
{
public:
CLike (LPCWSTR expression, WCHAR escape='\0');
~CLike (void);
bool Match (LPCWSTR string);
protected:
LPWSTR m_expression;
WCHAR m_escape;
// Recursive function and helpers for performing like operation.
bool DoLike (LPCWSTR pattern, LPCWSTR string, WCHAR escape);
bool MatchSet (LPCWSTR pattern, LPCWSTR string, int &skip);
};
#endif // _LIKE_H_