mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Refactored stream overloads
This commit is contained in:
@@ -49,9 +49,20 @@ namespace YAML
|
||||
bool m_comment;
|
||||
};
|
||||
|
||||
ostream_wrapper& operator << (ostream_wrapper& out, const char *str);
|
||||
ostream_wrapper& operator << (ostream_wrapper& out, const std::string& str);
|
||||
ostream_wrapper& operator << (ostream_wrapper& out, char ch);
|
||||
inline ostream_wrapper& operator << (ostream_wrapper& stream, const char *str) {
|
||||
stream.write(str, std::strlen(str));
|
||||
return stream;
|
||||
}
|
||||
|
||||
inline ostream_wrapper& operator << (ostream_wrapper& stream, const std::string& str) {
|
||||
stream.write(str);
|
||||
return stream;
|
||||
}
|
||||
|
||||
inline ostream_wrapper& operator << (ostream_wrapper& stream, char ch) {
|
||||
stream.write(&ch, 1);
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
@@ -53,22 +53,4 @@ namespace YAML
|
||||
m_comment = false;
|
||||
}
|
||||
}
|
||||
|
||||
ostream_wrapper& operator << (ostream_wrapper& out, const char *str)
|
||||
{
|
||||
out.write(str, std::strlen(str));
|
||||
return out;
|
||||
}
|
||||
|
||||
ostream_wrapper& operator << (ostream_wrapper& out, const std::string& str)
|
||||
{
|
||||
out.write(str);
|
||||
return out;
|
||||
}
|
||||
|
||||
ostream_wrapper& operator << (ostream_wrapper& out, char ch)
|
||||
{
|
||||
out.write(&ch, 1);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user