-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcommon.hpp
More file actions
81 lines (55 loc) · 1.68 KB
/
common.hpp
File metadata and controls
81 lines (55 loc) · 1.68 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include <string>
#include <vector>
#include <git2.h>
class noncopyable_nonmovable
{
public:
noncopyable_nonmovable(const noncopyable_nonmovable&) = delete;
noncopyable_nonmovable& operator=(const noncopyable_nonmovable&) = delete;
noncopyable_nonmovable(noncopyable_nonmovable&&) = delete;
noncopyable_nonmovable& operator=(noncopyable_nonmovable&&) = delete;
protected:
noncopyable_nonmovable() = default;
~noncopyable_nonmovable() = default;
};
class libgit2_object : private noncopyable_nonmovable
{
public:
libgit2_object();
~libgit2_object();
};
std::string get_current_git_path();
struct status_messages
{
std::string short_mod;
std::string long_mod;
};
status_messages get_status_msg(git_status_t);
using stream_colour_fn = std::ostream& (*) (std::ostream&);
class git_strarray_wrapper
{
public:
git_strarray_wrapper()
: m_patterns{}
, m_array{nullptr, 0}
{
}
git_strarray_wrapper(std::vector<std::string> patterns);
git_strarray_wrapper(const git_strarray_wrapper&) = delete;
git_strarray_wrapper& operator=(const git_strarray_wrapper&) = delete;
git_strarray_wrapper(git_strarray_wrapper&& rhs);
git_strarray_wrapper& operator=(git_strarray_wrapper&&);
~git_strarray_wrapper();
operator git_strarray*();
size_t size();
private:
std::vector<std::string> m_patterns;
git_strarray m_array;
void reset_str_array();
void init_str_array();
};
std::string read_file(const std::string& path);
std::vector<std::string> split_input_at_newlines(std::string_view str);
// Remove whitespace from start and end of a string.
std::string trim(const std::string& str);