File tree 5 files changed +19
-24
lines changed
5 files changed +19
-24
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ include(GNUInstallDirs)
6
6
add_library (${PROJECT_NAME} INTERFACE )
7
7
target_sources (${PROJECT_NAME} INTERFACE
8
8
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include/cstringpp/core.hpp>"
9
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include/cstringpp/helpers .hpp>"
9
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include/cstringpp/detail .hpp>"
10
10
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include/cstringpp.hpp>" )
11
11
target_include_directories (${PROJECT_NAME} SYSTEM INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX >/include >)
12
12
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
3
#include " cstringpp/core.hpp"
4
- #include " cstringpp/helpers .hpp"
4
+ #include " cstringpp/detail .hpp"
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
3
#include < cstddef>
4
- #include < cstring>
5
4
#include < array>
6
5
#include < compare>
7
6
#include < utility>
8
7
9
- #include " helpers .hpp"
8
+ #include " detail .hpp"
10
9
11
10
namespace cstringpp {
12
11
13
- namespace detail {
14
-
15
- template <size_t Length>
16
- constexpr size_t getPositiveIndex (int index) {
17
- while (index < 0 ) {
18
- index += Length;
19
- }
20
- while (index >= Length) {
21
- index -= Length;
22
- }
23
- return index ;
24
- }
25
-
26
- } // namespace detail
27
-
28
12
template <size_t Length>
29
13
class String {
30
14
public:
@@ -129,11 +113,11 @@ class String {
129
113
}
130
114
131
115
[[nodiscard]] constexpr String<Length> toLower () const {
132
- return map (&cstringpp::toLower);
116
+ return map (&cstringpp::detail:: toLower);
133
117
}
134
118
135
119
[[nodiscard]] constexpr String<Length> toUpper () const {
136
- return map (&cstringpp::toUpper);
120
+ return map (&cstringpp::detail:: toUpper);
137
121
}
138
122
139
123
[[nodiscard]] constexpr String<Length> reverse () const {
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
- namespace cstringpp {
3
+ namespace cstringpp ::detail {
4
4
5
5
[[nodiscard]] constexpr char toLower (char in) {
6
6
if (in >= ' A' && in <= ' Z' ) {
@@ -16,4 +16,15 @@ namespace cstringpp {
16
16
return in;
17
17
}
18
18
19
+ template <size_t Length>
20
+ constexpr size_t getPositiveIndex (int index) {
21
+ while (index < 0 ) {
22
+ index += Length;
23
+ }
24
+ while (index >= Length) {
25
+ index -= Length;
26
+ }
27
+ return index ;
28
+ }
29
+
19
30
} // namespace cstringpp
Original file line number Diff line number Diff line change @@ -54,10 +54,10 @@ TEST(String, slice) {
54
54
}
55
55
56
56
TEST (String, map) {
57
- constexpr String str1 = String{" HElLo" }.map ([](char c) { return cstringpp::toUpper (c); });
57
+ constexpr String str1 = String{" HElLo" }.map ([](char c) { return cstringpp::detail:: toUpper (c); });
58
58
EXPECT_STREQ (str1.toCString (), " HELLO" );
59
59
60
- constexpr String str2 = String{" HElLo" }.map (&cstringpp::toLower);
60
+ constexpr String str2 = String{" HElLo" }.map (&cstringpp::detail:: toLower);
61
61
EXPECT_STREQ (str2.toCString (), " hello" );
62
62
}
63
63
You can’t perform that action at this time.
0 commit comments