#ifndef __DEPOT_H__
#define __DEPOT_H__
#include "IUpdateable.h"
#include "DirEntry.h"
#include "P4Item.h"
namespace Perforce {
class Depot;
typedef QList< Depot > DepotList;
// typedef QGuardedPtr< Depot > DepotPtr;
// TODO: Replace with safe reference counted/guarded wrapper.
typedef Depot* DepotPtr;
class Depot : public P4Item {
public:
inline const QString& getMap()
{ return _map; }
inline const QString& getType()
{ return _type; }
const DirEntryList& getDirEntries( bool forceFlush = false );
DirEntry* getDirEntry( const QString& fullPath, bool forceFlush = false );
static DepotPtr getDepot( const QString& name );
static const DepotList& getDepots( bool forceFlush = false );
private:
Depot() { _dirsListCache._parent = this; }
Depot( const Depot& d ) { }
QString _type;
QString _address;
QString _map;
QList< DirEntry > _dirs;
struct DepotListCache : public IUpdateable< Perforce::DepotList > {
void HandleError( Error* err );
void updateCache();
void OutputInfo( char level, char *data );
};
struct DirsListCache : public IUpdateable< Perforce::DirEntryList > {
DirEntry* getDirEntry( const QString& path, bool forceFlush = false );
void HandleError( Error* err );
void updateCache();
void OutputStat( StrDict *varList );
Depot* _parent;
};
friend DepotListCache;
friend DirsListCache;
DirsListCache _dirsListCache;
static DepotListCache _depotListCache;
};
}
#endif