diff options
Diffstat (limited to 'lib/common/IOStream.cpp')
-rw-r--r-- | lib/common/IOStream.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/lib/common/IOStream.cpp b/lib/common/IOStream.cpp index fc9d0bc3..3e126d3f 100644 --- a/lib/common/IOStream.cpp +++ b/lib/common/IOStream.cpp @@ -127,8 +127,8 @@ int IOStream::ConvertSeekTypeToOSWhence(int SeekType) // Function // Name: IOStream::ReadFullBuffer(void *, int, int) // Purpose: Reads bytes into buffer, returning whether or not it managed to -// get all the bytes required. Exception and abort use of stream -// if this returns false. +// get all the bytes required. Exception and abort use of stream +// if this returns false. // Created: 2003/08/26 // // -------------------------------------------------------------------------- @@ -165,7 +165,7 @@ bool IOStream::ReadFullBuffer(void *pBuffer, int NBytes, int *pNBytesRead, int T // Created: 2003/08/26 // // -------------------------------------------------------------------------- -void IOStream::WriteAllBuffered() +void IOStream::WriteAllBuffered(int Timeout) { } @@ -245,7 +245,30 @@ void IOStream::Flush(int Timeout) } } -void IOStream::Write(const char *pBuffer) +// -------------------------------------------------------------------------- +// +// Function +// Name: IOStream::Write +// Purpose: Convenience method for writing a C++ string to a +// protocol buffer. +// +// -------------------------------------------------------------------------- +void IOStream::Write(const std::string& rBuffer, int Timeout) +{ + Write(rBuffer.c_str(), rBuffer.size(), Timeout); +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: IOStream::ToString() +// Purpose: Returns a string which describes this stream. Useful +// when reporting exceptions about a stream of unknown +// origin, for example in BackupStoreDirectory(). +// Created: 2014/04/28 +// +// -------------------------------------------------------------------------- +std::string IOStream::ToString() const { - Write(pBuffer, strlen(pBuffer)); + return "unknown IOStream"; } |