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 (1272B)


0 #pragma once
2 #include <filesystem>
3 #include <string>
4 #include <vector>
6 #include <git2wrap/repository.hpp>
8 #include "branch.hpp"
9 #include "tag.hpp"
11 namespace startgit
12 {
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;
24 const auto& get() const { return m_repo; }
25 const auto& get_path() const { return m_path; }
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; }
32 const auto& get_branches() const { return m_branches; }
33 const auto& get_tags() const { return m_tags; }
35 private:
36 static std::string read_file(
37 const std::filesystem::path& base, const char* file
38 );
40 std::filesystem::path m_path;
41 git2wrap::repository m_repo;
43 std::string m_name;
45 std::string m_url;
46 std::string m_owner;
47 std::string m_description;
49 std::vector<branch> m_branches;
50 std::vector<tag> m_tags;
51 };
53 } // namespace startgit