#ifndef __BRANCHSPEC_H__
#define __BRANCHSPEC_H__
#include "IUpdateable.h"
#include <qdatetime.h>
#include <qlist.h>
#include <qlistview.h>
#include <qstring.h>
namespace Perforce {
class BranchSpec;
typedef QList< BranchSpec > BranchSpecList;
typedef enum Lock {
Locked,
Unlocked
};
class BranchSpec {
public:
BranchSpec();
BranchSpec( const QString& branchName,
const QString& owner,
Lock l,
const QDate& date,
const QString& desc ) :
_branchName( branchName ),
_owner( owner ),
_lock( l ),
_date( date ),
_description( desc ) { }
virtual ~BranchSpec();
inline const QString& getBranchName( void ) const;
inline const QString& getOwner( void ) const;
inline const Lock getLock( void ) const;
inline const QDate& getDate( void ) const;
inline const QString& getDescription( void ) const;
public:
static BranchSpec* createBranchSpec( const QString& p4output );
static QString lockToString( Lock l );
static const BranchSpecList& getBranches();
private:
QString _branchName;
QString _owner;
Lock _lock;
QDate _date;
QString _description;
private:
struct BranchSpecCache : IUpdateable< Perforce::BranchSpecList > {
BranchSpecCache();
void updateCache();
};
static BranchSpecCache _branchSpecCache;
};
inline const QString& BranchSpec::getBranchName( void ) const
{
return _branchName;
}
inline const QString& BranchSpec::getOwner( void ) const
{
return _owner;
}
inline const Lock BranchSpec::getLock( void ) const
{
return _lock;
}
inline const QDate& BranchSpec::getDate( void ) const
{
return _date;
}
inline const QString& BranchSpec::getDescription( void ) const
{
return _description;
}
} // end namespace
#endif