mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
*** Merged Code from Multiplayer Branch Revision 2960 ***
- 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
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#ifndef _VFS_PROFILE_H_
|
||||
#define _VFS_PROFILE_H_
|
||||
|
||||
#include "vfs_types.h"
|
||||
#include "Interface/vfs_location_interface.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
class CVirtualProfile
|
||||
{
|
||||
typedef std::map<vfs::Path,vfs::IBaseLocation*, vfs::Path::Less> tLocations;
|
||||
typedef std::set<vfs::IBaseLocation*> tUniqueLoc;
|
||||
public:
|
||||
//////////////////////////////////////////////
|
||||
class Iterator
|
||||
{
|
||||
friend class CVirtualProfile;
|
||||
private:
|
||||
Iterator(CVirtualProfile& rProf);
|
||||
public:
|
||||
Iterator();
|
||||
~Iterator();
|
||||
//////
|
||||
vfs::IBaseLocation* value() const;
|
||||
void next();
|
||||
bool end() const;
|
||||
private:
|
||||
CVirtualProfile* m_pProf;
|
||||
tUniqueLoc::iterator _loc_iter;
|
||||
};
|
||||
//////////////////////////////////////////////
|
||||
friend class Iterator;
|
||||
public:
|
||||
CVirtualProfile(utf8string const& sProfileName, bool bWriteable = false);
|
||||
~CVirtualProfile();
|
||||
|
||||
const utf8string Name;
|
||||
const bool Writeable;
|
||||
|
||||
Iterator begin();
|
||||
|
||||
void AddLocation(vfs::IBaseLocation* pLoc);
|
||||
vfs::IBaseLocation* GetLocation(vfs::Path const& sPath) const;
|
||||
vfs::IBaseFile* GetFile(vfs::Path const& sPath) const;
|
||||
private:
|
||||
tLocations m_mapLocations;
|
||||
tUniqueLoc m_setLocations;
|
||||
};
|
||||
|
||||
class CProfileStack
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////
|
||||
class Iterator
|
||||
{
|
||||
friend class CProfileStack;
|
||||
private:
|
||||
Iterator(CProfileStack& rPStack);
|
||||
public:
|
||||
Iterator();
|
||||
~Iterator();
|
||||
//////
|
||||
CVirtualProfile* value() const;
|
||||
void next();
|
||||
bool end() const;
|
||||
private:
|
||||
CProfileStack* m_pPStack;
|
||||
std::list<CVirtualProfile*>::iterator _prof_iter;
|
||||
};
|
||||
//////////////////////////////////////////////
|
||||
friend class Iterator;
|
||||
public:
|
||||
CProfileStack();
|
||||
~CProfileStack();
|
||||
|
||||
CVirtualProfile* GetWriteProfile();
|
||||
CVirtualProfile* GetProfile(utf8string const& sName) const;
|
||||
|
||||
CVirtualProfile* TopProfile() const;
|
||||
/**
|
||||
* All files from the top profile will be removed from the VFS and the profile object will be deleted.
|
||||
*/
|
||||
bool PopProfile();
|
||||
void PushProfile(CVirtualProfile* pProfile);
|
||||
|
||||
Iterator begin();
|
||||
private:
|
||||
std::list<CVirtualProfile*> m_lProfiles;
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user