PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llcommon/llmemorystream.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 70 lines | 29 code | 10 blank | 31 comment | 1 complexity | 20a35e20d8d4cc55f7a4c4faf8daed43 MD5 | raw file
 1/** 
 2 * @file llmemorystream.cpp
 3 * @author Phoenix
 4 * @date 2005-06-03
 5 * @brief Buffer and stream for a fixed linear memory segment.
 6 *
 7 * $LicenseInfo:firstyear=2005&license=viewerlgpl$
 8 * Second Life Viewer Source Code
 9 * Copyright (C) 2010, Linden Research, Inc.
10 * 
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License only.
15 * 
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 * 
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 * 
25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
26 * $/LicenseInfo$
27 */
28
29#include "linden_common.h"
30#include "llmemorystream.h"
31
32LLMemoryStreamBuf::LLMemoryStreamBuf(const U8* start, S32 length)
33{
34	reset(start, length);
35}
36
37LLMemoryStreamBuf::~LLMemoryStreamBuf()
38{
39}
40
41void LLMemoryStreamBuf::reset(const U8* start, S32 length)
42{
43	setg((char*)start, (char*)start, (char*)start + length);
44}
45
46int LLMemoryStreamBuf::underflow()
47{
48	//lldebugs << "LLMemoryStreamBuf::underflow()" << llendl;
49	if(gptr() < egptr())
50	{
51		return *gptr();
52	}
53	return EOF;
54}
55
56/** 
57 * @class LLMemoryStreamBuf
58 */
59
60LLMemoryStream::LLMemoryStream(const U8* start, S32 length) :
61	std::istream(&mStreamBuf),
62	mStreamBuf(start, length)
63{
64}
65
66LLMemoryStream::~LLMemoryStream()
67{
68}
69
70