summaryrefslogtreecommitdiff
path: root/lib/common/MemBlockStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/MemBlockStream.cpp')
-rw-r--r--lib/common/MemBlockStream.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/common/MemBlockStream.cpp b/lib/common/MemBlockStream.cpp
index 3a43a304..f49ac96f 100644
--- a/lib/common/MemBlockStream.cpp
+++ b/lib/common/MemBlockStream.cpp
@@ -52,6 +52,26 @@ MemBlockStream::MemBlockStream(const void *pBuffer, int Size)
// --------------------------------------------------------------------------
//
// Function
+// Name: MemBlockStream::MemBlockStream(const std::string& rMessage)
+// Purpose: Convenience constructor for sending a simple string.
+// Copies the string, so you can pass a temporary in.
+// Created: 2014/01/20
+//
+// --------------------------------------------------------------------------
+MemBlockStream::MemBlockStream(const std::string& rMessage)
+: mReadPosition(0)
+{
+ mTempBuffer.Write(rMessage.c_str(), rMessage.size());
+ mTempBuffer.SetForReading();
+ mpBuffer = (const char *)(mTempBuffer.GetBuffer());
+ mBytesInBuffer = rMessage.size();
+ ASSERT(mpBuffer != 0);
+ ASSERT(mBytesInBuffer >= 0);
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
// Name: MemBlockStream::MemBlockStream(const StreamableMemBlock &)
// Purpose: Constructor (doesn't copy block, careful with lifetimes)
// Created: 2003/09/05
@@ -159,7 +179,7 @@ IOStream::pos_type MemBlockStream::BytesLeftToRead()
// Created: 2003/09/05
//
// --------------------------------------------------------------------------
-void MemBlockStream::Write(const void *pBuffer, int NBytes)
+void MemBlockStream::Write(const void *pBuffer, int NBytes, int Timeout)
{
THROW_EXCEPTION(CommonException, MemBlockStreamNotSupported)
}