17 Buf() : m_buf(GIT_BUF_INIT) {}
18 ~Buf() { git_buf_dispose(&m_buf); }
20 Buf(
const Buf &other) =
delete;
21 Buf operator=(
const Buf &other) =
delete;
24 Buf(Buf &&other) noexcept : m_buf(other.m_buf) { other.m_buf = GIT_BUF_INIT; }
28 git_buf_dispose(&m_buf);
30 other.m_buf = GIT_BUF_INIT;
36 std::string_view
sv() const noexcept {
return std::string_view(m_buf.ptr, m_buf.size); }
38 std::string
str() const noexcept {
return std::string(m_buf.ptr, m_buf.size); }
41 git_buf &
buf() {
return m_buf; }
43 const git_buf &
buf()
const {
return m_buf; }
45 operator const git_buf *()
const {
return &m_buf; }
Buf(Buf &&other) noexcept
Move constructor.
Definition Buf.h:24
git_buf & buf()
Get the stored libgit2's git_buf.
Definition Buf.h:41
std::string str() const noexcept
Get this Buf as a string.
Definition Buf.h:38
Buf & operator=(Buf &&other) noexcept
Move assignment.
Definition Buf.h:26
std::string_view sv() const noexcept
Get this Buf as a string_view.
Definition Buf.h:36
const git_buf & buf() const
Get the stored libgit2's git_buf.
Definition Buf.h:43