forked from p-ranav/cppgit2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblob.hpp
More file actions
51 lines (37 loc) · 1.04 KB
/
Copy pathblob.hpp
File metadata and controls
51 lines (37 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <cppgit2/data_buffer.hpp>
#include <cppgit2/git_exception.hpp>
#include <cppgit2/libgit2_api.hpp>
#include <cppgit2/oid.hpp>
namespace cppgit2 {
using blob_size = git_off_t;
// Always owned by user
// Free'd in destructor
class blob : public libgit2_api {
public:
// Default construct a blob
blob();
// Construct a blob from libgit2 C ptr
// Calls git_blob_dup to create a duplicate
blob(const git_blob* c_ptr);
// Free blob with git_blob_free
~blob();
// Owner repository
class repository owner() const;
// Create an in-memory copy of a blob
blob copy() const;
// SHA1 hash for this blob
oid id() const;
// Determine if the blob content is binary or not
bool is_binary() const;
// Get read-only buffer with raw contents of this blob
const void* raw_contents() const;
// Get size in bytes of the contents of this blob
blob_size raw_size() const;
// Access libgit2 C ptr
const git_blob* c_ptr() const;
private:
friend class repository;
git_blob* c_ptr_;
};
} // namespace cppgit2