1 using System;
 2 using System.Collections;
 3 
 4 // this file has been semiautomatically generated from 'D:/work/soulng-project/soulng/rex/Match.hpp' using cpp2cm version 1.0.0
 5 
 6 // this file has been semiautomatically generated from 'D:/work/soulng-project/soulng/rex/Match.cpp' using cpp2cm version 1.0.0
 7 
 8 namespace System.RegularExpressions
 9 {
10     public ustring MakeRegularExpressionPatternFromFilePattern(const ustring& filePattern)
11     {
12         ustring pattern;
13         for (uchar c : filePattern)
14         {
15             switch (c)
16             {
17                 case '.': pattern.Append(u"\\.");
18                 break;
19                 case '*': pattern.Append(u".*");
20                 break;
21                 case '?': pattern.Append(u".");
22                 break;
23                 default: pattern.Append(c1);
24                 break;
25             }
26         }
27         return pattern;
28     }
29     public bool FilePatternMatch(const ustring& filePathconst ustring& filePattern)
30     {
31         return PatternMatch(filePathMakeRegularExpressionPatternFromFilePattern(filePattern));
32     }
33     public bool PatternMatch(const ustring& strconst ustring& regularExpressionPattern)
34     {
35         Context context;
36         Nfa nfa = CompileRegularExpressionPattern(contextregularExpressionPattern);
37         bool match = PatternMatch(strnfa);
38         return match;
39     }
40     public Nfa CompileRegularExpressionPattern(Context& contextconst ustring& regularExpressionPattern)
41     {
42         RexLexer lexer(regularExpressionPattern""0);
43         return ParseRegularExpressionPattern(lexercontext);
44     }
45     public Nfa CompileFilePattern(Context& contextconst ustring& filePattern)
46     {
47         return CompileRegularExpressionPattern(contextMakeRegularExpressionPatternFromFilePattern(filePattern));
48     }
49     public bool PatternMatch(const ustring& strNfa& nfa)
50     {
51         return Match(nfastr);
52     }
53 } // namespace System.RegularExpressions