FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
git2cpp/src/wrapper/refs_wrapper.hpp at main · QuantStack/git2cpp · GitHub
QuantStack
git2cpp
Repository navigation
Code
Issues
6
(6)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
git2cpp
/
src
/
wrapper
/
refs_wrapper.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (48 loc) · 1.45 KB
Breadcrumbs
git2cpp
/
src
/
wrapper
/
refs_wrapper.hpp
Copy path
File metadata and controls
63 lines (48 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
pragma
once
#
include
<
concepts
>
#
include
<
string
>
#
include
<
git2.h
>
#
include
"
../utils/git_exception.hpp
"
#
include
"
../wrapper/object_wrapper.hpp
"
#
include
"
../wrapper/wrapper_base.hpp
"
class
reference_wrapper
:
public
wrapper_base
<git_reference>
{
public:
using
base_type = wrapper_base<git_reference>;
~reference_wrapper
();
reference_wrapper
(reference_wrapper&&)
noexcept
=
default
;
reference_wrapper&
operator
=(reference_wrapper&&)
noexcept
=
default
;
std::string
short_name
()
const
;
bool
is_remote
()
const
;
bool
is_branch
()
const
;
const
git_oid*
target
()
const
;
reference_wrapper
write_new_ref
(
const
git_oid target_oid);
template
<
class
W
>
W
peel
()
const
;
private:
reference_wrapper
(git_reference* ref);
friend
class
repository_wrapper
;
};
class
commit_wrapper
;
class
object_wrapper
;
//
TODO: add constraints on W
//
For now it accepts commit_wrapper and object_wrapper only
template
<
class
W
>
W
reference_wrapper::peel
()
const
{
constexpr
git_object_t
obj_type = []
{
if
constexpr
(std::same_as<W, commit_wrapper>)
{
return
GIT_OBJECT_COMMIT
;
}
else
//
Default case
{
return
GIT_OBJECT_ANY
;
}
}();
using
resource_type =
typename
W::resource_type;
git_object* resource =
nullptr
;
throw_if_error
(
git_reference_peel
(&resource,
this
->
p_resource
, obj_type));
return
W
(
reinterpret_cast
<resource_type*>(resource));
}
Back
|
FazBrowse Home
|
New Git URL