This repository has been archived by the owner on Apr 20, 2022. It is now read-only.
forked from couchbaselabs/php-ext-couchbase
-
Notifications
You must be signed in to change notification settings - Fork 32
/
ht.h
137 lines (105 loc) · 3.53 KB
/
ht.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
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright 2012 Couchbase, Inc. |
+----------------------------------------------------------------------+
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| implied. See the License for the specific language governing |
| permissions and limitations under the License. |
+----------------------------------------------------------------------+
*/
#ifndef PHP_COUCHBASE_H
#error "Include php_couchbase.h first"
#endif
#ifndef PCBC_HT_H
#define PCBC_HT_H
typedef struct {
const char *key;
int key_type;
unsigned long key_len;
int _allocated;
} pcbc_ht_key;
typedef struct {
pcbc_ht_key *key_info;
zval *data;
} pcbc_ht_entry;
/**
* Creation/Destruction
*/
PHP_COUCHBASE_LOCAL
void pcbc_ht_key_create(const char *key, int len, pcbc_ht_key *ki);
PHP_COUCHBASE_LOCAL
void pcbc_ht_key_cleanup(pcbc_ht_key *info);
PHP_COUCHBASE_LOCAL
void pcbc_ht_key_free(pcbc_ht_key *info);
PHP_COUCHBASE_LOCAL
void pcbc_ht_entry_free(pcbc_ht_entry *pair);
PHP_COUCHBASE_LOCAL
void pcbc_ht_dispose(zval *assoc);
/**
* Iteration
*/
PHP_COUCHBASE_LOCAL
void pcbc_ht_iter_init(zval *assoc);
PHP_COUCHBASE_LOCAL
int pcbc_ht_iter_remaining(zval *assoc);
PHP_COUCHBASE_LOCAL
void pcbc_ht_iter_next(zval *assoc);
PHP_COUCHBASE_LOCAL
pcbc_ht_key *pcbc_ht_iter_key(zval *assoc);
PHP_COUCHBASE_LOCAL
zval *pcbc_ht_iter_value(zval *assoc);
PHP_COUCHBASE_LOCAL
pcbc_ht_entry *pcbc_ht_iter_entry(zval *assoc);
/**
* Misc
*/
PHP_COUCHBASE_LOCAL
unsigned long pcbc_ht_len(zval *assoc);
/**
* Key/Value access lookup.
* hk* functions search by a hashkey structure, while the non-prefixed versions
* take a string and length.
*
* Suffixes (for storage) represent the type of object to be stored
*/
PHP_COUCHBASE_LOCAL
void pcbc_ht_del(zval *assoc, const char *key, unsigned int key_len);
PHP_COUCHBASE_LOCAL
zval *pcbc_ht_hkfind(zval *assoc, pcbc_ht_key *hk);
PHP_COUCHBASE_LOCAL
zval *pcbc_ht_find(zval *assoc, const char *key, int key_len);
PHP_COUCHBASE_LOCAL
zval *pcbc_ht_ifind(zval *assoc, unsigned long idx);
PHP_COUCHBASE_LOCAL
int pcbc_ht_exists(zval *assoc, const char *key, int key_len);
PHP_COUCHBASE_LOCAL
int pcbc_ht_iexists(zval *assoc, unsigned long idx);
PHP_COUCHBASE_LOCAL
void pcbc_ht_hkstores(zval *assoc, pcbc_ht_key *hk,
const char *value, int nvalue);
PHP_COUCHBASE_LOCAL
void pcbc_ht_stores(zval *assoc,
const char *key, int nkey, const char *value, int nvalue);
PHP_COUCHBASE_LOCAL
void pcbc_ht_hkstoreb(zval *assoc, pcbc_ht_key *hk, zend_bool value);
PHP_COUCHBASE_LOCAL
void pcbc_ht_storeb(zval *assoc, const char *key, int nkey, zend_bool value);
PHP_COUCHBASE_LOCAL
void pcbc_ht_hkstorez(zval *assoc, pcbc_ht_key *hk, zval *value);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/