SlHelpers
SlGit::Tree Class Reference

Tree is a representation of a git tree. More...

#include <Tree.h>

Inheritance diagram for SlGit::Tree:
SlGit::TypedObject< git_tree > SlGit::Object

Public Types

using WalkCallback = const std::function< int(const std::string &root, const TreeEntry &entry)>
 A callback for walk()
 

Public Member Functions

size_t entryCount () const noexcept
 Get count of entries in this Tree.
 
bool walk (const WalkCallback &CB, const git_treewalk_mode &mode=GIT_TREEWALK_PRE) const
 Walk this Tree and call CB for every entry.
 
std::optional< TreeEntrytreeEntryByPath (const std::string &path) const noexcept
 Get an entry corresponding to path.
 
TreeEntry treeEntryByIndex (size_t idx) const noexcept
 Get an entry on the idx-th position.
 
std::optional< std::string > catFile (const std::string &file) const noexcept
 Cat a file in this Tree.
 
GitTy * tree () const noexcept
 Get the stored pointer to libgit2's git_tree.
 
- Public Member Functions inherited from SlGit::TypedObject< git_tree >
git_object * object () const noexcept override
 Get a pointer to the generic git_object.
 
 operator git_tree * () const noexcept
 Alias for typed()
 
- Public Member Functions inherited from SlGit::Object
const git_oid * id () const noexcept
 Get OID (SHA) of this Object.
 
std::string idStr () const noexcept
 Get OID (SHA) of this Object – as a string.
 
git_object_t type () const noexcept
 Get Type of this Object.
 
std::string typeStr () const noexcept
 Get Type of this Object – as a string.
 
const Reporepo () const
 Get the Repo this Object lives in.
 
bool operator== (const Object &other) const noexcept
 Compare two Objects (their SHAs)
 
bool operator!= (const Object &other) const noexcept
 Compare two Objects (their SHAs)
 

Friends

class Commit
 
class Repo
 
class Tag
 

Additional Inherited Members

- Protected Member Functions inherited from SlGit::TypedObject< git_tree >
 TypedObject (const Repo &repo, git_tree *typed) noexcept
 Construct a new TypedObject.
 
git_tree * typed () const noexcept
 Get the stored pointer typed to one of libgit2's types.
 
- Protected Member Functions inherited from SlGit::Object
 Object (const Repo &repo)
 Constuct a new Object.
 

Detailed Description

Tree is a representation of a git tree.


The documentation for this class was generated from the following file: