summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemorystream.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2007-01-02 08:33:20 +0000
committerJames Cook <james@lindenlab.com>2007-01-02 08:33:20 +0000
commit420b91db29485df39fd6e724e782c449158811cb (patch)
treeb471a94563af914d3ed3edd3e856d21cb1b69945 /indra/llcommon/llmemorystream.cpp
Print done when done.
Diffstat (limited to 'indra/llcommon/llmemorystream.cpp')
-rw-r--r--indra/llcommon/llmemorystream.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/indra/llcommon/llmemorystream.cpp b/indra/llcommon/llmemorystream.cpp
new file mode 100644
index 0000000000..dc0ad5aadb
--- /dev/null
+++ b/indra/llcommon/llmemorystream.cpp
@@ -0,0 +1,52 @@
+/**
+ * @file llmemorystream.cpp
+ * @author Phoenix
+ * @date 2005-06-03
+ * @brief Buffer and stream for a fixed linear memory segment.
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#include "linden_common.h"
+#include "llmemorystream.h"
+
+LLMemoryStreamBuf::LLMemoryStreamBuf(const U8* start, S32 length)
+{
+ reset(start, length);
+}
+
+LLMemoryStreamBuf::~LLMemoryStreamBuf()
+{
+}
+
+void LLMemoryStreamBuf::reset(const U8* start, S32 length)
+{
+ setg((char*)start, (char*)start, (char*)start + length);
+}
+
+int LLMemoryStreamBuf::underflow()
+{
+ //lldebugs << "LLMemoryStreamBuf::underflow()" << llendl;
+ if(gptr() < egptr())
+ {
+ return *gptr();
+ }
+ return EOF;
+}
+
+/**
+ * @class LLMemoryStreamBuf
+ */
+
+LLMemoryStream::LLMemoryStream(const U8* start, S32 length) :
+ std::istream(&mStreamBuf),
+ mStreamBuf(start, length)
+{
+}
+
+LLMemoryStream::~LLMemoryStream()
+{
+}
+
+