MyGUI  3.2.1
MyGUI_DataMemoryStream.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_DATA_MEMORY_STREAM_H__
00008 #define __MYGUI_DATA_MEMORY_STREAM_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_IDataStream.h"
00012 
00013 namespace MyGUI
00014 {
00015 
00016     class MYGUI_EXPORT DataMemoryStream :
00017         public IDataStream
00018     {
00019     public:
00020         DataMemoryStream();
00021         DataMemoryStream(unsigned char* _data, size_t _size);
00022         virtual ~DataMemoryStream();
00023 
00024         virtual bool eof();
00025         virtual size_t size();
00026         virtual void readline(std::string& _source, Char _delim);
00027         virtual size_t read(void* _buf, size_t _count);
00028 
00029     private:
00030         void prepareStream();
00031 
00032     protected:
00033         unsigned char* mData;
00034         size_t mSize;
00035         std::stringstream* mStream;
00036     };
00037 
00038 } // namespace MyGUI
00039 
00040 #endif // __MYGUI_DATA_MEMORY_STREAM_H__