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