10 #include <Wt/WAbstractItemModel> 100 int role = Wt::DisplayRole)
const;
102 using WAbstractItemModel::data;
117 : parentId(aParent), index(anIndex) { }
124 else return index < other.
index;
137 : index_(parentId, index),
152 int index()
const {
return index_.index; }
209 #endif // GIT_MODEL_H_ void setRepositoryPath(const std::string &repositoryPath)
Set the repository and load its 'master' revision.
Tree(int parentId, int index, const Git::ObjectId &object, int rowCount)
Constructor.
GitModel(Wt::WObject *parent=0)
Constructor.
Index usable as a key to a map, that identifies a child/row within a tree.
int getTreeId(int parentId, int childIndex) const
Get or allocate an id for a folder.
virtual boost::any data(const Wt::WModelIndex &index, int role=Wt::DisplayRole) const
Returns data.
Git git_
The git repository.
const Git::ObjectId & treeObject() const
Returns the SHA1 id for the git tree object.
bool operator<(const ChildIndex &other) const
virtual int rowCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
Returns the row count.
static const int ContentsRole
The role which may be used on a file to retrieve its contents.
int index() const
Returns the child index within the parent folder.
Git::ObjectId treeObject_
Git utility class for browsing git archives.
int rowCount() const
Returns the (cached) row count.
ChildIndex(int aParent, int anIndex)
ChildPointerMap childPointer_
Maps child indexes to tree indexes.
virtual Wt::WModelIndex parent(const Wt::WModelIndex &index) const
Returns the parent index.
Git::Object getObject(const Wt::WModelIndex &index) const
Get the Git::Object that corresponds to an index.
virtual boost::any headerData(int section, Wt::Orientation orientation=Wt::Horizontal, int role=Wt::DisplayRole) const
Returns header data.
std::map< ChildIndex, int > ChildPointerMap
static const int FilePathRole
int parentId() const
Returns the parent id.
A model that retrieves revision trees from a git repository.
std::vector< Tree > treeData_
List of folder objects.
void loadRevision(const std::string &revName)
Load a particular revision.
virtual Wt::WModelIndex index(int row, int column, const Wt::WModelIndex &parent=Wt::WModelIndex()) const
Returns a child index.
virtual int columnCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
Returns the column count.
Used to uniquely locate a folder within the folder hierarchy.