startgit

Static page generator for git repositories
git clone git://git.dimitrijedobrota.com/startgit.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

repository.hpp (1293B)


0 #pragma once 1 2 #include <filesystem> 3 #include <string> 4 #include <vector> 5 6 #include <git2wrap/repository.hpp> 7 8 #include "branch.hpp" 9 #include "tag.hpp" 10 11 namespace startgit 12 { 13 14 class repository 15 { 16 public: 17 explicit repository(const std::filesystem::path& path); 18 repository(const repository&) = delete; 19 repository& operator=(const repository&) = delete; 20 repository(repository&&) = default; 21 repository& operator=(repository&&) = default; 22 ~repository() = default; 23 24 const auto& get() const { return m_repo; } 25 const auto& get_path() const { return m_path; } 26 27 const std::string& get_url() const { return m_url; } 28 const std::string& get_name() const { return m_name; } 29 const std::string& get_owner() const { return m_owner; } 30 const std::string& get_description() const { return m_description; } 31 32 const auto& get_branches() const { return m_branches; } 33 const auto& get_tags() const { return m_tags; } 34 35 private: 36 static std::string read_file(const std::filesystem::path& base, 37 const char* file); 38 39 std::filesystem::path m_path; 40 git2wrap::repository m_repo; 41 42 std::string m_name; 43 44 std::string m_url; 45 std::string m_owner; 46 std::string m_description; 47 48 std::vector<branch> m_branches; 49 std::vector<tag> m_tags; 50 }; 51 52 } // namespace startgit