File tree Expand file tree Collapse file tree 2 files changed +30
-23
lines changed Expand file tree Collapse file tree 2 files changed +30
-23
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,34 @@ std::string get_current_git_path()
24
24
// ->check(CLI::ExistingDirectory | CLI::NonexistentPath)
25
25
// ->default_val(std::filesystem::current_path());
26
26
27
- git_strarray git_strarray_wrapper::init_str_array ()
27
+ git_strarray_wrapper::git_strarray_wrapper (std::vector<std::string> m_patterns)
28
+ : m_patterns(std::move(m_patterns))
29
+ {
30
+ init_str_array ();
31
+ }
32
+
33
+ git_strarray_wrapper::git_strarray_wrapper (git_strarray_wrapper&& rhs)
34
+ : m_patterns(std::move(rhs.m_patterns))
35
+ {
36
+ init_str_array ();
37
+ }
38
+
39
+ git_strarray_wrapper::~git_strarray_wrapper ()
40
+ {
41
+ delete[] m_array.strings ;
42
+ }
43
+
44
+ git_strarray_wrapper::operator git_strarray*()
45
+ {
46
+ return &m_array;
47
+ }
48
+
49
+ void git_strarray_wrapper::init_str_array ()
28
50
{
29
51
git_strarray_wrapper aw;
30
52
git_strarray array{new char *[aw.m_patterns .size ()], aw.m_patterns .size ()};
31
53
for (size_t i=0 ; i<aw.m_patterns .size (); ++i)
32
54
{
33
55
array.strings [i] = const_cast <char *>(aw.m_patterns [i].c_str ());
34
56
}
35
- return array;
36
57
}
Original file line number Diff line number Diff line change @@ -68,34 +68,20 @@ class git_strarray_wrapper
68
68
: m_patterns{}
69
69
, m_array{nullptr , 0 }
70
70
{}
71
- git_strarray_wrapper (std::vector<std::string> m_patterns)
72
- : m_patterns(std::move(m_patterns))
73
- {
74
- init_str_array ();
75
- }
71
+ git_strarray_wrapper (std::vector<std::string> m_patterns);
76
72
77
73
git_strarray_wrapper (const git_strarray_wrapper&) = delete ;
78
74
git_strarray_wrapper& operator =(const git_strarray_wrapper&) = delete ;
79
75
80
- git_strarray_wrapper (git_strarray_wrapper&& rhs)
81
- : m_patterns(std::move(rhs.m_patterns))
82
- {
83
- init_str_array ();
84
- }
76
+ git_strarray_wrapper (git_strarray_wrapper&& rhs);
85
77
86
- ~git_strarray_wrapper ()
87
- {
88
- delete[] m_array.strings ;
89
- }
78
+ ~git_strarray_wrapper ();
90
79
91
- operator git_strarray*()
92
- {
93
- return &m_array;
94
- }
95
-
96
- static git_strarray init_str_array ();
80
+ operator git_strarray*();
97
81
98
- protected :
82
+ private :
99
83
std::vector<std::string> m_patterns;
100
84
git_strarray m_array;
85
+
86
+ void init_str_array ();
101
87
};
You can’t perform that action at this time.
0 commit comments