Debian Codegraph @

plugins/vcs/Signature.h

raw
1 #pragma once
2
3 #include <git2.h>
4
5 #include "GitException.h"
6
7 namespace vcs
8 {
9
10 namespace git
11 {
12
13 class Signature final
14 {
15 private:
16 git_signature* _signature;
17 public:
18 Signature(const std::string& name, const std::string& email) :
19 _signature(nullptr)
20 {
21 auto error = git_signature_now(&_signature, name.c_str(), email.c_str());
22 GitException::ThrowOnError(error);
23 }
24
25 git_signature* get()
26 {
27 return _signature;
28 }
29
30 ~Signature()
31 {
32 if (_signature != nullptr)
33 {
34 git_signature_free(_signature);
35 }
36 }
37 };
38
39 }
40
41 }