replace char*/string with stringview
This commit is contained in:
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "lib/StringBuffer.h"
|
#include "lib/StringBuffer.h"
|
||||||
#include "user/lib/String.h"
|
#include "user/lib/String.h"
|
||||||
|
#include "user/lib/StringView.h"
|
||||||
|
|
||||||
// Some basic width formatting
|
// Some basic width formatting
|
||||||
class fillw {
|
class fillw {
|
||||||
@ -85,24 +86,14 @@ public:
|
|||||||
|
|
||||||
// Darstellung einer nullterminierten Zeichenkette
|
// Darstellung einer nullterminierten Zeichenkette
|
||||||
template<typename T>
|
template<typename T>
|
||||||
friend T& operator<<(T& os, const char* string) {
|
friend T& operator<<(T& os, const bse::string_view string) {
|
||||||
const char* pos = string;
|
for (char current : string) {
|
||||||
while (*pos) {
|
os.put(current);
|
||||||
os.put(*pos);
|
|
||||||
pos++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
os.fill_finalize();
|
os.fill_finalize();
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can not use this exclusively for strings as these are heap allocated
|
|
||||||
template<typename T>
|
|
||||||
friend T& operator<<(T& os, const bse::string& string) {
|
|
||||||
os << static_cast<const char*>(string);
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Darstellung ganzer Zahlen im Zahlensystem zur Basis base
|
// Darstellung ganzer Zahlen im Zahlensystem zur Basis base
|
||||||
template<typename T>
|
template<typename T>
|
||||||
friend T& operator<<(T& os, short ival) { return os << static_cast<long>(ival); }
|
friend T& operator<<(T& os, short ival) { return os << static_cast<long>(ival); }
|
||||||
|
Reference in New Issue
Block a user