From 7e6f30a241a8f39eae65eab413590fa2b0fcb32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Tue, 9 May 2023 18:17:01 -0700 Subject: [PATCH] Removed StringView ctor/set argument default values. --- include/bx/inline/string.inl | 10 ++++++++++ include/bx/string.h | 10 ++++++++-- tests/string_test.cpp | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/bx/inline/string.inl b/include/bx/inline/string.inl index 51271e3..c2658a9 100644 --- a/include/bx/inline/string.inl +++ b/include/bx/inline/string.inl @@ -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) { set(_rhs, _start, _len); @@ -127,6 +132,11 @@ namespace bx 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) { const int32_t start = min(_start, _str.m_len); diff --git a/include/bx/string.h b/include/bx/string.h index 5e81400..69ca122 100644 --- a/include/bx/string.h +++ b/include/bx/string.h @@ -61,7 +61,10 @@ namespace bx 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); @@ -88,7 +91,10 @@ namespace bx 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(); diff --git a/tests/string_test.cpp b/tests/string_test.cpp index 96f653f..bce5bd3 100644 --- a/tests/string_test.cpp +++ b/tests/string_test.cpp @@ -584,7 +584,7 @@ TEST_CASE("strWord", "") TEST_CASE("strFindBlock", "") { 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, '{', '}'); REQUIRE(19 == result.getLength() );