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)


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