@@ -46,8 +46,10 @@ namespace ptree = boost::property_tree;
46
46
47
47
#ifdef PULSAR_USE_BOOST_REGEX
48
48
#include < boost/regex.hpp>
49
+ #define PULSAR_REGEX_NAMESPACE boost
49
50
#else
50
51
#include < regex>
52
+ #define PULSAR_REGEX_NAMESPACE std
51
53
#endif
52
54
53
55
DECLARE_LOG_OBJECT ()
@@ -365,27 +367,15 @@ const std::string ZTSClient::getHeader() const { return roleHeader_; }
365
367
PrivateKeyUri ZTSClient::parseUri (const char *uri) {
366
368
PrivateKeyUri uriSt;
367
369
// scheme mediatype[;base64] path file
368
-
369
- #ifdef PULSAR_USE_BOOST_REGEX
370
- static const boost::regex expression (
371
- " ^(\? :([^:/\? #]+):)(\? :([;/\\ -\\ w]*),)\? (/\? (\? :[^\? #/]*/)*)\? ([^\? #]*)" );
372
- boost::cmatch groups;
373
- if (boost::regex_match (uri, groups, expression)) {
374
- uriSt.scheme = groups.str (1 );
375
- uriSt.mediaTypeAndEncodingType = groups.str (2 );
376
- uriSt.data = groups.str (4 );
377
- }
378
- #else // !PULSAR_USE_BOOST_REGEX
379
- static const std::regex expression (
380
- R"( ^(?:([A-Za-z]+):)(?:([/\w\-]+;\w+),([=\w]+))?(?:\/\/)?(\/[^?#]+)?)" );
381
- std::cmatch groups;
382
- if (std::regex_match (uri, groups, expression)) {
370
+ static const PULSAR_REGEX_NAMESPACE::regex expression (
371
+ R"( ^(?:([A-Za-z]+):)(?:([/\w\-]+;\w+),([=\w]+))?(?:\/\/)?([^?#]+)?)" );
372
+ PULSAR_REGEX_NAMESPACE::cmatch groups;
373
+ if (PULSAR_REGEX_NAMESPACE::regex_match (uri, groups, expression)) {
383
374
uriSt.scheme = groups.str (1 );
384
375
uriSt.mediaTypeAndEncodingType = groups.str (2 );
385
376
uriSt.data = groups.str (3 );
386
377
uriSt.path = groups.str (4 );
387
378
}
388
- #endif // PULSAR_USE_BOOST_REGEX
389
379
return uriSt;
390
380
}
391
381
} // namespace pulsar
0 commit comments