Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
php-git2/refdb.h at master · RogerGee/php-git2 · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
RogerGee
php-git2
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
php-git2
/
refdb.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
188 lines (158 loc) · 5.01 KB
master
Breadcrumbs
php-git2
/
refdb.h
Copy path
Top
File metadata and controls
Code
Blame
188 lines (158 loc) · 5.01 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
* refdb.h
*
* Copyright (C) Roger P. Gee
*/
#
ifndef
PHPGIT2_REFDB_H
#
define
PHPGIT2_REFDB_H
#
include
"
stubs/refdb_arginfo.h
"
namespace
php_git2
{
//
Explicitly specialize git2_resource destructor for git_repository.
template
<>
php_git_refdb::~git2_resource
()
{
git_refdb_free
(handle);
}
//
Provide type for passing/returning git_refdb_backends.
class
php_git_refdb_backend
:
public php_object<php_refdb_backend_object>
{
public:
//
Make this object a connector to a php_resource that looks up a
//
php_git_refdb resource wrapper object.
using
connect_t
= php_resource<php_git_refdb>;
using
target_t
= git_refdb_backend*;
php_git_refdb_backend
(
connect_t
& conn):
ownerWrapper
(conn)
{
}
git_refdb_backend*
byval_git2
()
{
php_refdb_backend_object* object =
get_storage
();
//
If the object doesn't have a backing, then we create a custom
//
one.
if
(object->
backend
==
nullptr
) {
object->
create_custom_backend
(
get_value
());
}
//
If the object has a custom backing then it is (presumably)
//
already set on a refdb. (The same is true if the owner is already
//
set.)
else
if
(object->
kind
!= php_refdb_backend_object::user
|| object->
owner
!=
nullptr
)
{
throw
php_git2_exception
(
"
The refdb backend is already set on a refdb
"
);
}
//
Otherwise the object is a user backend and we make it into a
//
conventional backend.
else
{
object->
create_conventional_backend
(ownerWrapper.
get_object
());
}
return
object->
backend
;
}
private:
connect_t
& ownerWrapper;
};
class
php_git_refdb_backend_ref
{
public:
php_git_refdb_backend_ref
():
backend
(
nullptr
)
{
}
git_refdb_backend**
byval_git2
()
{
return
&backend;
}
void
ret
(zval* return_value)
{
php_git2_make_refdb_backend
(return_value,backend,
nullptr
);
}
private:
git_refdb_backend* backend;
};
using
php_git_refdb_backend_connector = connector_wrapper<php_git_refdb_backend>;
}
//
namespace php_git2
//
Function templates:
static
constexpr
auto
ZIF_git_refdb_backend_fs = zif_php_git2_function<
php_git2::func_wrapper<
int
,
git_refdb_backend**,
git_repository*>::func<git_refdb_backend_fs>,
php_git2::local_pack<
php_git2::php_git_refdb_backend_ref,
php_git2::php_resource<php_git2::php_git_repository>
>,
1
,
php_git2::sequence<
1
>,
php_git2::sequence<
0
,
1
>
>;
static
constexpr
auto
ZIF_git_refdb_compress = zif_php_git2_function<
php_git2::func_wrapper<
int
,
git_refdb*>::func<git_refdb_compress>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_refdb>
>
>;
static
constexpr
auto
ZIF_git_refdb_free = zif_php_git2_function_free<
php_git2::local_pack<
php_git2::php_resource_cleanup<php_git2::php_git_refdb>
>
>;
static
constexpr
auto
ZIF_git_refdb_new = zif_php_git2_function_setdeps<
php_git2::func_wrapper<
int
,
git_refdb**,
git_repository*>::func<git_refdb_new>,
php_git2::local_pack<
php_git2::php_resource_ref<php_git2::php_git_refdb>,
php_git2::php_resource<php_git2::php_git_repository>
>,
php_git2::sequence<
0
,
1
>,
//
Make the git_refdb dependent on the repository.
1
,
php_git2::sequence<
1
>,
php_git2::sequence<
0
,
1
>
>;
static
constexpr
auto
ZIF_git_refdb_open = zif_php_git2_function_setdeps<
php_git2::func_wrapper<
int
,
git_refdb**,
git_repository*>::func<git_refdb_open>,
php_git2::local_pack<
php_git2::php_resource_ref<php_git2::php_git_refdb>,
php_git2::php_resource<php_git2::php_git_repository>
>,
php_git2::sequence<
0
,
1
>,
//
Make the git_refdb dependent on the repository.
1
,
php_git2::sequence<
1
>,
php_git2::sequence<
0
,
1
>
>;
static
constexpr
auto
ZIF_git_refdb_set_backend = zif_php_git2_function<
php_git2::func_wrapper<
int
,
git_refdb*,
git_refdb_backend*>::func<git_refdb_set_backend>,
php_git2::local_pack<
php_git2::php_git_refdb_backend_connector,
php_git2::php_resource<php_git2::php_git_refdb>
>,
-
1
,
php_git2::sequence<
1
,
0
>,
php_git2::sequence<
1
,
0
>
>;
//
Function entries:
#
define
GIT_REFDB_FE
\
PHP_GIT2_FE
(git_refdb_backend_fs) \
PHP_GIT2_FE(git_refdb_compress) \
PHP_GIT2_FE(git_refdb_free) \
PHP_GIT2_FE(git_refdb_new) \
PHP_GIT2_FE(git_refdb_open) \
PHP_GIT2_FE(git_refdb_set_backend)
#
endif
/*
* Local Variables:
* mode:c++
* indent-tabs-mode:nil
* tab-width:4
* End:
*/
You can’t perform that action at this time.