2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
7
#include "MyGUI_Precompiled.h"
8
#include "MyGUI_DataMemoryStream.h"
13
DataMemoryStream::DataMemoryStream() :
20
DataMemoryStream::DataMemoryStream(unsigned char* _data, size_t _size) :
27
DataMemoryStream::~DataMemoryStream()
32
size_t DataMemoryStream::size()
37
bool DataMemoryStream::eof()
39
if (mStream == nullptr)
42
return mStream->eof();
45
void DataMemoryStream::readline(std::string& _source, Char _delim)
47
if (mStream == nullptr)
50
std::getline(*mStream, _source, (char)_delim);
53
size_t DataMemoryStream::read(void* _buf, size_t _count)
58
size_t count = (std::min)(size(), _count);
59
::memcpy(_buf, mData, count);
63
void DataMemoryStream::prepareStream()
68
mStream = new std::stringstream((const char*)mData);