add write()

This commit is contained in:
David Rose 2009-08-31 06:11:34 +00:00
parent b9b6dc8f0d
commit cfbac6e51a
2 changed files with 14 additions and 0 deletions

View File

@ -415,3 +415,15 @@ INLINE void StreamWriter::
flush() {
_out->flush();
}
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::write
// Access: Published
// Description: A synonym of append_data(). This is useful when
// assigning the StreamWriter to sys.stderr and/or
// sys.stdout in Python.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
write(const string &data) {
append_data(data.data(), data.length());
}

View File

@ -76,6 +76,8 @@ PUBLISHED:
BLOCKING INLINE void flush();
BLOCKING INLINE void write(const string &str);
private:
ostream *_out;
bool _owns_stream;