本文整理汇总了C++中zend_object_store_get_object函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_object_store_get_object函数的具体用法?C++ zend_object_store_get_object怎么用?C++ zend_object_store_get_object使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zend_object_store_get_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
PHP_METHOD(SpotifyPlaylist, __destruct)
{
spotifyplaylist_object *p = (spotifyplaylist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
sp_playlist_release(p->playlist);
}
示例2: PHP_METHOD
/* {{{ proto float ImagickPixel::setColorValue(int color, float value )
Sets the normalized color of the ImagickPixel.
*/
PHP_METHOD(imagickpixel, setcolorvalue)
{
php_imagickpixel_object *internp;
long color;
double color_value;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld", &color, &color_value) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
switch (color) {
case IMAGICKCOLORBLACK:
PixelSetBlack(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORBLUE:
PixelSetBlue(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORCYAN:
PixelSetCyan(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORGREEN:
PixelSetGreen(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORRED:
PixelSetRed(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORYELLOW:
PixelSetYellow(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORMAGENTA:
PixelSetMagenta(internp->pixel_wand, color_value);
break;
case IMAGICKCOLOROPACITY:
PixelSetOpacity(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORALPHA:
PixelSetAlpha(internp->pixel_wand, color_value);
break;
#if MagickLibVersion > 0x628
case IMAGICKCOLORFUZZ:
PixelSetFuzz(internp->pixel_wand, color_value);
break;
#endif
default:
php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC);
return;
break;
}
RETVAL_TRUE;
}
示例3: efree
if (!strerror_r(err, buf, 256)) {
return buf;
}
efree(buf);
return NULL;
#endif
}
PHP_MOSQUITTO_API void php_mosquitto_exit_loop(mosquitto_client_object *object)
{
object->looping = 0;
}
static inline mosquitto_client_object *mosquitto_client_object_get(zval *zobj TSRMLS_DC)
{
mosquitto_client_object *pobj = zend_object_store_get_object(zobj TSRMLS_CC);
if (pobj->client == NULL) {
php_error(E_ERROR, "Internal surface object missing in %s wrapper, you must call parent::__construct in extended classes", Z_OBJCE_P(zobj)->name);
}
return pobj;
}
static void mosquitto_client_object_destroy(void *object TSRMLS_DC)
{
mosquitto_client_object *client = (mosquitto_client_object *) object;
/* Disconnect cleanly, but disregard an error if it wasn't connected */
/* We must loop here so that the disconnect packet is sent and acknowledged */
mosquitto_disconnect(client->client);
mosquitto_loop(client->client, 100, 1);
示例4: PHP_METHOD
/**
* Returns the path this event is watching.
*
* @return string
* @return false if object has not been initialized
*/
PHP_METHOD(StatEvent, getPath)
{
event_object *obj = (event_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_STRING(((ev_stat *)obj->watcher)->path, 1);
}
示例5: RETURN_LONG
RETURN_LONG(projectionObj_getUnits(php_projection->projection));
}
/* }}} */
zend_function_entry projection_functions[] = {
PHP_ME(projectionObj, __construct, projection___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(projectionObj, getUnits, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
void mapscript_create_projection(projectionObj *projection, parent_object parent, zval *return_value TSRMLS_DC)
{
php_projection_object * php_projection;
object_init_ex(return_value, mapscript_ce_projection);
php_projection = (php_projection_object *)zend_object_store_get_object(return_value TSRMLS_CC);
php_projection->projection = projection;
if (parent.val)
php_projection->is_ref = 1;
php_projection->parent = parent;
MAPSCRIPT_ADDREF(parent.val);
}
static void mapscript_projection_object_destroy(void *object TSRMLS_DC)
{
php_projection_object *php_projection = (php_projection_object *)object;
MAPSCRIPT_FREE_OBJECT(php_projection);
示例6: strlen
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
#include "php_amqp.h"
#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3
zend_object_handlers amqp_queue_object_handlers;
HashTable *amqp_queue_object_get_debug_info(zval *object, int *is_temp TSRMLS_DC) {
zval *value;
HashTable *debug_info;
/* Get the envelope object from which to read */
amqp_queue_object *queue = (amqp_queue_object *)zend_object_store_get_object(object TSRMLS_CC);
/* Let zend clean up for us: */
*is_temp = 1;
/* Keep the # 7 matching the number of entries in this table*/
ALLOC_HASHTABLE(debug_info);
ZEND_INIT_SYMTABLE_EX(debug_info, 7 + 1, 0);
/* Start adding values */
MAKE_STD_ZVAL(value);
ZVAL_STRINGL(value, queue->name, strlen(queue->name), 1);
zend_hash_add(debug_info, "queue_name", sizeof("queue_name"), &value, sizeof(zval *), NULL);
MAKE_STD_ZVAL(value);
ZVAL_STRINGL(value, queue->consumer_tag, strlen(queue->consumer_tag), 1);
示例7: MONGO_CHECK_INITIALIZED_STRING
{
mongo_db *db = (mongo_db*)zend_object_store_get_object(getThis() TSRMLS_CC);
MONGO_CHECK_INITIALIZED_STRING(db->name, MongoDB);
RETURN_ZVAL(db->name, 1, 0);
}
/* Selects a collection and returns it as zval. If the return value is no, an
* Exception is set. This only happens if the passed in DB was invalid. */
zval *php_mongodb_selectcollection(zval *this, char *collection, int collection_len TSRMLS_DC)
{
zval *z_collection;
zval *return_value;
zval temp;
mongo_db *db;
db = (mongo_db*)zend_object_store_get_object(this TSRMLS_CC);
if (!(db->name)) {
zend_throw_exception(mongo_ce_Exception, "The MongoDB object has not been correctly initialized by its constructor", 0 TSRMLS_CC);
return NULL;
}
MAKE_STD_ZVAL(z_collection);
ZVAL_STRINGL(z_collection, collection, collection_len, 1);
MAKE_STD_ZVAL(return_value);
object_init_ex(return_value, mongo_ce_Collection);
MONGO_METHOD2(MongoCollection, __construct, &temp, return_value, this, z_collection);
zval_ptr_dtor(&z_collection);
示例8: PHP_METHOD
PHP_METHOD(MongoDB, __toString)
{
mongo_db *db = (mongo_db*)zend_object_store_get_object(getThis() TSRMLS_CC);
MONGO_CHECK_INITIALIZED_STRING(db->name, MongoDB);
RETURN_ZVAL(db->name, 1, 0);
}
示例9: php_mongo_api_batch_ctor
}
/* }}} */
/*
* Initializes a new mongo_write_batch_object with write options, inherited through
* MongoCollection and default server options - overwritable by the write_options argument */
void php_mongo_api_batch_ctor(mongo_write_batch_object *intern, zval *zcollection, php_mongo_write_types type, HashTable *write_options TSRMLS_DC) /* {{{ */
{
mongoclient *link;
mongo_collection *collection;
intern->batch_type = type;
intern->zcollection_object = zcollection;
Z_ADDREF_P(zcollection);
collection = (mongo_collection *)zend_object_store_get_object(zcollection TSRMLS_CC);
link = (mongoclient *)zend_object_store_get_object(collection->link TSRMLS_CC);
mongo_apply_implicit_write_options(&intern->write_options, &link->servers->options, zcollection TSRMLS_CC);
php_mongo_api_write_options_from_ht(&intern->write_options, write_options TSRMLS_CC);
}
/* }}} */
/*
* Puts the final touches on a mongo_buffer batch by ending the bulk array and write the
* write options into the buffer
*
* Returns:
* 0: Failed to wrap up the buffer
* >0 The full message length */
示例10: zend_get_class_entry
/**
* Function that is called to create space for a cloned object
* @param val The object to be cloned
* @return zend_obejct_value The object to be created
*/
zend_object_value ClassBase::cloneObject(zval *val TSRMLS_DC)
{
// retrieve the class entry linked to this object
auto *entry = zend_get_class_entry(val);
// we need the C++ class meta-information object
ClassBase *meta = cpp_class(entry);
// retrieve the old object, which we are going to copy
MixedObject *old_object = (MixedObject *)zend_object_store_get_object(val);
// create a new base c++ object
auto *cpp = meta->clone(old_object->cpp);
// report error on failure
if (!cpp) throw Php::Exception(std::string("Unable to clone ") + entry->name);
// the thing we're going to return
zend_object_value result;
// set the handlers
result.handlers = ClassBase::objectHandlers();
// store the object
MixedObject *new_object = cpp->store(entry);
示例11: PHP_METHOD
/* {{{ proto string MongoGridFSFile::getBytes()
Returns this file's contents as a string of bytes */
PHP_METHOD(MongoGridFSFile, getBytes)
{
zval *file, *gridfs, *chunks, *query, *cursor, *sort, *temp;
zval **id, **size;
char *str, *str_ptr;
int len;
mongo_cursor *cursorobj;
zval *flags;
file = zend_read_property(mongo_ce_GridFSFile, getThis(), "file", strlen("file"), NOISY TSRMLS_CC);
zend_hash_find(HASH_P(file), "_id", strlen("_id") + 1, (void**)&id);
if (zend_hash_find(HASH_P(file), "length", strlen("length") + 1, (void**)&size) == FAILURE) {
zend_throw_exception(mongo_ce_GridFSException, "couldn't find file size", 14 TSRMLS_CC);
return;
}
/* make sure that there's an index on chunks so we can sort by chunk num */
gridfs = zend_read_property(mongo_ce_GridFSFile, getThis(), "gridfs", strlen("gridfs"), NOISY TSRMLS_CC);
chunks = zend_read_property(mongo_ce_GridFS, gridfs, "chunks", strlen("chunks"), NOISY TSRMLS_CC);
MAKE_STD_ZVAL(temp);
php_mongo_ensure_gridfs_index(temp, chunks TSRMLS_CC);
zval_dtor(temp);
/* query for chunks */
MAKE_STD_ZVAL(query);
array_init(query);
zval_add_ref(id);
add_assoc_zval(query, "files_id", *id);
MAKE_STD_ZVAL(cursor);
MONGO_METHOD1(MongoCollection, find, cursor, chunks, query);
/* Copy the flags from the original cursor and apply it to this one */
flags = zend_read_property(mongo_ce_GridFSFile, getThis(), "flags", strlen("flags"), NOISY TSRMLS_CC);
cursorobj = (mongo_cursor*)zend_object_store_get_object(cursor TSRMLS_CC);
convert_to_long(flags);
cursorobj->opts = Z_LVAL_P(flags);
MAKE_STD_ZVAL(sort);
array_init(sort);
add_assoc_long(sort, "n", 1);
MONGO_METHOD1(MongoCursor, sort, temp, cursor, sort);
zval_ptr_dtor(&temp);
zval_ptr_dtor(&query);
zval_ptr_dtor(&sort);
if (Z_TYPE_PP(size) == IS_DOUBLE) {
len = (int)Z_DVAL_PP(size);
} else if (Z_TYPE_PP(size) == IS_LONG) {
len = Z_LVAL_PP(size);
} else if (Z_TYPE_PP(size) == IS_OBJECT && (Z_OBJCE_PP(size) == mongo_ce_Int32 || Z_OBJCE_PP(size) == mongo_ce_Int64)) {
zval *sizet = zend_read_property(mongo_ce_Int64, *size, "value", strlen("value"), NOISY TSRMLS_CC);
if (Z_TYPE_P(sizet) != IS_STRING) {
zval_ptr_dtor(&cursor);
zend_throw_exception(mongo_ce_GridFSException, "couldn't find file size, value object broken", 0 TSRMLS_CC);
return;
}
len = atoi(Z_STRVAL_P(sizet));
} else {
zval_ptr_dtor(&cursor);
zend_throw_exception(mongo_ce_GridFSException, "couldn't find file size, property invalid", 0 TSRMLS_CC);
return;
}
str = (char *)ecalloc(len + 1, 1);
str_ptr = str;
if (apply_to_cursor(cursor, copy_bytes, &str, len + 1 TSRMLS_CC) == FAILURE) {
zval_ptr_dtor(&cursor);
efree(str_ptr);
if (EG(exception)) {
return;
}
zend_throw_exception(mongo_ce_GridFSException, "error reading chunk of file", 17 TSRMLS_CC);
return;
}
zval_ptr_dtor(&cursor);
str_ptr[len] = '\0';
RETURN_STRINGL(str_ptr, len, 0);
}
示例12: PHP_METHOD
/* {{{ MongoDBRef::get()
*/
PHP_METHOD(MongoDBRef, get)
{
zval *db, *ref, *collection, *query;
zval **ns, **id, **dbname;
zend_bool alloced_db = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oz", &db, mongo_ce_DB, &ref) == FAILURE) {
return;
}
if (
IS_SCALAR_P(ref) ||
zend_hash_find(HASH_P(ref), "$ref", strlen("$ref") + 1, (void**)&ns) == FAILURE ||
zend_hash_find(HASH_P(ref), "$id", strlen("$id") + 1, (void**)&id) == FAILURE
) {
RETURN_NULL();
}
if (Z_TYPE_PP(ns) != IS_STRING) {
zend_throw_exception(mongo_ce_Exception, "MongoDBRef::get: $ref field must be a string", 10 TSRMLS_CC);
return;
}
/* if this reference contains a db name, we have to switch dbs */
if (zend_hash_find(HASH_P(ref), "$db", strlen("$db") + 1, (void**)&dbname) == SUCCESS) {
mongo_db *temp_db = (mongo_db*)zend_object_store_get_object(db TSRMLS_CC);
/* just to be paranoid, make sure dbname is a string */
if (Z_TYPE_PP(dbname) != IS_STRING) {
zend_throw_exception(mongo_ce_Exception, "MongoDBRef::get: $db field must be a string", 11 TSRMLS_CC);
return;
}
/* if the name in the $db field doesn't match the current db, make up
* a new db */
if (strcmp(Z_STRVAL_PP(dbname), Z_STRVAL_P(temp_db->name)) != 0) {
zval *new_db_z;
MAKE_STD_ZVAL(new_db_z);
ZVAL_NULL(new_db_z);
MONGO_METHOD1(MongoClient, selectDB, new_db_z, temp_db->link, *dbname);
/* make the new db the current one */
db = new_db_z;
/* so we can dtor this later */
alloced_db = 1;
}
}
/* get the collection */
MAKE_STD_ZVAL(collection);
MONGO_METHOD1(MongoDB, selectCollection, collection, db, *ns);
/* query for the $id */
MAKE_STD_ZVAL(query);
array_init(query);
add_assoc_zval(query, "_id", *id);
zval_add_ref(id);
/* return whatever's there */
MONGO_METHOD1(MongoCollection, findOne, return_value, collection, query);
/* cleanup */
zval_ptr_dtor(&collection);
zval_ptr_dtor(&query);
if (alloced_db) {
zval_ptr_dtor(&db);
}
}
示例13: PHP_METHOD
/** {{{ proto bool Win\Gdi\Window::endPaint( paint_data );
Marks the end of painting in the specified window.
*/
PHP_METHOD( WinGdiWindow, endPaint )
{
wingdi_devicecontext_object * dc_object;
wingdi_window_object * window_object = zend_object_store_get_object( getThis() TSRMLS_CC );
HashTable * paint_data;
PAINTSTRUCT paint_struct;
WINGDI_ERROR_HANDLING();
if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "h", &paint_data ) == FAILURE )
return;
WINGDI_RESTORE_ERRORS();
// Error checking
// Not sure about the error messages
if ( ! zend_hash_exists( paint_data, "hdc", strlen( "hdc" ) + 1 ) )
{
php_error( E_ERROR, "no 'hdc' element found in array" );
return;
}
else if ( ! zend_hash_exists( paint_data, "erase", strlen( "erase" ) + 1 ) )
{
php_error( E_ERROR, "no 'erase' element found in array" );
return;
}
else if ( ! zend_hash_exists( paint_data, "paint", strlen( "paint" ) + 1 ) )
{
php_error( E_ERROR, "no 'paint' element found in array" );
return;
}
else
{
zval ** hdc_element,
** erase_element,
** paint_element,
** left = NULL, ** top = NULL, ** right = NULL, ** bottom = NULL;
HashTable * paint_rect;
zend_hash_find( paint_data, "hdc", strlen( "hdc" ) + 1, ( void ** ) &hdc_element );
dc_object = ( wingdi_devicecontext_object * ) zend_objects_get_address( * hdc_element TSRMLS_CC );
paint_struct.hdc = dc_object->hdc;
zend_hash_find( paint_data, "erase", strlen( "erase" ) + 1, ( void ** ) &erase_element );
paint_struct.fErase = Z_BVAL_PP( erase_element );
zend_hash_find( paint_data, "paint", strlen( "paint" ) + 1, ( void ** ) &paint_element );
if ( Z_TYPE_PP( paint_element ) != IS_ARRAY || zend_hash_num_elements( Z_ARRVAL_PP( paint_element ) ) < 4 )
{
php_error( E_ERROR, "expected an array of for elements for 'paint' element of array" );
return;
}
paint_rect = Z_ARRVAL_PP( paint_element );
// TODO: error checking
zend_hash_index_find( paint_rect, 0, ( void ** ) &left );
zend_hash_index_find( paint_rect, 1, ( void ** ) &top );
zend_hash_index_find( paint_rect, 2, ( void ** ) &right );
zend_hash_index_find( paint_rect, 3, ( void ** ) &bottom );
paint_struct.rcPaint.left = Z_LVAL_PP( left );
paint_struct.rcPaint.top = Z_LVAL_PP( top );
paint_struct.rcPaint.right = Z_LVAL_PP( right );
paint_struct.rcPaint.bottom = Z_LVAL_PP( bottom );
RETURN_BOOL( EndPaint( window_object->window_handle, &paint_struct ) );
}
}
示例14: PHP_ME
PHP_ME(lineObj, addXY, line_addXY_args, ZEND_ACC_PUBLIC)
PHP_ME(lineObj, addXYZ, line_addXYZ_args, ZEND_ACC_PUBLIC)
PHP_ME(lineObj, project, line_project_args, ZEND_ACC_PUBLIC)
PHP_ME(lineObj, point, line_point_args, ZEND_ACC_PUBLIC)
PHP_MALIAS(lineObj, get, point, line_point_args, ZEND_ACC_PUBLIC)
PHP_ME(lineObj, set, line_set_args, ZEND_ACC_PUBLIC) {
NULL, NULL, NULL
}
};
void mapscript_create_line(lineObj *line, parent_object parent, zval *return_value TSRMLS_DC)
{
php_line_object * php_line;
object_init_ex(return_value, mapscript_ce_line);
php_line = (php_line_object *)zend_object_store_get_object(return_value TSRMLS_CC);
php_line->line = line;
if (parent.val)
php_line->is_ref = 1;
php_line->parent = parent;
MAPSCRIPT_ADDREF(parent.val);
}
static void mapscript_line_object_destroy(void *object TSRMLS_DC)
{
php_line_object *php_line = (php_line_object *)object;
MAPSCRIPT_FREE_OBJECT(php_line);
示例15: php_amqp_set_read_timeout
int php_amqp_set_read_timeout(amqp_connection_object *connection TSRMLS_DC);
int php_amqp_set_write_timeout(amqp_connection_object *connection TSRMLS_DC);
#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3
zend_object_handlers amqp_connection_object_handlers;
HashTable *amqp_connection_object_get_debug_info(zval *object, int *is_temp TSRMLS_DC) {
zval *value;
HashTable *debug_info;
amqp_connection_object *connection;
/* Let zend clean up for us: */
*is_temp = 1;
/* Get the envelope object from which to read */
connection = (amqp_connection_object *)zend_object_store_get_object(object TSRMLS_CC);
/* Keep the first number matching the number of entries in this table*/
ALLOC_HASHTABLE(debug_info);
ZEND_INIT_SYMTABLE_EX(debug_info, 6 + 1, 0);
/* Start adding values */
MAKE_STD_ZVAL(value);
ZVAL_STRINGL(value, connection->login, strlen(connection->login), 1);
zend_hash_add(debug_info, "login", sizeof("login"), &value, sizeof(zval *), NULL);
MAKE_STD_ZVAL(value);
ZVAL_STRINGL(value, connection->password, strlen(connection->password), 1);
zend_hash_add(debug_info, "password", sizeof("password"), &value, sizeof(zval *), NULL);
MAKE_STD_ZVAL(value);