Skip to content

Commit ffe7815

Browse files
authored
readme examples fixed (#5)
- added examples folder with examples projects - updated examples in readme - updated docs - updated mstd version
1 parent d4daa57 commit ffe7815

85 files changed

Lines changed: 279 additions & 101 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
cmake_minimum_required(VERSION 3.30)
2-
project(pcre2cpp VERSION 1.2.7 LANGUAGES CXX)
2+
project(pcre2cpp VERSION 1.2.8 LANGUAGES CXX)
33

44
option(BUILD_SHARED_LIBS "Build shared library" OFF)
55
option(PCRE2CPP_BUILD_TESTS "Build tests" ${PROJECT_IS_TOP_LEVEL})
66
option(PCRE2CPP_BUILD_BENCHMARK "Build benchmark" ${PROJECT_IS_TOP_LEVEL})
77
option(PCRE2CPP_BUILD_COVERAGE "Enable coverage reporting" ${PROJECT_IS_TOP_LEVEL})
88
option(PCRE2CPP_BUILD_DOCUMENTATION "Build documentation" ${PROJECT_IS_TOP_LEVEL})
9+
option(PCRE2CPP_BUILD_EXAMPLES "Build examples" ${PROJECT_IS_TOP_LEVEL})
910

1011
option(PCRE2CPP_ENABLE_CLANG_TIDY "Enables clang-tidy checks" ${PROJECT_IS_TOP_LEVEL})
1112

1213
option(PCRE2CPP_INSTALL "Enables installation of this project" ${PROJECT_IS_TOP_LEVEL})
1314
option(PCRE2CPP_INSTALL_TEST "This is only to test if installation of pcre2cpp works" OFF)
1415

15-
option(PCRE2CPP_MSTD_EXTERNAL "Uses users own mstd library (tested and compatible with: 1.5.3)" OFF)
16+
option(PCRE2CPP_MSTD_EXTERNAL "Uses users own mstd library (tested and compatible with: 1.5.4)" OFF)
1617
option(PCRE2CPP_PCRE2_EXTERNAL "Uses users own pcre2 library (tested and compatible with: 10.47)" OFF)
1718

1819
option(PCRE2CPP_ENABLE_CXX20 "Enables C++20 features" OFF)
@@ -57,6 +58,10 @@ if (PCRE2CPP_BUILD_COVERAGE OR PCRE2CPP_BUILD_BENCHMARK)
5758
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark)
5859
endif()
5960

61+
if (PCRE2CPP_BUILD_EXAMPLES)
62+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/examples)
63+
endif()
64+
6065
if (PCRE2CPP_BUILD_COVERAGE)
6166
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/coverage_report.cmake)
6267

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "PCRE2 C++ Wrapper"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 1.2.7
51+
PROJECT_NUMBER = 1.2.8
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewers a

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ If you want to use external libraries not installed by project using CPM
3939

4040
| Cmake option Name | Description | Default |
4141
|:--------------------------|:-----------------------------------------------------------------|:-------:|
42-
| `PCRE2CPP_MSTD_EXTERNAL` | Uses users own mstd library (tested and compatible with: 1.5.3) | OFF |
42+
| `PCRE2CPP_MSTD_EXTERNAL` | Uses users own mstd library (tested and compatible with: 1.5.4) | OFF |
4343
| `PCRE2CPP_PCRE2_EXTERNAL` | Uses users own pcre2 library (tested and compatible with: 10.47) | OFF |
4444

4545
### Project developing options
@@ -52,6 +52,7 @@ These options are used while testing or changing code in project
5252
| `PCRE2CPP_BUILD_BENCHMARK` | Build benchmark | `${PROJECT_IS_TOP_LEVEL}` |
5353
| `PCRE2CPP_BUILD_COVERAGE` | Enable coverage reporting | `${PROJECT_IS_TOP_LEVEL}` |
5454
| `PCRE2CPP_BUILD_DOCUMENTATION` | Build documentation | `${PROJECT_IS_TOP_LEVEL}` |
55+
| `PCRE2CPP_BUILD_EXAMPLES` | Build examples | `${PROJECT_IS_TOP_LEVEL}` |
5556
| `PCRE2CPP_ENABLE_CLANG_TIDY` | Enables clang-tidy checks | `${PROJECT_IS_TOP_LEVEL}` |
5657
| `PCRE2CPP_INSTALL` | Enables installation of this project | `${PROJECT_IS_TOP_LEVEL}` |
5758
| `PCRE2CPP_INSTALL_TEST` | This is only to test if installation of pcre2cpp works | OFF |
@@ -206,11 +207,11 @@ using namespace pcre2cpp;
206207
int main() {
207208
regex expression("\\d+");
208209

209-
if (expression.match_at("aa2", 3, 2)) { // is true
210+
if (expression.match_at("aa2", 2)) { // is true
210211
cout << "Matches result: 2 at: 2" << endl;
211212
}
212213

213-
if (expression.match_at("aa2", 3, 1)) { // is false
214+
if (expression.match_at("aa2", 1)) { // is false
214215
cout << "Matches result: 2 at: 2" << endl;
215216
}
216217

@@ -231,7 +232,7 @@ int main() {
231232
regex expression("\\d+");
232233

233234
match_result result;
234-
if (expression.match_at("aa2", 3, result, 2)) { // is true
235+
if (expression.match_at("aa2", result, 2)) { // is true
235236
cout << "Matches result: " << result.get_result_value() << " at: "
236237
<< to_string(result.get_result_global_offset()) << endl;
237238

@@ -284,7 +285,7 @@ int main() {
284285
if (expression.match("ab23a", result, 1)) { // is true
285286
cout << "Sub Match <number> result: " << result.get_sub_result_value("number")
286287
<< " at: " << result.get_sub_result_global_offset("number")
287-
<< ", Sub Match 1 result: " << result.get_sub_result_value("a")
288+
<< ", Sub Match <a> result: " << result.get_sub_result_value("a")
288289
<< " at: " << result.get_sub_result_global_offset("a") << endl;
289290

290291
// Should print: "Sub Match <number> result: 23 at: 2, Sub Match <a> result: a at: 4"
@@ -307,27 +308,14 @@ int main() {
307308
regex expression("\\d+");
308309

309310
std::vector<match_result> results;
310-
if (expression.match_all("Ala ma 23 lata i 3 koty", 23, results)) { // is true
311+
if (expression.match_all("Ala ma 23 lata i 3 koty", results)) { // is true
311312
cout << "Match 0 result: " << results[0].get_result_value()
312313
<< " at: " << results[0].get_result_global_offset()
313314
<< ", Match 1 result: " << results[1].get_result_value()
314315
<< " at: " << results[1].get_result_global_offset() << endl;
315316

316317
// Should print: "Match 0 result: 23 at: 7, Match 1 result: 3 at: 17"
317318
}
318-
319-
match_result* resultsPtr;
320-
size_t resultsCount;
321-
if (expression.match_all("Ala ma 23 lata i 3 koty", 23, resultsPtr, resultsCount)) { // is true
322-
cout << "Match 0 result: " << resultsPtr[0].get_result_value()
323-
<< " at: " << resultsPtr[0].get_result_global_offset()
324-
<< ", Match 1 result: " << resultsPtr[1].get_result_value()
325-
<< " at: " << resultsPtr[1].get_result_global_offset() << endl;
326-
327-
// Should print: "Match 0 result: 23 at: 7, Match 1 result: 3 at: 17"
328-
329-
delete[] resultsPtr;
330-
}
331319

332320
return 0;
333321
}

cmake/third_party.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ endif()
5656

5757
# MSTD
5858
if (DOWNLOAD_MSTD)
59-
CPMAddPackage("gh:maipa01/mstd#v1.5.3")
59+
CPMAddPackage("gh:maipa01/mstd#v1.5.4")
6060
endif()
6161

6262
# GTEST

docs/html/annotated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody>
2828
<tr id="projectrow">
2929
<td id="projectalign">
30-
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.7</span>
30+
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.8</span>
3131
</div>
3232
<div id="projectbrief">pcre2cpp</div>
3333
</td>

docs/html/classes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody>
2828
<tr id="projectrow">
2929
<td id="projectalign">
30-
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.7</span>
30+
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.8</span>
3131
</div>
3232
<div id="projectbrief">pcre2cpp</div>
3333
</td>

docs/html/d1/d3f/match__result_8hpp_source.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody>
2828
<tr id="projectrow">
2929
<td id="projectalign">
30-
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.7</span>
30+
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.8</span>
3131
</div>
3232
<div id="projectbrief">pcre2cpp</div>
3333
</td>

docs/html/d1/d3f/namespacepcre2cpp_1_1utils.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody>
2828
<tr id="projectrow">
2929
<td id="projectalign">
30-
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.7</span>
30+
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.8</span>
3131
</div>
3232
<div id="projectbrief">pcre2cpp</div>
3333
</td>

docs/html/d1/d85/structpcre2cpp_1_1utils_1_1pcre2__data_3_01utf__type_1_1_u_t_f__32_01_4.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody>
2828
<tr id="projectrow">
2929
<td id="projectalign">
30-
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.7</span>
30+
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.8</span>
3131
</div>
3232
<div id="projectbrief">pcre2cpp</div>
3333
</td>

docs/html/d1/d9f/classpcre2cpp_1_1basic__match__result.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody>
2828
<tr id="projectrow">
2929
<td id="projectalign">
30-
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.7</span>
30+
<div id="projectname">PCRE2 C++ Wrapper<span id="projectnumber">&#160;1.2.8</span>
3131
</div>
3232
<div id="projectbrief">pcre2cpp</div>
3333
</td>

0 commit comments

Comments
 (0)