Browse Source

Removed StringView ctor/set argument default values.

Бранимир Караџић 2 years ago
parent
commit
7e6f30a241
3 changed files with 19 additions and 3 deletions
  1. 10 0
      include/bx/inline/string.inl
  2. 8 2
      include/bx/string.h
  3. 1 1
      tests/string_test.cpp

+ 10 - 0
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);

+ 8 - 2
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();

+ 1 - 1
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() );