/* ----------------------------------------------------------------------------- GSFramework Copyright 2001-2013 Emmanuel Julien. All Rights Reserved. ----------------------------------------------------------------------------- */ #ifndef __NIODISPATCH__ #define __NIODISPATCH__ #include #include "filesystem/io_handle.h" #include "memory/nauto_ptr.h" #include "container/nlist.h" #include "nstring/nstring.h" namespace GS { namespace IO { // class DispatcherHandle : public Handle { friend class Dispatcher; AutoPtr handle; DispatcherHandle(Base *, Handle *); public: ~DispatcherHandle(); }; /*! @short Dispatcher I/O. @author Emmanuel Julien (ejulien@nworks.fr) */ class Dispatcher : public Base { struct DispatchFS { String prefix; SharedPtr fs; }; SharedList roots; AutoList mounts; Base *Dispatch(String &, Mode); public: bool AddDispatch(Base *, const char *prefix = 0); virtual uint GetCaps() const; virtual Handle *Open(const char *, Mode = ModeRead); virtual void Close(Handle *); virtual String Hash(const char *); virtual bool Delete(const char *); virtual size_t Tell(Handle *); virtual size_t Seek(Handle *, ptrdiff_t offset, SeekRef = SeekCurrent); virtual size_t Read(Handle *, void *, size_t); virtual size_t Write(Handle *, const void *, size_t); virtual bool MkDir(const char *); }; } // IO } // GS #endif // __NIODISPATCH__