forked from RogerGee/php-git2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stash.h
139 lines (123 loc) · 3.82 KB
/
stash.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
/*
* stash.h
*
* Copyright (C) Roger P. Gee
*/
#ifndef PHPGIT2_STASH_H
#define PHPGIT2_STASH_H
#include "checkout.h"
namespace php_git2
{
class php_git_stash_apply_options:
public php_option_array
{
public:
php_git_stash_apply_options()
{
git_stash_apply_init_options(&opts,GIT_STASH_APPLY_OPTIONS_VERSION);
}
const git_stash_apply_options* byval_git2()
{
if (!is_null()) {
array_wrapper arr(value);
php_git_checkout_options checkoutOptions;
GIT2_ARRAY_LOOKUP_LONG(arr,flags,opts);
GIT2_ARRAY_LOOKUP_SUBOBJECT_DEREFERENCE(arr,checkoutOptions,checkout_options,opts);
GIT2_ARRAY_LOOKUP_CALLBACK_NULLABLE(
arr,
stash_apply_progress_callback,
callback,
progress_cb,
progress_payload,
opts);
return &opts;
}
return nullptr;
}
private:
git_stash_apply_options opts;
php_callback_sync callback;
};
} // namespace php_git2
static constexpr auto ZIF_GIT_STASH_APPLY = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_repository*,
size_t,
const git_stash_apply_options*>::func<git_stash_apply>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_repository>,
php_git2::php_long_cast<size_t>,
php_git2::php_git_stash_apply_options
>
>;
static constexpr auto ZIF_GIT_STASH_DROP = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_repository*,
size_t>::func<git_stash_drop>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_repository>,
php_git2::php_long_cast<size_t>
>
>;
static constexpr auto ZIF_GIT_STASH_FOREACH = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_repository*,
git_stash_cb,
void*>::func<git_stash_foreach>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_repository>,
php_git2::php_callback_handler<php_git2::stash_callback>,
php_git2::php_callback_sync
>,
-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_STASH_POP = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_repository*,
size_t,
const git_stash_apply_options*>::func<git_stash_pop>,
php_git2::local_pack<
php_git2::php_resource<php_git2::php_git_repository>,
php_git2::php_long_cast<size_t>,
php_git2::php_git_stash_apply_options
>
>;
static constexpr auto ZIF_GIT_STASH_SAVE = zif_php_git2_function<
php_git2::func_wrapper<
int,
git_oid*,
git_repository*,
const git_signature*,
const char*,
uint32_t>::func<git_stash_save>,
php_git2::local_pack<
php_git2::php_git_oid_out,
php_git2::php_resource<php_git2::php_git_repository>,
php_git2::php_resource<php_git2::php_git_signature>,
php_git2::php_string,
php_git2::php_long_cast<uint32_t>
>,
1,
php_git2::sequence<1,2,3,4>,
php_git2::sequence<0,1,2,3,4>
>;
#define GIT_STASH_FE \
PHP_GIT2_FE(git_stash_apply,ZIF_GIT_STASH_APPLY,NULL) \
PHP_GIT2_FE(git_stash_drop,ZIF_GIT_STASH_DROP,NULL) \
PHP_GIT2_FE(git_stash_foreach,ZIF_GIT_STASH_FOREACH,NULL) \
PHP_GIT2_FE(git_stash_pop,ZIF_GIT_STASH_POP,NULL) \
PHP_GIT2_FE(git_stash_save,ZIF_GIT_STASH_SAVE,NULL)
#endif
/*
* Local Variables:
* mode:c++
* indent-tabs-mode:nil
* tab-width:4
* End:
*/