mirror of
https://github.com/Halofreak1990/XFXFramework
synced 2024-12-26 13:49:34 +01:00
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.
72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
/********************************************************
|
|
* FileStream.h *
|
|
* *
|
|
* XFX FileStream definition file *
|
|
* Copyright © XFX Team. All Rights Reserved *
|
|
********************************************************/
|
|
#ifndef _FILESTREAM_
|
|
#define _FILESTREAM_
|
|
|
|
#include "../Types.h"
|
|
#include "Enums.h"
|
|
#include "Stream.h"
|
|
|
|
namespace System
|
|
{
|
|
namespace IO
|
|
{
|
|
/// <summary>
|
|
/// Exposes a Stream around a file, supporting both synchronous and asynchronous read and write
|
|
/// operations.
|
|
/// </summary>
|
|
class FileStream : public Stream
|
|
{
|
|
private:
|
|
int handle;
|
|
byte* _buffer;
|
|
FileAccess_t _access;
|
|
bool canSeek;
|
|
bool isAsync;
|
|
Int64 _pos;
|
|
int _readLen;
|
|
int _readPos;
|
|
int _writePos;
|
|
static const int DefaultBufferSize = 8192;
|
|
|
|
void FlushRead();
|
|
void FlushWrite(bool calledFromFinalizer);
|
|
|
|
protected:
|
|
void Dispose(bool disposing);
|
|
|
|
public:
|
|
bool CanRead();
|
|
bool CanSeek();
|
|
bool CanWrite();
|
|
virtual bool IsAsync();
|
|
long long Length();
|
|
char* Name();
|
|
long long Position(); //get
|
|
void Position(long long newPosition); //set
|
|
|
|
FileStream();
|
|
FileStream(char* path, FileMode_t mode);
|
|
FileStream(char* path, FileMode_t mode, FileAccess_t access);
|
|
FileStream(char* path, FileMode_t mode, FileAccess_t access, FileShare_t share);
|
|
FileStream(char* path, FileMode_t mode, FileAccess_t access, FileShare_t share, int bufferSize);
|
|
FileStream(char* path, FileMode_t mode, FileAccess_t access, FileShare_t share, int bufferSize, bool useAsync);
|
|
virtual ~FileStream();
|
|
|
|
void Flush();
|
|
int Read(byte array[], int offset, int count) __attribute__((nonnull (1)));
|
|
int ReadByte();
|
|
long long Seek(long long offset, SeekOrigin_t origin);
|
|
void SetLength(long long value);
|
|
void Write(byte array[], int offset, int count) __attribute__((nonnull (1)));
|
|
void WriteByte(byte value);
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif //_FILESTREAM_
|