|
19 | 19 | #ifndef PHONGO_CLASSES_H
|
20 | 20 | #define PHONGO_CLASSES_H
|
21 | 21 |
|
| 22 | +#include "php_phongo_structs.h" |
| 23 | + |
22 | 24 | #if PHP_VERSION_ID >= 70000
|
23 |
| -# include "php_phongo_structs-7.h" |
| 25 | + |
| 26 | +static inline php_phongo_bulkwrite_t* php_bulkwrite_fetch_object(zend_object *obj) { |
| 27 | + return (php_phongo_bulkwrite_t *)((char *)obj - XtOffsetOf(php_phongo_bulkwrite_t, std)); |
| 28 | +} |
| 29 | +static inline php_phongo_command_t* php_command_fetch_object(zend_object *obj) { |
| 30 | + return (php_phongo_command_t *)((char *)obj - XtOffsetOf(php_phongo_command_t, std)); |
| 31 | +} |
| 32 | +static inline php_phongo_cursor_t* php_cursor_fetch_object(zend_object *obj) { |
| 33 | + return (php_phongo_cursor_t *)((char *)obj - XtOffsetOf(php_phongo_cursor_t, std)); |
| 34 | +} |
| 35 | +static inline php_phongo_cursorid_t* php_cursorid_fetch_object(zend_object *obj) { |
| 36 | + return (php_phongo_cursorid_t *)((char *)obj - XtOffsetOf(php_phongo_cursorid_t, std)); |
| 37 | +} |
| 38 | +static inline php_phongo_manager_t* php_manager_fetch_object(zend_object *obj) { |
| 39 | + return (php_phongo_manager_t *)((char *)obj - XtOffsetOf(php_phongo_manager_t, std)); |
| 40 | +} |
| 41 | +static inline php_phongo_query_t* php_query_fetch_object(zend_object *obj) { |
| 42 | + return (php_phongo_query_t *)((char *)obj - XtOffsetOf(php_phongo_query_t, std)); |
| 43 | +} |
| 44 | +static inline php_phongo_readconcern_t* php_readconcern_fetch_object(zend_object *obj) { |
| 45 | + return (php_phongo_readconcern_t *)((char *)obj - XtOffsetOf(php_phongo_readconcern_t, std)); |
| 46 | +} |
| 47 | +static inline php_phongo_readpreference_t* php_readpreference_fetch_object(zend_object *obj) { |
| 48 | + return (php_phongo_readpreference_t *)((char *)obj - XtOffsetOf(php_phongo_readpreference_t, std)); |
| 49 | +} |
| 50 | +static inline php_phongo_server_t* php_server_fetch_object(zend_object *obj) { |
| 51 | + return (php_phongo_server_t *)((char *)obj - XtOffsetOf(php_phongo_server_t, std)); |
| 52 | +} |
| 53 | +static inline php_phongo_writeconcern_t* php_writeconcern_fetch_object(zend_object *obj) { |
| 54 | + return (php_phongo_writeconcern_t *)((char *)obj - XtOffsetOf(php_phongo_writeconcern_t, std)); |
| 55 | +} |
| 56 | +static inline php_phongo_writeconcernerror_t* php_writeconcernerror_fetch_object(zend_object *obj) { |
| 57 | + return (php_phongo_writeconcernerror_t *)((char *)obj - XtOffsetOf(php_phongo_writeconcernerror_t, std)); |
| 58 | +} |
| 59 | +static inline php_phongo_writeerror_t* php_writeerror_fetch_object(zend_object *obj) { |
| 60 | + return (php_phongo_writeerror_t *)((char *)obj - XtOffsetOf(php_phongo_writeerror_t, std)); |
| 61 | +} |
| 62 | +static inline php_phongo_writeresult_t* php_writeresult_fetch_object(zend_object *obj) { |
| 63 | + return (php_phongo_writeresult_t *)((char *)obj - XtOffsetOf(php_phongo_writeresult_t, std)); |
| 64 | +} |
| 65 | +static inline php_phongo_binary_t* php_binary_fetch_object(zend_object *obj) { |
| 66 | + return (php_phongo_binary_t *)((char *)obj - XtOffsetOf(php_phongo_binary_t, std)); |
| 67 | +} |
| 68 | +static inline php_phongo_decimal128_t* php_decimal128_fetch_object(zend_object *obj) { |
| 69 | + return (php_phongo_decimal128_t *)((char *)obj - XtOffsetOf(php_phongo_decimal128_t, std)); |
| 70 | +} |
| 71 | +static inline php_phongo_javascript_t* php_javascript_fetch_object(zend_object *obj) { |
| 72 | + return (php_phongo_javascript_t *)((char *)obj - XtOffsetOf(php_phongo_javascript_t, std)); |
| 73 | +} |
| 74 | +static inline php_phongo_maxkey_t* php_maxkey_fetch_object(zend_object *obj) { |
| 75 | + return (php_phongo_maxkey_t *)((char *)obj - XtOffsetOf(php_phongo_maxkey_t, std)); |
| 76 | +} |
| 77 | +static inline php_phongo_minkey_t* php_minkey_fetch_object(zend_object *obj) { |
| 78 | + return (php_phongo_minkey_t *)((char *)obj - XtOffsetOf(php_phongo_minkey_t, std)); |
| 79 | +} |
| 80 | +static inline php_phongo_objectid_t* php_objectid_fetch_object(zend_object *obj) { |
| 81 | + return (php_phongo_objectid_t *)((char *)obj - XtOffsetOf(php_phongo_objectid_t, std)); |
| 82 | +} |
| 83 | +static inline php_phongo_regex_t* php_regex_fetch_object(zend_object *obj) { |
| 84 | + return (php_phongo_regex_t *)((char *)obj - XtOffsetOf(php_phongo_regex_t, std)); |
| 85 | +} |
| 86 | +static inline php_phongo_timestamp_t* php_timestamp_fetch_object(zend_object *obj) { |
| 87 | + return (php_phongo_timestamp_t *)((char *)obj - XtOffsetOf(php_phongo_timestamp_t, std)); |
| 88 | +} |
| 89 | +static inline php_phongo_utcdatetime_t* php_utcdatetime_fetch_object(zend_object *obj) { |
| 90 | + return (php_phongo_utcdatetime_t *)((char *)obj - XtOffsetOf(php_phongo_utcdatetime_t, std)); |
| 91 | +} |
24 | 92 |
|
25 | 93 | # define Z_COMMAND_OBJ_P(zv) (php_command_fetch_object(Z_OBJ_P(zv)))
|
26 | 94 | # define Z_CURSOR_OBJ_P(zv) (php_cursor_fetch_object(Z_OBJ_P(zv)))
|
|
70 | 138 |
|
71 | 139 | #else
|
72 | 140 |
|
73 |
| -# include "php_phongo_structs-5.h" |
74 |
| - |
75 | 141 | # define Z_COMMAND_OBJ_P(zv) ((php_phongo_command_t *)zend_object_store_get_object(zv TSRMLS_CC))
|
76 | 142 | # define Z_CURSOR_OBJ_P(zv) ((php_phongo_cursor_t *)zend_object_store_get_object(zv TSRMLS_CC))
|
77 | 143 | # define Z_CURSORID_OBJ_P(zv) ((php_phongo_cursorid_t *)zend_object_store_get_object(zv TSRMLS_CC))
|
|
117 | 183 | # define Z_OBJ_REGEX(zo) ((php_phongo_regex_t *)zo)
|
118 | 184 | # define Z_OBJ_TIMESTAMP(zo) ((php_phongo_timestamp_t *)zo)
|
119 | 185 | # define Z_OBJ_UTCDATETIME(zo) ((php_phongo_utcdatetime_t *)zo)
|
| 186 | + |
120 | 187 | #endif
|
121 | 188 |
|
122 | 189 | typedef struct {
|
|
0 commit comments