1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
XFXFramework/include/System/IO/StreamWriter.h
Halofreak1990 1bf933432b List class now works.
TextureCollection is broken because it can somehow not resolve Texture as template argument for the List it uses.
Added missing BinaryWriter and TextWriter classes to System::IO namespace
Modified BinaryReader
Added PacketReader and PacketWriter classes to XFX::Net namespace
2011-03-10 22:55:43 +00:00

74 lines
2.0 KiB
C++

/********************************************************
* StreamWriter.h *
* *
* XFX StreamWriter definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_IO_STREAMWRITER_
#define _SYSTEM_IO_STREAMWRITER_
#include <System/Text/Encoding.h>
#include <System/Text/Encoder.h>
#include "Stream.h"
#include "TextWriter.h"
#include <System/Types.h>
using namespace System::Text;
namespace System
{
namespace IO
{
/// <summary>
/// Implements a TextWriter for writing characters to a stream in a particular encoding.
/// </summary>
class StreamWriter : public TextWriter
{
private:
static Encoding _UTF8NoBOM;
bool autoFlush;
byte* byteBuffer;
char* charBuffer;
int charLen;
int charPos;
bool closable;
static const int DefaultBufferSize;
Encoder encoder;
Encoding encoding;
bool haveWrittenPreamble;
Stream* stream;
static Stream* CreateFile(char* path, bool append);
void Init(Stream* stream, Encoding encoding, int bufferSize);
void Flush(bool flushStream, bool flushEncoder);
protected:
void Dispose(bool disposing);
public:
bool AutoFlush;
virtual Stream BaseStream();
Encoding Encoding_();
static const StreamWriter Null;
StreamWriter(Stream* stream);
StreamWriter(char* path);
StreamWriter(Stream* stream, Encoding encoding);
StreamWriter(char* path, bool append);
StreamWriter(Stream* stream, Encoding encoding, int bufferSize);
StreamWriter(char* path, bool append, Encoding encoding);
StreamWriter(char* path, bool append, Encoding encoding, int bufferSize);
virtual ~StreamWriter();
void Close();
void Flush();
void Write(char value);
void Write(char buffer[]);
void Write(char buffer[], int index, int count);
void Write(const char* value);
};
}
}
#endif //_SYSTEM_IO_STREAMWRITER_