-
Notifications
You must be signed in to change notification settings - Fork 1
/
packbuilder.h
272 lines (241 loc) · 8.12 KB
/
packbuilder.h
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/*
* packbuilder.h
*
* Copyright (C) Roger P. Gee
*/
#ifndef PHPGIT2_PACKBUILDER_H
#define PHPGIT2_PACKBUILDER_H
#include "stubs/packbuilder_arginfo.h"
namespace php_git2
{
// Specialize resource destructor for git_packbuilder
template<> inline php_git_packbuilder::~git2_resource()
{
git_packbuilder_free(handle);
}
class php_git_packbuilder_with_callback;
// Define shortcut to packbuilder async type.
using packbuilder_async_callback_t = php_git2::php_callback_async_existing<
php_git_packbuilder_with_callback,
php_callback_sync_nullable
>;
class php_git_packbuilder_with_callback:
public php_git_packbuilder
{
friend packbuilder_async_callback_t;
public:
php_git_packbuilder_with_callback():
cb(nullptr)
{
}
virtual ~php_git_packbuilder_with_callback()
{
// Free callback object.
if (cb != nullptr) {
cb->~php_callback_sync();
efree(cb);
}
}
private:
php_callback_sync* cb;
};
} // namespace php_git2
// Functions:
static constexpr auto ZIF_git_packbuilder_new = zif_php_git2_function_setdeps<
php_git2::func_wrapper<
int,
git_packbuilder**,
git_repository*>::func<git_packbuilder_new>,
php_git2::local_pack<
php_git2::php_resource_ref<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_resource<php_git2::php_git_repository>
>,
php_git2::sequence<0,1>,
1,
php_git2::sequence<1>,
php_git2::sequence<0,1>
>;
static constexpr auto ZIF_git_packbuilder_free = zif_php_git2_function_free<
php_git2::local_pack<
php_git2::php_resource_cleanup<php_git2::php_git_packbuilder_with_callback>
>
>;
static constexpr auto ZIF_git_packbuilder_hash = zif_php_git2_function<
php_git2::func_wrapper<
const git_oid*,
git_packbuilder*>::func<git_packbuilder_hash>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>
>,
0
>;
static constexpr auto ZIF_git_packbuilder_insert_commit = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
const git_oid*>::func<git_packbuilder_insert_commit>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_git_oid_fromstr
>
>;
static constexpr auto ZIF_git_packbuilder_insert_walk = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
git_revwalk*>::func<git_packbuilder_insert_walk>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_resource<php_git2::php_git_revwalk>
>
>;
static constexpr auto ZIF_git_packbuilder_insert_recur = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
const git_oid*,
const char*
>::func<git_packbuilder_insert_recur>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_git_oid_fromstr,
php_git2::php_string_nullable
>
>;
static constexpr auto ZIF_git_packbuilder_insert_tree = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
const git_oid*
>::func<git_packbuilder_insert_tree>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_git_oid_fromstr
>
>;
static constexpr auto ZIF_git_packbuilder_insert = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
const git_oid*,
const char*>::func<git_packbuilder_insert>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_git_oid_fromstr,
php_git2::php_string_nullable
>
>;
static constexpr auto ZIF_git_packbuilder_foreach = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
git_packbuilder_foreach_cb,
void*>::func<git_packbuilder_foreach>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
// NOTE: We allow a NULL callback (but not a null callback handler) to
// support a stream payload, which is a feature provided by this
// extension. If the payload isn't a stream, then the callback function
// is called with no PHP userspace interaction.
php_git2::php_callback_handler<php_git2::packbuilder_foreach_callback>,
php_git2::php_callback_sync_nullable
>,
-1,
php_git2::sequence<0,2,2>, // pass callback in twice for function and payload
php_git2::sequence<0,1,2>
>;
static constexpr auto ZIF_git_packbuilder_set_threads = zif_php_git2_function<
php_git2::func_wrapper<
unsigned int,
git_packbuilder*,
unsigned int>::func<git_packbuilder_set_threads>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>,
php_git2::php_long
>,
-1
>;
static constexpr auto ZIF_git_packbuilder_set_callbacks = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
git_packbuilder_progress,
void*>::func<git_packbuilder_set_callbacks>,
php_git2::local_pack<
php_git2::php_callback_handler_nullable_async<
php_git2::packbuilder_progress_callback,
php_git2::packbuilder_async_callback_t
>,
php_git2::connector_wrapper<php_git2::packbuilder_async_callback_t>,
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>
>,
-1,
php_git2::sequence<2,1,1>, // pass callback twice
php_git2::sequence<2,0,1>
>;
static constexpr auto ZIF_git_packbuilder_object_count = zif_php_git2_function<
php_git2::func_wrapper<
size_t,
git_packbuilder*
>::func<git_packbuilder_object_count>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder_with_callback>
>,
0
>;
static constexpr auto ZIF_git_packbuilder_write = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_packbuilder*,
const char*,
unsigned int,
git_transfer_progress_cb,
void*>::func<git_packbuilder_write>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder>,
php_git2::php_string,
php_git2::php_long,
php_git2::connector_wrapper<
php_git2::php_callback_handler_nullable_connector<
php_git2::transfer_progress_callback
>
>,
php_git2::php_callback_sync_nullable
>,
-1,
php_git2::sequence<0,1,2,4,4>, // pass callback in twice
php_git2::sequence<0,1,2,3,4>
>;
static constexpr auto ZIF_git_packbuilder_written = zif_php_git2_function<
php_git2::func_wrapper<
size_t,
git_packbuilder*>::func<git_packbuilder_written>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_packbuilder>
>,
0
>;
// Function Entries:
#define GIT_PACKBUILDER_FE \
PHP_GIT2_FE(git_packbuilder_new) \
PHP_GIT2_FE(git_packbuilder_free) \
PHP_GIT2_FE(git_packbuilder_hash) \
PHP_GIT2_FE(git_packbuilder_insert_commit) \
PHP_GIT2_FE(git_packbuilder_insert_walk) \
PHP_GIT2_FE(git_packbuilder_insert_recur) \
PHP_GIT2_FE(git_packbuilder_insert_tree) \
PHP_GIT2_FE(git_packbuilder_insert) \
PHP_GIT2_FE(git_packbuilder_foreach) \
PHP_GIT2_FE(git_packbuilder_set_threads) \
PHP_GIT2_FE(git_packbuilder_set_callbacks) \
PHP_GIT2_FE(git_packbuilder_object_count) \
PHP_GIT2_FE(git_packbuilder_write) \
PHP_GIT2_FE(git_packbuilder_written)
#endif
/*
* Local Variables:
* mode:c++
* indent-tabs-mode:nil
* tab-width:4
* End:
*/