@@ -17,39 +17,29 @@ Author(s):
17
17
18
18
#include " ProfileCollectionEntry.h"
19
19
#include " MatchProfilesEntry.g.h"
20
+ #include " ..\buffer\out\UTextAdapter.h"
20
21
21
22
// This macro defines the getter and setter for a regex property.
22
23
// The setter tries to instantiate the regex immediately and caches
23
24
// it if successful. If it fails, it sets a boolean flag to track that
24
25
// it failed.
25
- #define MATCH_PROFILE_REGEX_PROPERTY (name ) \
26
- public: \
27
- hstring name () const noexcept \
28
- { \
29
- return _##name; \
30
- } \
31
- void name (const hstring& value) noexcept \
32
- { \
33
- _##name = value; \
34
- _validate##name (); \
35
- } \
36
- \
37
- private: \
38
- void _validate##name() noexcept \
39
- { \
40
- _invalid##name = false ; \
41
- try \
42
- { \
43
- _##name##Regex = { _##name.cbegin (), _##name.cend () }; \
44
- } \
45
- catch (std::regex_error) \
46
- { \
47
- _invalid##name = true ; \
48
- } \
49
- } \
50
- \
51
- hstring _##name; \
52
- std::wregex _##name##Regex; \
26
+ #define DEFINE_MATCH_PROFILE_REGEX_PROPERTY (name ) \
27
+ public: \
28
+ hstring name () const noexcept \
29
+ { \
30
+ return _##name; \
31
+ } \
32
+ void name (const hstring& value) noexcept \
33
+ { \
34
+ _##name = value; \
35
+ _validate##name (); \
36
+ } \
37
+ \
38
+ private: \
39
+ void _validate##name() noexcept ; \
40
+ \
41
+ hstring _##name; \
42
+ ::Microsoft::Console::ICU::unique_uregex _##name##Regex; \
53
43
bool _invalid##name{ false };
54
44
55
45
namespace winrt ::Microsoft::Terminal::Settings::Model::implementation
@@ -67,9 +57,9 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
67
57
bool ValidateRegexes () const ;
68
58
bool MatchesProfile (const Model::Profile& profile);
69
59
70
- MATCH_PROFILE_REGEX_PROPERTY (Name);
71
- MATCH_PROFILE_REGEX_PROPERTY (Commandline);
72
- MATCH_PROFILE_REGEX_PROPERTY (Source);
60
+ DEFINE_MATCH_PROFILE_REGEX_PROPERTY (Name)
61
+ DEFINE_MATCH_PROFILE_REGEX_PROPERTY (Commandline)
62
+ DEFINE_MATCH_PROFILE_REGEX_PROPERTY (Source)
73
63
};
74
64
}
75
65
0 commit comments