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

file.hpp (629B)


0 #pragma once
2 #include <filesystem>
3 #include <string>
5 #include <git2wrap/blob.hpp>
6 #include <git2wrap/tree.hpp>
8 namespace startgit
9 {
11 class file
12 {
13 public:
14 file(const git2wrap::tree_entry& entry, std::filesystem::path path);
16 std::string get_filemode() const { return m_filemode; }
17 std::filesystem::path get_path() const { return m_path; }
19 bool is_binary() const;
20 const char* get_content() const;
21 git2wrap::object_size_t get_size() const;
22 int get_lines() const;
24 private:
25 std::string m_filemode;
26 std::filesystem::path m_path;
27 git2wrap::blob m_blob;
29 mutable int m_lines = -1;
30 };
32 } // namespace startgit