mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Virtual File System (VFS) by birdflu. This is needed for Multiplayer and is also used for Single Player. Very neat system :-) - Multiplayer Version 1.1 + some additional features and bugfixes * INFO: If you compile a new EXE and want to test, be sure to also use the latest SVN GameDir files in your JA2 install directory * git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2961 3b4a5df2-a311-0410-b5c6-a8a6f20db521
71 lines
1.8 KiB
C++
71 lines
1.8 KiB
C++
#ifndef _VFS_DIRECTORY_H_
|
|
#define _VFS_DIRECTORY_H_
|
|
|
|
#include "../vfs_types.h"
|
|
//#include "Interface/vfs_location_interface.h"
|
|
#include "../Interface/vfs_file_interface.h"
|
|
#include "../Interface/vfs_directory_interface.h"
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace vfs
|
|
{
|
|
|
|
/**
|
|
* IDirectory<read,write>
|
|
*/
|
|
class CDirectoryTree : public vfs::IDirectory<vfs::IWriteable>
|
|
{
|
|
typedef std::map<vfs::Path, vfs::IDirectory<CDirectoryTree::tWriteType>*, vfs::Path::Less> tDirCatalogue;
|
|
|
|
class IterImpl : public tClassType::Iterator::IImplemetation
|
|
{
|
|
public:
|
|
IterImpl(CDirectoryTree& tree);
|
|
virtual ~IterImpl();
|
|
virtual tFileType* value();
|
|
virtual void next();
|
|
private:
|
|
CDirectoryTree& _tree;
|
|
tDirCatalogue::iterator _subdir_iter;
|
|
tClassType::Iterator _file_iter;
|
|
};
|
|
public:
|
|
CDirectoryTree(vfs::Path const& sMountPoint, vfs::Path const& sRealPath)
|
|
: vfs::IDirectory<vfs::IWriteable>(sMountPoint,sRealPath)
|
|
{};
|
|
virtual ~CDirectoryTree();
|
|
|
|
bool Init();
|
|
|
|
/**
|
|
* IDirectory interface
|
|
*/
|
|
virtual tFileType* AddFile(vfs::Path const& sFilename, bool bDeleteOldFile=false);
|
|
virtual bool AddFile(tFileType* pFile, bool bDeleteOldFile=false);
|
|
|
|
virtual bool CreateSubDirectory(vfs::Path const& sSubDirPath);
|
|
virtual bool DeleteDirectory(vfs::Path const& sDirPath);
|
|
virtual bool DeleteFileFromDirectory(vfs::Path const& sFileName);
|
|
|
|
/**
|
|
* IVFSLocation interface
|
|
*/
|
|
virtual bool FileExists(vfs::Path const& sFileName);
|
|
virtual vfs::IBaseFile* GetFile(vfs::Path const& sFileName);
|
|
virtual tFileType* GetFileTyped(vfs::Path const& sFileName);
|
|
virtual void GetSubDirList(std::list<vfs::Path>& rlSubDirs);
|
|
|
|
virtual Iterator begin();
|
|
protected:
|
|
tDirCatalogue m_catDirs;
|
|
};
|
|
|
|
|
|
|
|
|
|
} // end namespace
|
|
|
|
#endif // _VFS_DIRECTORY_H_
|