当前位置: 首页>>代码示例>>C++>>正文


C++ zend_read_property函数代码示例

本文整理汇总了C++中zend_read_property函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_read_property函数的具体用法?C++ zend_read_property怎么用?C++ zend_read_property使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zend_read_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PHP_METHOD

PHP_METHOD(SolrCollapseFunction, __construct)
{
    long int index = SOLR_UNIQUE_FUNCTION_INDEX();
    uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE;
    solr_function_t *solr_function_dest = NULL;
    solr_function_t solr_function;
    zval *index_prop, *zvfield = NULL;

    solr_char_t *param_name = (solr_char_t *)"field";
    int param_name_len = sizeof("field");

    solr_string_t field_str;

    solr_char_t *field_name = NULL;
    int field_name_len = 0;

    memset(&solr_function, 0, sizeof(solr_function_t));

    if (zend_hash_index_update(SOLR_GLOBAL(functions),index,(void *) &solr_function, sizeof(solr_function_t), (void **) &solr_function_dest) == FAILURE)
    {
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable");

        return ;
    }
    index_prop = zend_read_property(Z_OBJCE_P(getThis()), getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1 TSRMLS_CC);
    Z_LVAL_P(index_prop) = index;

    solr_function_dest->function_index = index;
    solr_function_dest->name = (solr_char_t *)"collapse";
    solr_function_dest->name_length = sizeof(solr_function_dest->name);

    /* Allocated memory for the params HashTable using fast cache for HashTables */
    ALLOC_HASHTABLE(solr_function_dest->params);
    zend_hash_init(solr_function_dest->params, nSize, NULL, (dtor_func_t) solr_string_free_ex, SOLR_FUNCTIONS_PERSISTENT);

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE)
    {
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error Parsing Parameters");
        return;
    }

    if (field_name_len > 0 ) {
        memset(&field_str, 0, sizeof(solr_string_t));
        solr_string_set(&field_str, (solr_char_t *)field_name, field_name_len);
        if(zend_hash_update(solr_function_dest->params, param_name, param_name_len, (void **)&field_str, sizeof(solr_string_t), NULL) == FAILURE)
        {
            php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field");
        }
    }
}
开发者ID:marcosptf,项目名称:pecl-search_engine-solr,代码行数:50,代码来源:php_solr_collapse_function.c

示例2: PHP_METHOD

/*{{{ public Fool_Application::run(void)
 */
PHP_METHOD(fool_application,run)
{
	zval* response;
	zval* dispatcher;

	zval* self = getThis();


	dispatcher = zend_read_property(fool_application_ce,self,ZEND_STRL(FOOL_APPLICATION_PROPERTY_NAME_DISPATCHER),1 TSRMLS_CC);
	if((response = fool_dispatcher_dispatch(dispatcher TSRMLS_CC))){
		RETURN_ZVAL(response,1,1);
	}
	RETURN_FALSE;
}
开发者ID:jasonshaw,项目名称:FoolPHP,代码行数:16,代码来源:fool_application.c

示例3: PHP_METHOD

/** {{{ public ZePageSet::prev()
 */
PHP_METHOD(ze_pageset, prev) {
	zval * self        = NULL;
	zval * end_row      = NULL;
	zval * current     = NULL;
	int    pre_page     = 0;

	self = getThis();

	current = zend_read_property(ze_pageset_ce, self, ZEND_STRL(ZE_CURRENT), 0 TSRMLS_CC);
	pre_page = Z_LVAL_P(current) - 1;
	pre_page = (pre_page >= 1) ? pre_page : 1;

	RETURN_LONG(pre_page);
}
开发者ID:eixom,项目名称:zoeeyphp,代码行数:16,代码来源:pageset.c

示例4: PHP_METHOD

PHP_METHOD(air_mysql_waiter, step_2) {
	AIR_INIT_THIS;
	zval *services = zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("_services"), 0 TSRMLS_CC);
	zval *responses = zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("_responses"), 0 TSRMLS_CC);
	zval *context = zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("_context"), 0 TSRMLS_CC);
	zval *m2s = air_arr_find(context, ZEND_STRS("m2s"));
	zval *reads = air_arr_find(context, ZEND_STRS("reads"));
	zval *waited = air_arr_find(context, ZEND_STRS("waited"));
	zval *processed = air_arr_find(context, ZEND_STRS("processed"));
	zval *step = air_arr_find(context, ZEND_STRS("step"));
	zend_class_entry *mysqli_ce = air_get_ce(ZEND_STRL("mysqli") TSRMLS_CC);

	ulong idx;
	char *key;
	int key_len;
	zval *mysqli;
	AIR_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(reads), idx, key, key_len, mysqli){
		zval *service_id = air_arr_idx_find(m2s, air_mysqli_get_id(mysqli TSRMLS_CC));
		zval *service = air_arr_idx_find(services, Z_LVAL_P(service_id));
		zval *mysql = zend_read_property(air_async_service_ce, service, ZEND_STRL("_request"), 0 TSRMLS_CC);
		zval **trigger_params[2];
		zval *event;
		MAKE_STD_ZVAL(event);
		zval *event_params;
		MAKE_STD_ZVAL(event_params);
		array_init(event_params);
		Z_ADDREF_P(mysqli);
		add_next_index_zval(event_params, mysqli);
		zval *mysqli_result = NULL;
		if(air_mysqli_get_errno(mysqli TSRMLS_CC)){
			ZVAL_STRING(event, "error", 1);
		}else{
			ZVAL_STRING(event, "success", 1);
			air_call_method(&mysqli, mysqli_ce, NULL, ZEND_STRL("reap_async_query"), &mysqli_result, 0, NULL TSRMLS_CC);
			Z_ADDREF_P(mysqli_result);
			add_next_index_zval(event_params, mysqli_result);
		}
		trigger_params[0] = &event;
		trigger_params[1] = &event_params;
		zval *results = NULL;
		air_call_method(&mysql, air_mysql_ce, NULL, ZEND_STRL("trigger"), &results, 2, trigger_params TSRMLS_CC);
		if(results){
			add_index_zval(responses, Z_LVAL_P(service_id), results);
		}else{
			php_error(E_WARNING, "error on trigger event %s with no results", Z_STRVAL_P(event));
		}
		zend_hash_index_del(Z_ARRVAL_P(services), Z_LVAL_P(service_id));
		zval_ptr_dtor(&event);
		zval_ptr_dtor(&event_params);
		if(mysqli_result){
			zval_ptr_dtor(&mysqli_result);
		}
		zval *mysql_config = zend_read_property(air_mysql_ce, mysql, ZEND_STRL("_config"), 0 TSRMLS_CC);
		zval *mode = zend_read_property(air_mysql_ce, mysql, ZEND_STRL("_mode"), 0 TSRMLS_CC);
		zval **release_params[3] = {&mysqli, &mysql_config, &mode};
		air_call_static_method(air_mysql_keeper_ce, "release", NULL, 3, release_params);
	}AIR_HASH_FOREACH_END();
开发者ID:wukezhan,项目名称:air,代码行数:57,代码来源:air_mysql_waiter.c

示例5: activerecord_model_magic_set

zval * activerecord_model_magic_set( zval * model, char * name, int name_len, zval * value )
{
    zval ** alias, * retval = NULL;

    if( zend_hash_find( Z_ARRVAL_P(zend_read_static_property(activerecord_model_ce, "alias_attribute", 15, 0 TSRMLS_CC)), name, name_len, (void**)&alias ) == SUCCESS )
    {
        efree( name );
        emalloc( name, sizeof( Z_STRVAL_PP(alias) ) );
        strncpy( name, Z_STRVAL_PP(alias), Z_STRLEN_PP(alias) );
        name_len = Z_STRLEN_PP(alias);
    }
    else
    {
        char *method_name;
        emalloc( method_name, sizeof(name)+4 );
        strcpy( method_name, "set_" );
        strcat( method_name, name );
        if( activerecord_model_array_search( zend_read_property( activerecord_model_ce, this_ptr, "setters", 7, 0 TSRMLS_CC ), method_name) )
        {
            zend_call_method( &this_ptr, activerecord_model_ce, NULL, method_name, sizeof(method_name), &retval, 0, NULL, NULL TSRMLS_CC );
            efree( name );
            RETURN_ZVAL( retval, 0, 0 );
        }
    }

    if( zend_hash_find( Z_ARRVAL_P(zend_read_property(activerecord_model_ce, model, "attributes", 10, 0 TSRMLS_CC)), name, name_len ) == SUCCESS )
    {
        retval = activerecord_model_assign_attribute( model, name, name_len, value );
    }

    efree( name );
    if( retval == NULL );
    // throw new exception

    RETURN_ZVAL( retval, 0, 0 );
}
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:36,代码来源:activerecord_model.c

示例6: PHP_METHOD

PHP_METHOD(dataserv, insdata) {
	int i=0, fstart=1, fend=1;
	char * table;
	zval * self = getThis();
	zval * fields;

	table = Z_STRVAL_P(zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("table"), 0 TSRMLS_CC));
	fstart = Z_LVAL_P(zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("start"), 0 TSRMLS_CC));
	fend = Z_LVAL_P(zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("end"), 0 TSRMLS_CC));
	fields = zend_read_property(Z_OBJCE_P(self), self, ZEND_STRL("fields"), 0 TSRMLS_CC);

	FILE * fp = NULL;
	char path[1024]={0x00};
	sprintf(path, "%s.sql", table);
	fp = VCWD_FOPEN( path, "ab+" );

	if( fp == NULL )
	{
		php_printf("Open file %s fail:%d.\n", path, errno );
		return;
	}

	fend = fstart+fend;
	for( i = fstart ; i <= fend; ++ i )
	{
		char *output;
		output = (char *)emalloc(1024 * 100 * sizeof(char));
		memset(output, 0x00, 1024 * 100 * sizeof(char));
		getfields(fields, output);
		fprintf(fp,"%s\n",output);
		efree(output);
		if(i%100 == 0) printf("has %d insert into the files.\n", i);
	}
//	printf("LOAD DATA INFILE '$datadir' INTO TABLE $tablename FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES STARTING BY '\\n';\n");
	fclose(fp);
}
开发者ID:justpaybank,项目名称:dataserv,代码行数:36,代码来源:dataserv.c

示例7: riak_bucket_local_or_client_setting

/* helper method for fetching settings like r, rw etc. either from client or from bucket */
PHPAPI long riak_bucket_local_or_client_setting(zval *client_instance, zval *bucket_instance, long user_value, char *setting_key, int setting_key_len TSRMLS_DC) {
    zval *client_value;
    zval *bucket_value;

    
    if (user_value != 0) {
        return user_value;
    }

    client_value = zend_read_property(riak_ce_riakClient, client_instance, setting_key, setting_key_len, 0 TSRMLS_CC);
    bucket_value = zend_read_property(riak_ce_riakBucket, bucket_instance, setting_key, setting_key_len, 0 TSRMLS_CC);    
    
    if (Z_TYPE_P(bucket_value) == IS_LONG) {
        return Z_LVAL_P(bucket_value);
    }
    
    if (Z_TYPE_P(client_value) == IS_LONG) {
        return Z_LVAL_P(client_value);
    }
    
    zend_error(E_WARNING, "Setting neither on client nor bucket found, using default value 0");
    
    return 0;
}
开发者ID:maxbeutel,项目名称:ext.riak,代码行数:25,代码来源:riakBucket.c

示例8: PHP_METHOD

/* {{{ proto array Riak\MapReduce\Phase\MapPhase->toArray()
Convert this phase into an array */
PHP_METHOD(Riak_MapReduce_Phase_MapPhase, toArray)
{
    zval *zarray, *zfuncarray, *zfunc, *zarg, zname;
    zend_bool keep;
    MAKE_STD_ZVAL(zarray);
    array_init(zarray);

    MAKE_STD_ZVAL(zfuncarray);
    zfunc = zend_read_property(riak_mr_mapphase_ce, getThis(), "function", sizeof("function")-1, 1 TSRMLS_CC);
    ZVAL_STRING(&zname, "toArray", 0);
    call_user_function(NULL, &zfunc, &zname, zfuncarray, 0, NULL TSRMLS_CC);

    keep = Z_BVAL_P(zend_read_property(riak_mr_mapphase_ce, getThis(), "keep", sizeof("keep")-1, 1 TSRMLS_CC));
    if (keep) {
        add_assoc_bool_ex(zfuncarray, "keep", sizeof("keep"), 1);
    }
    add_assoc_zval_ex(zarray, "map", sizeof("map"), zfuncarray);
    zarg = zend_read_property(riak_mr_mapphase_ce, getThis(), "arg", sizeof("arg")-1, 1 TSRMLS_CC);
    if (Z_TYPE_P(zarg) != IS_NULL) {
        add_assoc_zval_ex(zarray, "arg", sizeof("arg"), zarg);
        zval_addref_p(zarg);
    }
    RETURN_ZVAL(zarray, 0, 1);
}
开发者ID:FabioBatSilva,项目名称:php_riak,代码行数:26,代码来源:map_phase.c

示例9: money_handler_compare_objects

static int money_handler_compare_objects(zval *object1, zval *object2)
{
	zval *amount1, *amount2, *currency1, *currency2;
	long compare_result;

	currency1 = zend_read_property(Z_OBJCE_P(object1), object1, MONEY_PROP_CURRENCY_WS, 0);
	currency2 = zend_read_property(Z_OBJCE_P(object2), object2, MONEY_PROP_CURRENCY_WS, 0);

	if ((compare_result = Z_OBJ_HANDLER_P(currency1, compare_objects)(currency1, currency2)) != 0) {
		zend_throw_exception(CurrencyMismatchException_ce, "Currencies don't match", 0);
		return compare_result;
	}

	amount1 = zend_read_property(Z_OBJCE_P(object1), object1, MONEY_PROP_AMOUNT_WS, 0);
	amount2 = zend_read_property(Z_OBJCE_P(object2), object2, MONEY_PROP_AMOUNT_WS, 0);

	if (Z_LVAL_P(amount1) == Z_LVAL_P(amount2)) {
		return 0;
	} else if(Z_LVAL_P(amount1) < Z_LVAL_P(amount2)) {
		return -1;
	}

	return 1;
}
开发者ID:Peekmo,项目名称:money,代码行数:24,代码来源:money.c

示例10: PHP_METHOD

PHP_METHOD(Money, extractPercentage)
{
	long percentage;
	double result;
	zval *new_money_percentage, *amount, *new_money_subtotal;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &percentage) == FAILURE) {
		return;
	}

	ALLOC_INIT_ZVAL(new_money_percentage);ALLOC_INIT_ZVAL(new_money_subtotal);

	amount = zend_read_property(money_ce, getThis(), MONEY_PROP_AMOUNT_WS, 0);
	result = Z_LVAL_P(amount) / (100 + percentage) * percentage;

	CREATE_NEW_MONEY_OBJ(new_money_percentage, zend_dval_to_lval(result), zend_read_property(money_ce, getThis(), MONEY_PROP_CURRENCY_WS, 0))

	array_init(return_value);
	add_assoc_zval(return_value, "percentage", new_money_percentage);

	money_handler_do_operation(ZEND_SUB, new_money_subtotal, getThis(), new_money_percentage);

	add_assoc_zval(return_value, "subtotal", new_money_subtotal);
}
开发者ID:Peekmo,项目名称:money,代码行数:24,代码来源:money.c

示例11: PHP_METHOD

/** {{{ public ZeStatus::getName()
 */
PHP_METHOD(ze_status, getName) {
	zval * self        = NULL;
	zval * name        = NULL;

	self = getThis();

	name = zend_read_property(ze_status_ce, self, ZEND_STRL(ZE_NAME), 1 TSRMLS_CC);
	
	if (name) {
		RETURN_ZVAL(name, 1, 0);
	}

	RETURN_NULL();

}
开发者ID:eixom,项目名称:zoeeyphp,代码行数:17,代码来源:status.c

示例12: websocket_handshake

static int websocket_handshake(http_client *client)
{

    //HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: %s\r\nSec-WebSocket-Version: %s\r\nKeepAlive: off\r\nContent-Length: 0\r\nServer: ZWebSocket\r\n
    TSRMLS_FETCH_FROM_CTX(sw_thread_ctx ? sw_thread_ctx : NULL);
    zval *header = zend_read_property(swoole_http_request_class_entry_ptr, client->zrequest, ZEND_STRL("header"), 1 TSRMLS_CC);
    HashTable *ht = Z_ARRVAL_P(header);
    zval **pData;
    if(zend_hash_find(ht, ZEND_STRS("sec-websocket-key") , (void **) &pData) == FAILURE) {
        php_error_docref(NULL TSRMLS_CC, E_WARNING, "header no sec-websocket-key");
        return SW_ERR;
    }
    convert_to_string(*pData);
//    swTrace("key: %s len:%d\n", Z_STRVAL_PP(pData), Z_STRLEN_PP(pData));
    swString *buf = swString_new(256);
    swString_append_ptr(buf, ZEND_STRL("HTTP/1.1 101 Switching Protocols\r\n"));
    swString_append_ptr(buf, ZEND_STRL("Upgrade: websocket\r\nConnection: Upgrade\r\n"));
    swString *shaBuf = swString_new(Z_STRLEN_PP(pData)+36);
    swString_append_ptr(shaBuf, Z_STRVAL_PP(pData), Z_STRLEN_PP(pData));
    swString_append_ptr(shaBuf, ZEND_STRL(SW_WEBSOCKET_GUID));

    char data_str[20];
//    bzero(data_str, sizeof(data_str));
//    swTrace("sha1 start:%s\n", shaBuf->str);
    sha1(shaBuf->str, (unsigned char *) data_str);

    char encoded_value[50];
    bzero(encoded_value, sizeof(encoded_value));
//    swTrace("base64_encode start:%d\n", sizeof(data_str));
    swBase64_encode((unsigned char *) data_str, 20, encoded_value);
//    swTrace("base64_encode end:%s %d %d\n", encoded_value, encoded_len, strlen(encoded_value));
    char _buf[128];
    int n = 0;
    n = snprintf(_buf, strlen(encoded_value)+25, "Sec-WebSocket-Accept: %s\r\n", encoded_value);
//    efree(data_str);
//    efree(encoded_value);
    swString_free(shaBuf);
//    swTrace("accept value: %s\n", _buf);
    swString_append_ptr(buf, _buf, n);
    swString_append_ptr(buf, ZEND_STRL("Sec-WebSocket-Version: 13\r\n"));
    swString_append_ptr(buf, ZEND_STRL("Server: swoole-websocket\r\n\r\n"));
    swTrace("websocket header len:%zd\n%s \n", buf->length, buf->str);

    int ret = swServer_tcp_send(SwooleG.serv, client->fd, buf->str, buf->length);
    swString_free(buf);
//    swTrace("handshake send: %d lenght: %d\n", client->fd, ret);
    return ret;
}
开发者ID:solomylove,项目名称:swoole-src,代码行数:48,代码来源:swoole_http.c

示例13: http_request_on_query_string

static int http_request_on_query_string(php_http_parser *parser, const char *at, size_t length)
{
    TSRMLS_FETCH_FROM_CTX(sw_thread_ctx ? sw_thread_ctx : NULL);

    http_client *client = parser->data;
    char *query = estrndup(at, length);

    zval *get;
    MAKE_STD_ZVAL(get);
    array_init(get);
    zend_update_property(swoole_http_request_class_entry_ptr, client->zrequest, ZEND_STRL("get"), get TSRMLS_CC);
    sapi_module.treat_data(PARSE_STRING, query, get TSRMLS_CC);
    ZEND_SET_SYMBOL(&EG(symbol_table), "_GET", get);
    zval *_request = zend_read_property(swoole_http_request_class_entry_ptr, client->zrequest, ZEND_STRL("request"), 1 TSRMLS_CC);
    zend_hash_copy(Z_ARRVAL_P(_request), Z_ARRVAL_P(get), NULL, NULL, sizeof(zval));
    return 0;
}
开发者ID:lord2cc,项目名称:swoole-src,代码行数:17,代码来源:swoole_http.c

示例14: ZEND_METHOD

ZEND_METHOD(exception, __wakeup)
{
	zval value, *pvalue;
	zval *object = getThis();
	CHECK_EXC_TYPE(ZEND_STR_MESSAGE,  IS_STRING);
	CHECK_EXC_TYPE(ZEND_STR_STRING,   IS_STRING);
	CHECK_EXC_TYPE(ZEND_STR_CODE,     IS_LONG);
	CHECK_EXC_TYPE(ZEND_STR_FILE,     IS_STRING);
	CHECK_EXC_TYPE(ZEND_STR_LINE,     IS_LONG);
	CHECK_EXC_TYPE(ZEND_STR_TRACE,    IS_ARRAY);
	pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
	if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
			!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
			pvalue == object)) {
		zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
	}
}
开发者ID:WarnerBe,项目名称:php-src,代码行数:17,代码来源:zend_exceptions.c

示例15: TSRMLS_FETCH

static IPYNotation *get_pinyin_notation(zval *cls)
{
    zval        *pylink;
    IPYNotation *pynotation;
    TSRMLS_FETCH();
    pylink     = zend_read_property(Z_OBJCE_P(cls), cls, ZEND_STRL("_pynotation"), 0 TSRMLS_CC);
    pynotation = (IPYNotation *)zend_fetch_resource(&pylink TSRMLS_CC, -1,
                     PINYIN_NOTATION_LINK_DESC, NULL, 1, le_pinyin_notation_link);

    if (!pynotation) {
        php_error_docref(NULL TSRMLS_CC,
                         E_WARNING,
                         "Wrong resource handler for IPYNotation.");
    }

    return pynotation;
}
开发者ID:naiyue,项目名称:php-pinyin,代码行数:17,代码来源:pinyin.cpp


注:本文中的zend_read_property函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。