1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
XFXFramework/include/System/IO/MemoryStream.h
Halofreak1990 e7a47c8ed9 Revamped the List class so that it can (properly) handle pointers as well
Added 'ValueTypes' Single and Double
Added some components in the new System::Net namespace
Added the Console class, which can be used to output text to the screen
Updated a bunch of structs to include the IComparable and IEquatable interfaces, and inheritance from Object to allow better interoperability between container classes and other types
Replaced all exception handling code with a report to stdout.txt - this will, I hope, eventually be reversed, but as of yet, there is no support for exceptions.

BEWARE! Even though all libraries correctly compile, you cannot use any class/structure that inherits from a template class, because stupid G++ wants to include exception handling for each template.
2011-11-07 01:29:50 +00:00

62 lines
1.5 KiB
C++

#ifndef _SYSTEM_IO_MEMORYSTREAM_
#define _SYSTEM_IO_MEMORYSTREAM_
#include "../Types.h"
#include "Stream.h"
namespace System
{
namespace IO
{
// Creates a stream whose backing store is memory.
class MemoryStream : public Stream, virtual Object
{
private:
byte* _buffer;
int _capacity;
bool _expandable;
bool _exposable;
bool _isOpen;
int _length;
int _origin;
int _position;
bool _writable;
static const int MemStreamMaxLength;
bool EnsureCapacity(int value);
protected:
void Dispose(bool disposing);
public:
bool CanRead();
bool CanSeek();
bool CanWrite();
virtual int Capacity();
virtual void Capacity(int value);
Int64 Length();
Int64 Position;
MemoryStream();
MemoryStream(int capacity);
MemoryStream(byte buffer[]);
MemoryStream(byte buffer[], bool writable);
MemoryStream(byte buffer[], int index, int count);
MemoryStream(byte buffer[], int index, int count, bool writable);
MemoryStream(byte buffer[], int index, int count, bool writable, bool publiclyVisible);
void Flush();
virtual byte* GetBuffer();
int Read(byte buffer[], int offset, int count);
int ReadByte();
Int64 Seek(Int64 offset, SeekOrigin_t loc);
void SetLength(Int64 value);
virtual byte* ToArray();
void Write(byte buffer[], int offset, int count);
void WriteByte(byte value);
virtual void WriteTo(Stream* stream);
};
}
}
#endif //_SYSTEM_IO_MEMORYSTREAM_