-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
417 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "PatternMatch.h" | ||
#include <tchar.h> | ||
|
||
BOOL patternMatch(LPCTSTR text, LPCTSTR pattern) | ||
{ | ||
LPCTSTR nextPattern, match; | ||
TCHAR subPattern[MAX_PATH]; | ||
|
||
while (TRUE) | ||
{ | ||
while (*pattern == ' ') | ||
{ | ||
pattern++; | ||
} | ||
if (*pattern == 0) | ||
{ | ||
return TRUE; | ||
} | ||
nextPattern = _tcschr(pattern, ' '); | ||
if (!nextPattern) | ||
{ | ||
nextPattern = pattern + _tcslen(pattern); | ||
} | ||
_tcsncpy(subPattern, pattern, nextPattern - pattern); | ||
subPattern[nextPattern - pattern] = 0; | ||
match = _tcsstr(text, subPattern); | ||
if (!match) | ||
{ | ||
return FALSE; | ||
} | ||
text = match + (nextPattern - pattern); | ||
pattern = nextPattern; | ||
} | ||
|
||
return TRUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef PATTERN_MATCH_H | ||
#define PATTERN_MATCH_H | ||
|
||
#include <windows.h> | ||
|
||
BOOL patternMatch(LPCTSTR text, LPCTSTR pattern); | ||
|
||
#endif // PATTERN_MATCH_H |
Oops, something went wrong.