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)


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