SlHelpers
Toggle main menu visibility
Loading...
Searching...
No Matches
StrArray.h
1
// SPDX-License-Identifier: GPL-2.0-only
2
3
#pragma once
4
5
#include <string>
6
#include <vector>
7
8
#include <git2.h>
9
10
namespace
SlGit {
11
15
class
StrArray
{
16
public
:
18
StrArray
(
const
std::vector<std::string> &vec) {
19
for
(
const
auto
&entry : vec)
20
strings.push_back(entry.c_str());
21
m_array.strings =
const_cast<
char
**
>
(strings.data());
22
m_array.count = strings.size();
23
}
24
26
const
git_strarray *
array
()
const
{
return
&m_array; }
28
operator
const
git_strarray *()
const
{
return
&m_array; }
29
private
:
30
std::vector<const char *> strings;
31
git_strarray m_array;
32
};
33
34
}
SlGit::StrArray::array
const git_strarray * array() const
Get the stored pointer to libgit2's git_strarray.
Definition
StrArray.h:26
SlGit::StrArray::StrArray
StrArray(const std::vector< std::string > &vec)
Constructs a StrArray from vec (must outlive StrArray).
Definition
StrArray.h:18
include
git
StrArray.h
Generated by
1.17.0