Index: compiled/String.h |
=================================================================== |
--- a/compiled/String.h |
+++ b/compiled/String.h |
@@ -16,16 +16,17 @@ |
*/ |
#pragma once |
#include <algorithm> |
#include <cstddef> |
#include <cstring> |
#include <type_traits> |
+#include <iostream> |
sergei
2018/02/01 16:10:46
Could you please wrap it by #ifdef INSIDE_TESTS to
hub
2018/02/01 19:16:29
Done.
|
#include "debug.h" |
#include "library.h" |
inline void String_assert_writable(bool isWritable); |
class String |
{ |
@@ -188,16 +189,25 @@ |
else if (currChar >= 128) |
{ |
mBuf[i] = CharToLower(currChar); |
} |
} |
} |
}; |
+#ifdef INSIDE_TESTS |
+inline std::ostream& operator<<(std::ostream& os, const String& str) |
+{ |
+ for (String::size_type i = 0; i < str.length(); i++) |
+ os << static_cast<char>(str[i]); |
sergei
2018/02/01 16:10:46
Even for tests I would like to have a helper funct
hub
2018/02/01 19:16:30
Done
|
+ return os; |
+} |
+#endif |
+ |
class DependentString : public String |
{ |
public: |
explicit DependentString() |
: String(nullptr, 0, INVALID) |
{ |
} |
@@ -252,16 +262,23 @@ |
void erase() |
{ |
*this = DependentString(); |
mLen = DELETED; |
} |
}; |
+#ifdef INSIDE_TESTS |
+inline std::ostream& operator<<(std::ostream& os, const DependentString& str) |
sergei
2018/02/01 16:10:46
It should not be required.
hub
2018/02/01 19:16:30
Without this it operator<< doesn't get called, unl
sergei
2018/02/02 15:03:32
Acknowledged. I think it is worth investigation, b
|
+{ |
+ return os << static_cast<const String&>(str); |
+} |
+#endif |
+ |
inline DependentString operator "" _str(const String::value_type* str, |
String::size_type len) |
{ |
return DependentString(str, len); |
} |
inline void String_assert_writable(bool isWritable) |
{ |