PCRE2 C++ Wrapper 1.3.0
pcre2cpp
Loading...
Searching...
No Matches
config.hpp
1/*
2 * pcre2cpp - PCRE2 cpp wrapper
3 *
4 * Licensed under the BSD 3-Clause License with Attribution Requirement.
5 * See the LICENSE file for details: https://github.com/MAIPA01/pcre2cpp/blob/main/LICENSE
6 *
7 * Copyright (c) 2025, Patryk Antosik (MAIPA01)
8 *
9 * PCRE2 library included in this project:
10 * Copyright (c) 2016-2024, University of Cambridge.
11 *
12 * See the LICENSE_PCRE2 file for details: https://github.com/MAIPA01/pcre2cpp/blob/main/LICENSE_PCRE2
13 */
14
15#pragma once
16#ifndef _PCRE2CPP_CONFIG_HPP_
17 #define _PCRE2CPP_CONFIG_HPP_
18
19/**
20 * @defgroup pcre2cpp PCRE2 C++
21 * @brief Main group
22 */
23
24/**
25 * @defgroup utils Utilities
26 * @brief group with utilities (not for end user to use)
27 * @ingroup pcre2cpp
28 */
29
30/**
31 * @namespace pcre2cpp
32 * @brief Main namespace of pcre2cpp library
33 */
34
35/**
36 * @namespace pcre2cpp::uitls
37 * @brief Utility namespace of pcre2cpp library
38 */
39
40 #pragma region VERSION
41 /**
42 * @brief pcre2cpp version major number
43 * @ingroup pcre2cpp
44 */
45 #define PCRE2CPP_VERSION_MAJOR 1
46 /**
47 * @brief pcre2cpp version minor number
48 * @ingroup pcre2cpp
49 */
50 #define PCRE2CPP_VERSION_MINOR 3
51 /**
52 * @brief pcre2cpp version patch number
53 * @ingroup pcre2cpp
54 */
55 #define PCRE2CPP_VERSION_PATCH 0
56
57 /**
58 * @brief stringify helper
59 * @ingroup utils
60 */
61 #define _PCRE2CPP_STRINGIFY_HELPER(x) #x
62
63 /**
64 * @brief converts version numbers to string
65 * @ingroup utils
66 */
67 #define _PCRE2CPP_VERSION_TO_STRING(major, minor, patch)
69 /**
70 * @brief converts version number to int
71 * @ingroup utils
72 */
73 #define _PCRE2CPP_VERSION_TO_INT(major, minor, patch) (major * 100 + minor * 10 + patch)
74
75 /**
76 * @brief pcre2cpp version string
77 * @ingroup pcre2cpp
78 */
81 /**
82 * @brief pcre2cpp version int
83 * @ingroup pcre2cpp
84 */
86 /**
87 * @brief pcre2cpp version string
88 * @ingroup pcre2cpp
89 */
90 #define PCRE2CPP_VERSION PCRE2CPP_VERSION_STRING
91 #pragma endregion
92
93 #pragma region LAST_UPDATE
94 /**
95 * @brief pcre2cpp last update day
96 * @ingroup pcre2cpp
97 */
98 #define PCRE2CPP_LAST_UPDATE_DAY 19
99 /**
100 * @brief pcre2cpp last update month
101 * @ingroup pcre2cpp
102 */
103 #define PCRE2CPP_LAST_UPDATE_MONTH 05
104 /**
105 * @brief pcre2cpp last update year
106 * @ingroup pcre2cpp
107 */
108 #define PCRE2CPP_LAST_UPDATE_YEAR 2026
109
110 /**
111 * @brief converts last update date to string
112 * @ingroup utils
113 */
114 #define _PCRE2CPP_LAST_UPDATE_DATE_HELPER(day, month, year)
116
117 /**
118 * @brief pcre2cpp last update date string
119 * @ingroup pcre2cpp
120 */
123 #pragma endregion
124
125 #pragma region CXX_VERSIONS
126/**
127 * @def _PCRE2CPP_HAS_CXX17
128 * @brief check if compiler has c++ version greater or equal to c++17
129 * @ingroup utils
130 */
131 #ifndef _HAS_CXX17
132 // clang-format off
133 #define _PCRE2CPP_HAS_CXX17 __cplusplus >= 201703l
134 // clang-format on
135 #else
136 #define _PCRE2CPP_HAS_CXX17 _HAS_CXX17
137 #endif
138
139 /**
140 * @def _PCRE2CPP_HAS_CXX20
141 * @brief check if compiler has c++ version greater or equal to c++20 and if user enabled c++20 features using PCRE2CPP_ENABLE_CXX20
142 * @ingroup utils
143 */
144 #ifndef PCRE2CPP_ENABLE_CXX20
145 #define _PCRE2CPP_HAS_CXX20 0
146 #elif !defined(_HAS_CXX20)
147 // clang-format off
148 #define _PCRE2CPP_HAS_CXX20 __cplusplus >= 202002l
149 // clang-format on
150 #else
151 #define _PCRE2CPP_HAS_CXX20 _HAS_CXX20
152 #endif
153 #pragma endregion
154
155/**
156 * @def _PCRE2CPP_HAS_EXCEPTIONS
157 * @brief check if exceptions are enabled
158 * @ingroup utils
159 */
160
161/**
162 * @def _PCRE2CPP_HAS_ASSERTS
163 * @brief check if asserts are enabled
164 * @ingroup utils
165 */
166
167 #ifdef PCRE2CPP_CHANGE_ASSERTS_TO_EXCEPTIONS
168 #define _PCRE2CPP_HAS_EXCEPTIONS _PCRE2CPP_HAS_CXX17
169 #define _PCRE2CPP_HAS_ASSERTS 0
170 #else
171 #define _PCRE2CPP_HAS_EXCEPTIONS 0
172 #define _PCRE2CPP_HAS_ASSERTS _PCRE2CPP_HAS_CXX17
173 #endif
174
176 #define _PCRE2CPP_NOEXCEPT
177 #else
178 #define _PCRE2CPP_NOEXCEPT noexcept
179 #endif
180
181 #pragma region UTFS_ENABLED
182/**
183 * @def _PCRE2CPP_HAS_UTF8
184 * @brief check if support for UTF-8 is enabled
185 * @ingroup utils
186 */
187
188/**
189 * @def _PCRE2CPP_HAS_UTF16
190 * @brief check if support for UTF-16 is enabled
191 * @ingroup utils
192 */
193
194/**
195 * @def _PCRE2CPP_HAS_UTF32
196 * @brief check if support for UTF-32 is enabled
197 * @ingroup utils
198 */
199
200 #ifdef PCRE2CPP_DISABLE_UTF8
201 #define _PCRE2CPP_HAS_UTF8 0
202 #else
203 #define _PCRE2CPP_HAS_UTF8 1
204 #endif
205
206 #ifdef PCRE2CPP_DISABLE_UTF16
207 #define _PCRE2CPP_HAS_UTF16 0
208 #else
209 #define _PCRE2CPP_HAS_UTF16 1
210 #endif
211
212 #ifdef PCRE2CPP_DISABLE_UTF32
213 #define _PCRE2CPP_HAS_UTF32 0
214 #else
215 #define _PCRE2CPP_HAS_UTF32 1
216 #endif
217
219 #define PCRE2_CODE_UNIT_WIDTH 8
221 #define PCRE2_CODE_UNIT_WIDTH 16
223 #define PCRE2_CODE_UNIT_WIDTH 32
224 #else
225 #define PCRE2_CODE_UNIT_WIDTH 0
226 #endif
227 #pragma endregion
228
229 #pragma region VERSION_SPECIFIC_VALUES
230/**
231 * @def _PCRE2CPP_CONSTEXPR17
232 * @brief constexpr for c++17 and higher
233 * @ingroup utils
234 */
236 #define _PCRE2CPP_CONSTEXPR17 constexpr
237 #else
238 #define _PCRE2CPP_CONSTEXPR17
239 #endif
240
241/**
242 * @def _PCRE2CPP_CONSTEXPR20
243 * @brief constexpr keyword for c++20 and higher
244 * @ingroup utils
245 */
246
247/**
248 * @def _PCRE2CPP_REQUIRES(condition)
249 * @brief requires keyword for c++20 and higher
250 * @ingroup utils
251 */
253 #define _PCRE2CPP_CONSTEXPR20 constexpr
254 #define _PCRE2CPP_REQUIRES(condition) requires (condition)
255 #else
256 #define _PCRE2CPP_CONSTEXPR20
257 #define _PCRE2CPP_REQUIRES(condition)
258 #endif
259 #pragma endregion
260
261/**
262 * @def _PCRE2CPP_PCRE2_FUNC_CONSTEXPR17
263 * @brief adds constexpr to pcre2 function pointers only if pcre2 is static library
264 * @ingroup utils
265 */
266
267 #ifdef PCRE2CPP_SHARED_LIBS
268 #define _PCRE2CPP_PCRE2_FUNC_CONSTEXPR17 inline const
269 #else
270 #define _PCRE2CPP_PCRE2_FUNC_CONSTEXPR17 constexpr
271 #endif
272
273 #include <mstd/mstd.hpp>
274
275 /**
276 * @brief compiler message
277 * @ingroup utils
278 */
279 #define _PCRE2CPP_MESSAGE(MESSAGE) _MSTD_MESSAGE(MESSAGE)
280 /**
281 * @brief compiler warning
282 * @ingroup utils
283 */
284 #define _PCRE2CPP_WARNING(MESSAGE) _MSTD_WARNING(MESSAGE)
285 /**
286 * @brief compiler error
287 * @ingroup utils
288 */
289 #define _PCRE2CPP_ERROR(MESSAGE) _MSTD_ERROR(MESSAGE)
290#endif
#define PCRE2CPP_VERSION_PATCH
pcre2cpp version patch number
Definition config.hpp:55
#define PCRE2CPP_LAST_UPDATE_MONTH
pcre2cpp last update month
Definition config.hpp:103
#define PCRE2CPP_LAST_UPDATE_YEAR
pcre2cpp last update year
Definition config.hpp:108
#define PCRE2CPP_VERSION_STRING
pcre2cpp version string
Definition config.hpp:79
#define PCRE2CPP_VERSION_MAJOR
pcre2cpp version major number
Definition config.hpp:45
#define PCRE2CPP_VERSION_MINOR
pcre2cpp version minor number
Definition config.hpp:50
#define PCRE2CPP_LAST_UPDATE_DAY
pcre2cpp last update day
Definition config.hpp:98
#define _PCRE2CPP_LAST_UPDATE_DATE_HELPER(day, month, year)
converts last update date to string
Definition config.hpp:114
#define _PCRE2CPP_STRINGIFY_HELPER(x)
stringify helper
Definition config.hpp:61
#define _PCRE2CPP_HAS_UTF32
check if support for UTF-32 is enabled
Definition config.hpp:215
#define _PCRE2CPP_VERSION_TO_INT(major, minor, patch)
converts version number to int
Definition config.hpp:73
#define _PCRE2CPP_HAS_CXX17
check if compiler has c++ version greater or equal to c++17
Definition config.hpp:133
#define _PCRE2CPP_HAS_UTF8
check if support for UTF-8 is enabled
Definition config.hpp:203
#define _PCRE2CPP_HAS_UTF16
check if support for UTF-16 is enabled
Definition config.hpp:209
#define _PCRE2CPP_VERSION_TO_STRING(major, minor, patch)
converts version numbers to string
Definition config.hpp:67
#define _PCRE2CPP_HAS_CXX20
check if compiler has c++ version greater or equal to c++20 and if user enabled c++20 features using ...
Definition config.hpp:145
#define _PCRE2CPP_HAS_EXCEPTIONS
check if exceptions are enabled
Definition config.hpp:171