Skip to content

Commit f1d2514

Browse files
committed
Merge pull request #621
2 parents f54286f + ef4241c commit f1d2514

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1604
-1
lines changed

config.m4

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,28 @@ if test "$MONGODB" != "no"; then
155155
src/bson.c \
156156
src/bson-encode.c \
157157
src/BSON/Binary.c \
158+
src/BSON/BinaryInterface.c \
158159
src/BSON/Decimal128.c \
160+
src/BSON/Decimal128Interface.c \
159161
src/BSON/Javascript.c \
162+
src/BSON/JavascriptInterface.c \
160163
src/BSON/MaxKey.c \
164+
src/BSON/MaxKeyInterface.c \
161165
src/BSON/MinKey.c \
166+
src/BSON/MinKeyInterface.c \
162167
src/BSON/ObjectID.c \
168+
src/BSON/ObjectIDInterface.c \
163169
src/BSON/Persistable.c \
164170
src/BSON/Regex.c \
171+
src/BSON/RegexInterface.c \
165172
src/BSON/Serializable.c \
166173
src/BSON/Timestamp.c \
174+
src/BSON/TimestampInterface.c \
167175
src/BSON/Type.c \
168176
src/BSON/TypeWrapper.c \
169177
src/BSON/Unserializable.c \
170178
src/BSON/UTCDateTime.c \
179+
src/BSON/UTCDateTimeInterface.c \
171180
src/BSON/functions.c \
172181
src/MongoDB/BulkWrite.c \
173182
src/MongoDB/Command.c \

config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ if (PHP_MONGODB != "no") {
8484

8585
EXTENSION("mongodb", "php_phongo.c phongo_compat.c", null, PHP_MONGODB_CFLAGS);
8686
ADD_SOURCES(configure_module_dirname + "/src", "bson.c bson-encode.c", "mongodb");
87-
ADD_SOURCES(configure_module_dirname + "/src/BSON", "Binary.c Decimal128.c Javascript.c MaxKey.c MinKey.c ObjectID.c Persistable.c Regex.c Serializable.c Timestamp.c Type.c TypeWrapper.c Unserializable.c UTCDateTime.c functions.c", "mongodb");
87+
ADD_SOURCES(configure_module_dirname + "/src/BSON", "Binary.c BinaryInterface.c Decimal128.c Decimal128Interface.c Javascript.c JavascriptInterface.c MaxKey.c MaxKeyInterface.c MinKey.c MinKeyInterface.c ObjectID.c ObjectIDInterface.c Persistable.c Regex.c RegexInterface.c Serializable.c Timestamp.c TimestampInterface.c Type.c TypeWrapper.c Unserializable.c UTCDateTime.c UTCDateTimeInterface.c functions.c", "mongodb");
8888
ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "BulkWrite.c Command.c Cursor.c CursorId.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
8989
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c ConnectionException.c ConnectionTimeoutException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c", "mongodb");
9090
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c Subscriber.c functions.c", "mongodb");

php_phongo.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,6 +2200,16 @@ PHP_MINIT_FUNCTION(mongodb)
22002200
php_phongo_serializable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
22012201
php_phongo_unserializable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
22022202

2203+
php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2204+
php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2205+
php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2206+
php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2207+
php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2208+
php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2209+
php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2210+
php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2211+
php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
2212+
22032213
php_phongo_binary_init_ce(INIT_FUNC_ARGS_PASSTHRU);
22042214
php_phongo_decimal128_init_ce(INIT_FUNC_ARGS_PASSTHRU);
22052215
php_phongo_javascript_init_ce(INIT_FUNC_ARGS_PASSTHRU);

php_phongo_classes.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ extern zend_class_entry *php_phongo_regex_ce;
257257
extern zend_class_entry *php_phongo_timestamp_ce;
258258
extern zend_class_entry *php_phongo_utcdatetime_ce;
259259

260+
extern zend_class_entry *php_phongo_binary_interface_ce;
261+
extern zend_class_entry *php_phongo_decimal128_interface_ce;
262+
extern zend_class_entry *php_phongo_javascript_interface_ce;
263+
extern zend_class_entry *php_phongo_maxkey_interface_ce;
264+
extern zend_class_entry *php_phongo_minkey_interface_ce;
265+
extern zend_class_entry *php_phongo_objectid_interface_ce;
266+
extern zend_class_entry *php_phongo_regex_interface_ce;
267+
extern zend_class_entry *php_phongo_timestamp_interface_ce;
268+
extern zend_class_entry *php_phongo_utcdatetime_interface_ce;
269+
260270
extern zend_class_entry *php_phongo_commandfailedevent_ce;
261271
extern zend_class_entry *php_phongo_commandstartedevent_ce;
262272
extern zend_class_entry *php_phongo_commandsubscriber_ce;
@@ -278,6 +288,16 @@ extern void php_phongo_typewrapper_init_ce(INIT_FUNC_ARGS);
278288
extern void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS);
279289
extern void php_phongo_unserializable_init_ce(INIT_FUNC_ARGS);
280290

291+
extern void php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS);
292+
extern void php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS);
293+
extern void php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS);
294+
extern void php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS);
295+
extern void php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS);
296+
extern void php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS);
297+
extern void php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS);
298+
extern void php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS);
299+
extern void php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS);
300+
281301
extern void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS);
282302
extern void php_phongo_command_init_ce(INIT_FUNC_ARGS);
283303
extern void php_phongo_cursor_init_ce(INIT_FUNC_ARGS);

src/BSON/Binary.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */
459459
php_phongo_binary_ce->create_object = php_phongo_binary_create_object;
460460
PHONGO_CE_FINAL(php_phongo_binary_ce);
461461

462+
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, php_phongo_binary_interface_ce);
462463
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
463464
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, php_phongo_type_ce);
464465
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, zend_ce_serializable);

src/BSON/BinaryInterface.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifdef HAVE_CONFIG_H
18+
# include "config.h"
19+
#endif
20+
21+
#include <php.h>
22+
23+
#include "phongo_compat.h"
24+
#include "php_phongo.h"
25+
26+
zend_class_entry *php_phongo_binary_interface_ce;
27+
28+
/* {{{ MongoDB\BSON\BinaryInterface function entries */
29+
ZEND_BEGIN_ARG_INFO_EX(ai_BinaryInterface_void, 0, 0, 0)
30+
ZEND_END_ARG_INFO()
31+
32+
static zend_function_entry php_phongo_binary_interface_me[] = {
33+
ZEND_ABSTRACT_ME(BinaryInterface, getData, ai_BinaryInterface_void)
34+
ZEND_ABSTRACT_ME(BinaryInterface, getType, ai_BinaryInterface_void)
35+
ZEND_ABSTRACT_ME(BinaryInterface, __toString, ai_BinaryInterface_void)
36+
PHP_FE_END
37+
};
38+
/* }}} */
39+
40+
void php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */
41+
{
42+
zend_class_entry ce;
43+
44+
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "BinaryInterface", php_phongo_binary_interface_me);
45+
php_phongo_binary_interface_ce = zend_register_internal_interface(&ce TSRMLS_CC);
46+
} /* }}} */
47+
48+
/*
49+
* Local variables:
50+
* tab-width: 4
51+
* c-basic-offset: 4
52+
* End:
53+
* vim600: noet sw=4 ts=4 fdm=marker
54+
* vim<600: noet sw=4 ts=4
55+
*/

src/BSON/Decimal128.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS) /* {{{ */
368368
php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object;
369369
PHONGO_CE_FINAL(php_phongo_decimal128_ce);
370370

371+
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, php_phongo_decimal128_interface_ce);
371372
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
372373
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, php_phongo_type_ce);
373374
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, zend_ce_serializable);

src/BSON/Decimal128Interface.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifdef HAVE_CONFIG_H
18+
# include "config.h"
19+
#endif
20+
21+
#include <php.h>
22+
23+
#include "phongo_compat.h"
24+
#include "php_phongo.h"
25+
26+
zend_class_entry *php_phongo_decimal128_interface_ce;
27+
28+
/* {{{ MongoDB\BSON\Decimal128Interface function entries */
29+
ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128Interface_void, 0, 0, 0)
30+
ZEND_END_ARG_INFO()
31+
32+
static zend_function_entry php_phongo_decimal128_interface_me[] = {
33+
ZEND_ABSTRACT_ME(Decimal128Interface, __toString, ai_Decimal128Interface_void)
34+
PHP_FE_END
35+
};
36+
/* }}} */
37+
38+
void php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */
39+
{
40+
zend_class_entry ce;
41+
42+
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128Interface", php_phongo_decimal128_interface_me);
43+
php_phongo_decimal128_interface_ce = zend_register_internal_interface(&ce TSRMLS_CC);
44+
} /* }}} */
45+
46+
/*
47+
* Local variables:
48+
* tab-width: 4
49+
* c-basic-offset: 4
50+
* End:
51+
* vim600: noet sw=4 ts=4 fdm=marker
52+
* vim<600: noet sw=4 ts=4
53+
*/

src/BSON/Javascript.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ void php_phongo_javascript_init_ce(INIT_FUNC_ARGS) /* {{{ */
532532
php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object;
533533
PHONGO_CE_FINAL(php_phongo_javascript_ce);
534534

535+
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, php_phongo_javascript_interface_ce);
535536
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
536537
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, php_phongo_type_ce);
537538
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, zend_ce_serializable);

src/BSON/JavascriptInterface.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifdef HAVE_CONFIG_H
18+
# include "config.h"
19+
#endif
20+
21+
#include <php.h>
22+
23+
#include "phongo_compat.h"
24+
#include "php_phongo.h"
25+
26+
zend_class_entry *php_phongo_javascript_interface_ce;
27+
28+
/* {{{ MongoDB\BSON\JavascriptInterface function entries */
29+
ZEND_BEGIN_ARG_INFO_EX(ai_JavascriptInterface_void, 0, 0, 0)
30+
ZEND_END_ARG_INFO()
31+
32+
static zend_function_entry php_phongo_javascript_interface_me[] = {
33+
ZEND_ABSTRACT_ME(JavascriptInterface, getCode, ai_JavascriptInterface_void)
34+
ZEND_ABSTRACT_ME(JavascriptInterface, getScope, ai_JavascriptInterface_void)
35+
ZEND_ABSTRACT_ME(JavascriptInterface, __toString, ai_JavascriptInterface_void)
36+
PHP_FE_END
37+
};
38+
/* }}} */
39+
40+
void php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */
41+
{
42+
zend_class_entry ce;
43+
44+
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "JavascriptInterface", php_phongo_javascript_interface_me);
45+
php_phongo_javascript_interface_ce = zend_register_internal_interface(&ce TSRMLS_CC);
46+
} /* }}} */
47+
48+
/*
49+
* Local variables:
50+
* tab-width: 4
51+
* c-basic-offset: 4
52+
* End:
53+
* vim600: noet sw=4 ts=4 fdm=marker
54+
* vim<600: noet sw=4 ts=4
55+
*/

0 commit comments

Comments
 (0)