PLCnext API Documentation 25.0.2.69
Regex.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8
9#ifdef ARP_PLATFORM_WIN32
10 #include <regex>
11 #define ARP_COMMONS_REGEX_STL
12#elif defined ARP_PLATFORM_LINUX
13 #include <boost/regex.hpp>
14 #define ARP_COMMONS_REGEX_BOOST
15#else
16 #error "Platform is not supported"
17#endif
18
19
20namespace Arp
21{
22
23#ifdef ARP_COMMONS_REGEX_STL
24
25using std::regex;
26using std::smatch;
27using std::cmatch;
28using std::regex_match;
29using std::regex_search;
30using std::regex_replace;
31using std::regex_error;
32using std::match_results;
33using std::sregex_iterator;
34namespace regex_constants = std::regex_constants;
35// this is only required for boost regex impl, because boost uses int as argument type of index operator []
36inline size_t index_cast(size_t value)
37{
38 return value;
39}
40
41#elif defined ARP_COMMONS_REGEX_BOOST
42
43using boost::regex;
44using boost::smatch;
45using boost::cmatch;
46using boost::regex_match;
47using boost::regex_search;
48using boost::regex_replace;
49using boost::regex_error;
50using boost::match_results;
51using boost::sregex_iterator;
52namespace regex_constants = boost::regex_constants;
53// this is only required for boost regex impl, because boost uses int as argument type of index operator []
54inline int index_cast(size_t value)
55{
56 return static_cast<int>(value);
57}
58
59#else
60#error "Regex distribution not defined"
61#endif
62} // end of namespace Arp
Root namespace for the PLCnext API