diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-04-29 19:22:54 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-04-29 19:22:54 +0000 |
commit | 1edb424b734ea3e4f2128e1cbc77a22bd001f8d5 (patch) | |
tree | da3e95edf1ab1a1808ac6673811f76610f9dfce2 /lib/common/IOStream.cpp | |
parent | 1ce71f487e6cd6514198c3769cd0a337395c1f8e (diff) |
Add a ToString method to IOStream and some subclasses.
Useful to help debug problems such as invalid file headers when the source
of the stream might not be too obvious.
Diffstat (limited to 'lib/common/IOStream.cpp')
-rw-r--r-- | lib/common/IOStream.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/common/IOStream.cpp b/lib/common/IOStream.cpp index fc9d0bc3..71e8f8c0 100644 --- a/lib/common/IOStream.cpp +++ b/lib/common/IOStream.cpp @@ -245,7 +245,30 @@ void IOStream::Flush(int Timeout) } } +// -------------------------------------------------------------------------- +// +// Function +// Name: IOStream::Write +// Purpose: Convenience method for writing a null-terminated +// C string to a protocol buffer. +// +// -------------------------------------------------------------------------- void IOStream::Write(const char *pBuffer) { Write(pBuffer, strlen(pBuffer)); } + +// -------------------------------------------------------------------------- +// +// 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 +{ + return "unknown IOStream"; +} |