From a33b9bb93ef9a4747da9ea72bfe12a456c4316d9 Mon Sep 17 00:00:00 2001 From: ChUrl Date: Fri, 29 Jul 2022 14:35:33 +0200 Subject: [PATCH] replace char*/string with stringview --- c_os/lib/OutStream.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/c_os/lib/OutStream.h b/c_os/lib/OutStream.h index 77d49a7..9e80557 100755 --- a/c_os/lib/OutStream.h +++ b/c_os/lib/OutStream.h @@ -24,6 +24,7 @@ #include "lib/StringBuffer.h" #include "user/lib/String.h" +#include "user/lib/StringView.h" // Some basic width formatting class fillw { @@ -85,24 +86,14 @@ public: // Darstellung einer nullterminierten Zeichenkette template - friend T& operator<<(T& os, const char* string) { - const char* pos = string; - while (*pos) { - os.put(*pos); - pos++; + friend T& operator<<(T& os, const bse::string_view string) { + for (char current : string) { + os.put(current); } - os.fill_finalize(); return os; } - // Can not use this exclusively for strings as these are heap allocated - template - friend T& operator<<(T& os, const bse::string& string) { - os << static_cast(string); - return os; - } - // Darstellung ganzer Zahlen im Zahlensystem zur Basis base template friend T& operator<<(T& os, short ival) { return os << static_cast(ival); }