blob: dc0ad5aadbfff8a15656d995de8720424128c1ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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()
{
}
|