mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
- Added missing projects "VFS" & "export" to SVN
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4447 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* bfVFS : vfs/Core/Interface/vfs_directory_interface.h
|
||||
* - partially implements Location interface for file system directories
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VFS_DIRECTORY_INTERFACE_H_
|
||||
#define _VFS_DIRECTORY_INTERFACE_H_
|
||||
|
||||
#include <vfs/Core/Interface/vfs_location_interface.h>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
template<class WriteType>
|
||||
class TDirectory : public vfs::TLocationTemplate<vfs::IReadable, WriteType>
|
||||
{
|
||||
public:
|
||||
typedef typename vfs::TLocationTemplate<vfs::IReadable, WriteType> tBaseClass;
|
||||
typedef typename tBaseClass::tFileType tFileType;
|
||||
typedef typename tBaseClass::tWriteType tWriteType;
|
||||
|
||||
TDirectory(vfs::Path const& mountPoint, vfs::Path const& realPath)
|
||||
: tBaseClass(mountPoint), m_realPath(realPath)
|
||||
{};
|
||||
virtual ~TDirectory()
|
||||
{};
|
||||
|
||||
vfs::Path const& getRealPath()
|
||||
{
|
||||
return m_realPath;
|
||||
}
|
||||
|
||||
virtual tFileType* addFile(vfs::Path const& sFilename, bool bDeleteOldFile=false) = 0;
|
||||
virtual bool addFile(typename tBaseClass::tFileType* pFile, bool bDeleteOldFile=false) = 0;
|
||||
|
||||
virtual bool createSubDirectory(vfs::Path const& sSubDirPath) = 0;
|
||||
virtual bool deleteDirectory(vfs::Path const& sDirPath) = 0;
|
||||
virtual bool deleteFileFromDirectory(vfs::Path const& sFileName) = 0;
|
||||
protected:
|
||||
const vfs::Path m_realPath;
|
||||
private:
|
||||
void operator=(TDirectory<WriteType> const& t);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _VFS_DIRECTORY_INTERFACE_H_
|
||||
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* bfVFS : vfs/Core/Interface/vfs_file_interface.h
|
||||
* - generic interface for read/write files
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VFS_FILE_INTERFACE_H_
|
||||
#define _VFS_FILE_INTERFACE_H_
|
||||
|
||||
#include <vfs/Core/vfs_types.h>
|
||||
#include <vfs/Core/vfs_path.h>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
/**
|
||||
* FileAttributes
|
||||
*/
|
||||
class VFS_API FileAttributes
|
||||
{
|
||||
public:
|
||||
enum Attributes {
|
||||
ATTRIB_INVALID = 0,
|
||||
ATTRIB_ARCHIVE = 1,
|
||||
ATTRIB_DIRECTORY = 2,
|
||||
ATTRIB_HIDDEN = 4,
|
||||
ATTRIB_NORMAL = 8,
|
||||
ATTRIB_READONLY = 16,
|
||||
ATTRIB_SYSTEM = 32,
|
||||
ATTRIB_TEMPORARY = 64,
|
||||
ATTRIB_COMPRESSED = 128,
|
||||
ATTRIB_OFFLINE = 256,
|
||||
};
|
||||
enum LocationType {
|
||||
LT_NONE = 0,
|
||||
LT_LIBRARY = 1,
|
||||
LT_DIRECTORY = 2,
|
||||
LT_READONLY_DIRECTORY = 4,
|
||||
};
|
||||
public:
|
||||
FileAttributes();
|
||||
FileAttributes(vfs::UInt32 attribs, LocationType location);
|
||||
|
||||
vfs::UInt32 getAttrib() const;
|
||||
vfs::UInt32 getLocation() const;
|
||||
|
||||
bool isAttribSet(vfs::UInt32 attribs) const;
|
||||
bool isAttribNotSet(vfs::UInt32 attribs) const;
|
||||
|
||||
bool isLocation(vfs::UInt32 location) const;
|
||||
private:
|
||||
void operator=(vfs::FileAttributes const& attr);
|
||||
|
||||
const vfs::UInt32 _attribs;
|
||||
const vfs::UInt32 _location;
|
||||
};
|
||||
|
||||
/**
|
||||
* IBaseFile
|
||||
*/
|
||||
class VFS_API IBaseFile
|
||||
{
|
||||
public:
|
||||
enum ESeekDir
|
||||
{
|
||||
SD_BEGIN,
|
||||
SD_CURRENT,
|
||||
SD_END,
|
||||
};
|
||||
public:
|
||||
IBaseFile(vfs::Path const& filename);
|
||||
virtual ~IBaseFile();
|
||||
|
||||
virtual vfs::FileAttributes getAttributes() = 0;
|
||||
|
||||
vfs::Path const& getName();
|
||||
virtual vfs::Path getPath();
|
||||
|
||||
virtual bool implementsWritable() = 0;
|
||||
virtual bool implementsReadable() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
virtual vfs::size_t getSize() = 0;
|
||||
|
||||
virtual bool _getRealPath(vfs::Path& path);
|
||||
protected:
|
||||
vfs::Path m_filename;
|
||||
};
|
||||
|
||||
/**
|
||||
* IReadType , IReadable
|
||||
*/
|
||||
class IReadType{};
|
||||
class IReadable : public vfs::IReadType
|
||||
{
|
||||
public:
|
||||
virtual bool isOpenRead() = 0;
|
||||
virtual bool openRead() = 0;
|
||||
virtual vfs::size_t read(vfs::Byte* data, vfs::size_t bytesToRead) = 0;
|
||||
|
||||
virtual vfs::size_t getReadPosition() = 0;
|
||||
virtual void setReadPosition(vfs::size_t positionInBytes) = 0;
|
||||
virtual void setReadPosition(vfs::offset_t offsetInBytes, vfs::IBaseFile::ESeekDir seekDir) = 0;
|
||||
};
|
||||
//class NonReadable : public IReadType{};
|
||||
|
||||
/**
|
||||
* IWriteType , IWritable
|
||||
*/
|
||||
class IWriteType{};
|
||||
class IWritable : public vfs::IWriteType
|
||||
{
|
||||
public:
|
||||
virtual bool isOpenWrite() = 0;
|
||||
virtual bool openWrite(bool createWhenNotExist = false, bool truncate = false) = 0;
|
||||
virtual vfs::size_t write(const vfs::Byte* data, vfs::size_t bytesToWrite) = 0;
|
||||
|
||||
virtual vfs::size_t getWritePosition() = 0;
|
||||
virtual void setWritePosition(vfs::size_t positionInBytes) = 0;
|
||||
virtual void setWritePosition(vfs::offset_t offsetInBytes, vfs::IBaseFile::ESeekDir seekDir) = 0;
|
||||
|
||||
virtual bool deleteFile() = 0;
|
||||
};
|
||||
//class NonWritable: public IWriteType{};
|
||||
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
|
||||
/**
|
||||
* IFileTemplate
|
||||
*/
|
||||
template<typename ReadType=vfs::IReadType, typename WriteType=vfs::IWriteType>
|
||||
class VFS_API TFileTemplate : public vfs::IBaseFile, public ReadType, public WriteType
|
||||
{
|
||||
public:
|
||||
typedef ReadType read_type;
|
||||
typedef WriteType write_type;
|
||||
|
||||
typedef vfs::TFileTemplate<read_type,vfs::IWritable> write_file_type;
|
||||
typedef vfs::TFileTemplate<vfs::IReadable,write_type> read_file_type;
|
||||
public:
|
||||
TFileTemplate(vfs::Path const& fileName)
|
||||
: vfs::IBaseFile(fileName), ReadType(), WriteType()
|
||||
{};
|
||||
virtual ~TFileTemplate()
|
||||
{};
|
||||
virtual bool implementsWritable()
|
||||
{
|
||||
return typeid(write_type) == typeid(vfs::IWritable);
|
||||
}
|
||||
virtual bool implementsReadable()
|
||||
{
|
||||
return typeid(read_type) == typeid(vfs::IReadable);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* TReadableFile
|
||||
*/
|
||||
template<class WriteType=vfs::IWriteType>
|
||||
class TReadableFile : public vfs::TFileTemplate<vfs::IReadable,WriteType>
|
||||
{
|
||||
typedef vfs::TFileTemplate<vfs::IReadable,WriteType> tBaseClass;
|
||||
public:
|
||||
typedef vfs::TReadableFile<WriteType> read_file_type;
|
||||
|
||||
/////////////////////////////////////////
|
||||
TReadableFile(vfs::Path const& sFilename)
|
||||
: tBaseClass(sFilename)
|
||||
{};
|
||||
virtual ~TReadableFile(){};
|
||||
|
||||
/////////////////////////////////////////
|
||||
read_file_type* operator=(vfs::IBaseFile const& t)
|
||||
{
|
||||
return read_file_type::cast(t);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
static read_file_type* cast(vfs::IBaseFile* bf)
|
||||
{
|
||||
if(bf && bf->implementsReadable())
|
||||
{
|
||||
return static_cast<read_file_type*>(bf);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
protected:
|
||||
TReadableFile();
|
||||
};
|
||||
|
||||
/**
|
||||
* TWritableFile
|
||||
*/
|
||||
template<class ReadType=vfs::IReadType>
|
||||
class TWritableFile : public vfs::TFileTemplate<ReadType,vfs::IWritable>
|
||||
{
|
||||
typedef vfs::TFileTemplate<ReadType,vfs::IWritable> tBaseClass;
|
||||
public:
|
||||
typedef vfs::TWritableFile<ReadType> write_file_type;
|
||||
|
||||
/////////////////////////////////////////
|
||||
TWritableFile(vfs::Path const& sFilename)
|
||||
: tBaseClass(sFilename)
|
||||
{};
|
||||
virtual ~TWritableFile(){};
|
||||
|
||||
/////////////////////////////////////////
|
||||
write_file_type& operator=(vfs::IBaseFile const& t)
|
||||
{
|
||||
return *write_file_type::cast(t);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
static write_file_type* cast(IBaseFile* bf)
|
||||
{
|
||||
if(bf && bf->implementsWritable())
|
||||
{
|
||||
return static_cast<write_file_type*>(bf);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
protected:
|
||||
TWritableFile();
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
|
||||
/**
|
||||
* typedef's
|
||||
*/
|
||||
typedef vfs::TReadableFile<vfs::IWriteType> tReadableFile;
|
||||
typedef vfs::TWritableFile<vfs::IReadable> tWritableFile;
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // _VFS_FILE_INTERFACE_H_
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* bfVFS : vfs/Core/Interface/vfs_iterator_interface.h
|
||||
* - generic interface to iterate over files in locations
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VFS_ITERATOR_INTERFACE_H_
|
||||
#define _VFS_ITERATOR_INTERFACE_H_
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
template<typename T>
|
||||
class VFS_API TIterator
|
||||
{
|
||||
public:
|
||||
class IImplementation
|
||||
{
|
||||
friend class TIterator<T>;
|
||||
public:
|
||||
virtual ~IImplementation() {};
|
||||
virtual T* value() = 0;
|
||||
virtual void next() = 0;
|
||||
protected:
|
||||
virtual IImplementation* clone() = 0;
|
||||
};
|
||||
public:
|
||||
TIterator() : _obj(NULL), _iter_impl(NULL) {};
|
||||
TIterator(IImplementation* impl) : _obj(NULL), _iter_impl(impl)
|
||||
{
|
||||
if(_iter_impl)
|
||||
{
|
||||
_obj = _iter_impl->value();
|
||||
}
|
||||
}
|
||||
~TIterator()
|
||||
{
|
||||
if(_iter_impl) delete _iter_impl;
|
||||
};
|
||||
TIterator& operator=(TIterator const& t)
|
||||
{
|
||||
_obj = t._obj;
|
||||
_iter_impl = NULL;
|
||||
if(t._iter_impl)
|
||||
{
|
||||
_iter_impl = t._iter_impl->clone();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
//////////////////////////////
|
||||
T* value() { return _obj; };
|
||||
bool end() { return _obj == NULL; };
|
||||
void next()
|
||||
{
|
||||
if(_iter_impl)
|
||||
{
|
||||
_iter_impl->next();
|
||||
_obj = _iter_impl->value();
|
||||
if(!_obj)
|
||||
{
|
||||
delete _iter_impl;
|
||||
_iter_impl = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
T* _obj;
|
||||
IImplementation* _iter_impl;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _VFS_ITERATOR_INTERFACE_H_
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* bfVFS : vfs/Core/Interface/vfs_library_interface.h
|
||||
* - partially implements Location interface for archive files
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VFS_LIBRARY_INTERFACE_H_
|
||||
#define _VFS_LIBRARY_INTERFACE_H_
|
||||
|
||||
#include <vfs/Core/Interface/vfs_location_interface.h>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
class VFS_API ILibrary : public vfs::TLocationTemplate<vfs::IReadable,vfs::IWriteType>
|
||||
{
|
||||
typedef vfs::TLocationTemplate<vfs::IReadable,vfs::IWriteType> tBaseClass;
|
||||
public:
|
||||
ILibrary(vfs::tReadableFile *libraryFile, vfs::Path const& mountPoint, bool ownFile = false);
|
||||
virtual ~ILibrary();
|
||||
|
||||
virtual bool init() = 0;
|
||||
virtual void closeLibrary() = 0;
|
||||
|
||||
virtual void close(tFileType *fileHandle) = 0;
|
||||
virtual bool openRead(tFileType *fileHandle) = 0;
|
||||
virtual vfs::size_t read(tFileType *fileHandle, vfs::Byte* data, vfs::size_t bytesToRead) = 0;
|
||||
|
||||
virtual vfs::size_t getReadPosition(tFileType *fileHandle) = 0;
|
||||
virtual void setReadPosition(tFileType *fileHandle, vfs::size_t positionInBytes) = 0;
|
||||
virtual void setReadPosition(tFileType *fileHandle, vfs::offset_t offsetInBytes, IBaseFile::ESeekDir seekDir) = 0;
|
||||
|
||||
virtual vfs::size_t getSize(tFileType *pFileHandle) = 0;
|
||||
|
||||
vfs::Path const& getName();
|
||||
protected:
|
||||
bool m_ownLibFile;
|
||||
vfs::tReadableFile* m_libraryFile;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // _VFS_LIBRARY_INTERFACE_H_
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* bfVFS : vfs/Core/Interface/vfs_location_interface.h
|
||||
* - generic Location interface that allows retrieval of a file from a real location
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VFS_LOCATION_INTERFACE_H_
|
||||
#define _VFS_LOCATION_INTERFACE_H_
|
||||
|
||||
#include <vfs/Core/vfs_types.h>
|
||||
#include <vfs/Core/vfs_debug.h>
|
||||
#include <vfs/Core/Interface/vfs_file_interface.h>
|
||||
#include <vfs/Core/Interface/vfs_iterator_interface.h>
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
class VFS_API IBaseLocation
|
||||
{
|
||||
public:
|
||||
typedef TIterator<vfs::IBaseFile> Iterator;
|
||||
|
||||
virtual ~IBaseLocation()
|
||||
{};
|
||||
|
||||
virtual bool implementsWritable() = 0;
|
||||
virtual bool implementsReadable() = 0;
|
||||
|
||||
virtual vfs::Path const& getPath() = 0;
|
||||
virtual bool fileExists(vfs::Path const& sFileName) = 0;
|
||||
virtual vfs::IBaseFile* getFile(vfs::Path const& sFileName) = 0;
|
||||
|
||||
virtual Iterator begin() = 0;
|
||||
virtual void getSubDirList(std::list<vfs::Path>& rlSubDirs) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* TLocation
|
||||
*/
|
||||
template<typename ReadType, typename WriteType>
|
||||
class VFS_API TLocationTemplate : public IBaseLocation
|
||||
{
|
||||
public:
|
||||
typedef vfs::TLocationTemplate<ReadType,WriteType> tLocationType;
|
||||
typedef vfs::TFileTemplate<ReadType,WriteType> tFileType;
|
||||
typedef ReadType tReadType;
|
||||
typedef WriteType tWriteType;
|
||||
typedef std::list<std::pair<tFileType*,vfs::Path> > tListFilesWithPath;
|
||||
public:
|
||||
TLocationTemplate(vfs::Path const& mountPoint)
|
||||
: m_mountPoint(mountPoint)
|
||||
{};
|
||||
virtual ~TLocationTemplate()
|
||||
{};
|
||||
|
||||
// has to be virtual , or the types of the caller (not the real object) will be tested
|
||||
virtual bool implementsWritable()
|
||||
{
|
||||
return typeid(tWriteType) == typeid(vfs::IWritable);
|
||||
}
|
||||
virtual bool implementsReadable()
|
||||
{
|
||||
return typeid(tReadType) == typeid(vfs::IReadable);
|
||||
}
|
||||
|
||||
vfs::Path const& getMountPoint()
|
||||
{
|
||||
return m_mountPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* TLocationTemplate interface
|
||||
*/
|
||||
virtual vfs::Path const& getPath()
|
||||
{
|
||||
return m_mountPoint;
|
||||
}
|
||||
|
||||
virtual bool fileExists(vfs::Path const& sFileName) = 0;
|
||||
virtual vfs::IBaseFile* getFile(vfs::Path const& sFileName) = 0;
|
||||
virtual tFileType* getFileTyped(vfs::Path const& rFileName) = 0;
|
||||
protected:
|
||||
vfs::Path m_mountPoint;
|
||||
};
|
||||
|
||||
/**************************************************************************************/
|
||||
/**************************************************************************************/
|
||||
|
||||
template<typename WriteType=vfs::IWriteType>
|
||||
class TReadLocation : public TLocationTemplate<IReadable,WriteType>
|
||||
{
|
||||
public:
|
||||
typedef TReadLocation<WriteType> tLocationType;
|
||||
|
||||
static tLocationType* cast(vfs::IBaseLocation* bl)
|
||||
{
|
||||
if(bl && bl->implementsReadable())
|
||||
{
|
||||
return static_cast<tLocationType*>(bl);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
public:
|
||||
TReadLocation(vfs::Path const& sLocalPath)
|
||||
: vfs::TLocationTemplate<IReadable,WriteType>(sLocalPath)
|
||||
{};
|
||||
virtual ~TReadLocation(){};
|
||||
};
|
||||
|
||||
template<typename ReadType=vfs::IReadType>
|
||||
class TWriteLocation : public vfs::TLocationTemplate<ReadType,vfs::IWritable>
|
||||
{
|
||||
public:
|
||||
typedef TWriteLocation<ReadType> tLocationType;
|
||||
|
||||
static tLocationType* cast(vfs::IBaseLocation* bl)
|
||||
{
|
||||
if(bl && bl->implementsWritable())
|
||||
{
|
||||
return static_cast<tLocationType*>(bl);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
public:
|
||||
TWriteLocation(vfs::Path const& sLocalPath)
|
||||
: vfs::TLocationTemplate<ReadType,vfs::IWritable>(sLocalPath)
|
||||
{};
|
||||
virtual ~TWriteLocation(){};
|
||||
};
|
||||
|
||||
/**************************************************************************************/
|
||||
/**************************************************************************************/
|
||||
|
||||
typedef TReadLocation<vfs::IWriteType> tReadLocation;
|
||||
typedef TWriteLocation<vfs::IReadType> tWriteLocation;
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // _VFS_LOCATION_INTERFACE_H_
|
||||
|
||||
Reference in New Issue
Block a user