Removed StringView ctor/set argument default values.

This commit is contained in:
Бранимир Караџић
2023-05-09 18:17:01 -07:00
parent f1296fb7e0
commit 7e6f30a241
3 changed files with 19 additions and 3 deletions

View File

@@ -73,6 +73,11 @@ namespace bx
{ {
} }
inline StringView::StringView(const StringView& _rhs)
{
set(_rhs);
}
inline StringView::StringView(const StringView& _rhs, int32_t _start, int32_t _len) inline StringView::StringView(const StringView& _rhs, int32_t _start, int32_t _len)
{ {
set(_rhs, _start, _len); set(_rhs, _start, _len);
@@ -127,6 +132,11 @@ namespace bx
set(_ptr, int32_t(_term-_ptr) ); set(_ptr, int32_t(_term-_ptr) );
} }
inline void StringView::set(const StringView& _str)
{
set(_str, 0, INT32_MAX);
}
inline void StringView::set(const StringView& _str, int32_t _start, int32_t _len) inline void StringView::set(const StringView& _str, int32_t _start, int32_t _len)
{ {
const int32_t start = min(_start, _str.m_len); const int32_t start = min(_start, _str.m_len);

View File

@@ -61,7 +61,10 @@ namespace bx
constexpr StringView(const StringLiteral& _str); constexpr StringView(const StringLiteral& _str);
/// ///
StringView(const StringView& _rhs, int32_t _start = 0, int32_t _len = INT32_MAX); StringView(const StringView& _rhs);
///
StringView(const StringView& _rhs, int32_t _start, int32_t _len);
/// ///
StringView& operator=(const char* _rhs); StringView& operator=(const char* _rhs);
@@ -88,7 +91,10 @@ namespace bx
void set(const char* _ptr, const char* _term); void set(const char* _ptr, const char* _term);
/// ///
void set(const StringView& _str, int32_t _start = 0, int32_t _len = INT32_MAX); void set(const StringView& _str);
///
void set(const StringView& _str, int32_t _start, int32_t _len);
/// ///
void clear(); void clear();

View File

@@ -584,7 +584,7 @@ TEST_CASE("strWord", "")
TEST_CASE("strFindBlock", "") TEST_CASE("strFindBlock", "")
{ {
const bx::StringView test0("{ { {} {} abvgd; {} } }"); const bx::StringView test0("{ { {} {} abvgd; {} } }");
const bx::StringView test1(test0, 1); const bx::StringView test1(test0, 1, INT32_MAX);
bx::StringView result = bx::strFindBlock(test1, '{', '}'); bx::StringView result = bx::strFindBlock(test1, '{', '}');
REQUIRE(19 == result.getLength() ); REQUIRE(19 == result.getLength() );