first commit
This commit is contained in:
80
include/platform/filesystem/io_base.h
Normal file
80
include/platform/filesystem/io_base.h
Normal file
@ -0,0 +1,80 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NIOBASE__
|
||||
#define __NIOBASE__
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include "filesystem/io_mode.h"
|
||||
#include "memory/nshared_ptr.h"
|
||||
#include "container/narray.h"
|
||||
#include "alloc/ialloc.h"
|
||||
|
||||
|
||||
namespace GS {
|
||||
class String;
|
||||
|
||||
namespace IO {
|
||||
class Handle;
|
||||
|
||||
/*!
|
||||
@short I/O base.
|
||||
@author Emmanuel Julien (ejulien@nworks.fr)
|
||||
*/
|
||||
struct Base : public SharedObject
|
||||
{
|
||||
NPLACEMENT_NEW(Filesystem)
|
||||
|
||||
enum SeekRef
|
||||
{
|
||||
SeekStart = 0,
|
||||
SeekCurrent,
|
||||
SeekEnd
|
||||
};
|
||||
|
||||
enum Caps
|
||||
{
|
||||
IsCaseSensitive = (1 << 0),
|
||||
CanRead = (1 << 1),
|
||||
CanWrite = (1 << 2),
|
||||
CanSeek = (1 << 3),
|
||||
CanDelete = (1 << 4),
|
||||
CanMkDir = (1 << 5)
|
||||
};
|
||||
|
||||
bool FileLoad(const char *uri, Array <char> &buffer);
|
||||
bool FileSave(const char *uri, const Array <char> &buffer);
|
||||
|
||||
String FileHash(const char *uri);
|
||||
|
||||
virtual bool Exists(const char *);
|
||||
virtual String Hash(const char *);
|
||||
|
||||
virtual String MapToAbsolute(const char *uri) const;
|
||||
virtual String MapToRelative(const char *path) const;
|
||||
|
||||
virtual uint GetCaps() const = 0;
|
||||
|
||||
virtual Handle *Open(const char *, Mode = ModeRead) = 0;
|
||||
virtual void Close(Handle *) = 0;
|
||||
|
||||
virtual bool Delete(const char *) = 0;
|
||||
|
||||
virtual size_t Tell(Handle *) = 0;
|
||||
virtual size_t Seek(Handle *, ptrdiff_t offset, SeekRef = SeekCurrent) = 0;
|
||||
|
||||
virtual size_t Read(Handle *, void *, size_t) = 0;
|
||||
virtual size_t Write(Handle *, const void *, size_t) = 0;
|
||||
|
||||
virtual bool MkDir(const char *) = 0;
|
||||
};
|
||||
|
||||
} // IO
|
||||
} // GS
|
||||
|
||||
|
||||
#endif // __NIOBASE__
|
||||
Reference in New Issue
Block a user