Commit d417292b authored by Marco Bubke's avatar Marco Bubke

Utils: Cleanup SmallString IO

Change-Id: I59d0239e600f91304bf6e084d9e3550e423fc54e
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 381b51c0
......@@ -62,7 +62,7 @@ QDataStream &operator>>(QDataStream &in, BasicSmallString<Size> &string)
char *data = string.data();
in.readRawData(data, size);
in.readRawData(data, int(size));
}
return in;
......@@ -79,38 +79,26 @@ QDebug &operator<<(QDebug &debug, const String &string)
}
template <uint Size>
std::ostream &operator<<(std::ostream &stream, const BasicSmallString<Size> &string)
std::ostream &operator<<(std::ostream &out, const BasicSmallString<Size> &string)
{
using std::operator<<;
BasicSmallString<Size> formatedString = string.clone();
stream.write(string.data(), std::streamsize(string.size()));
formatedString.replace("\n", "\\n");
formatedString.replace("\t", "\\t");
return stream;
}
out << "\"";
inline
std::ostream &operator<<(std::ostream &stream, SmallStringView string)
{
using std::operator<<;
out.write(formatedString.data(), std::streamsize(formatedString.size()));
stream.write(string.data(), std::streamsize(string.size()));
out << "\"";
return stream;
return out;
}
template <uint Size>
void PrintTo(const BasicSmallString<Size> &string, ::std::ostream *os)
inline
std::ostream &operator<<(std::ostream &out, SmallStringView string)
{
BasicSmallString<Size> formatedString = string.clone();
formatedString.replace("\n", "\\n");
formatedString.replace("\t", "\\t");
*os << "'";
os->write(formatedString.data(), formatedString.size());
*os<< "'";
return out << PathString(string);
}
template <typename String>
......@@ -155,9 +143,9 @@ QDebug operator<<(QDebug debug, const BasicSmallStringVector<String> &stringVect
}
template <typename String>
void PrintTo(const BasicSmallStringVector<String> &textVector, ::std::ostream* os)
std::ostream &operator<<(std::ostream &out, const BasicSmallStringVector<String> &textVector)
{
*os << "[" << textVector.join(", ").constData() << "]";
return out << "[" << textVector.join("\", \"") << "]";
}
} // namespace Utils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment