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


C++ zend_hash_internal_pointer_reset_ex函数代码示例

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


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

示例1: PHP_METHOD

/**
 * Resets the request and internal values to avoid those fields will have any default value
 */
PHP_METHOD(Phalcon_Tag, resetInput){

	zval *value = NULL, *key = NULL;
	zval *a0 = NULL;
	zval *g0 = NULL;
	HashTable *ah0;
	HashPosition hp0;
	zval **hd;
	char *hash_index;
	uint hash_index_len;
	ulong hash_num;
	int hash_type;

	PHALCON_MM_GROW();
	PHALCON_ALLOC_ZVAL_MM(a0);
	array_init(a0);
	phalcon_update_static_property(SL("phalcon\\tag"), SL("_displayValues"), a0 TSRMLS_CC);
	phalcon_get_global(&g0, SL("_POST")+1 TSRMLS_CC);
	if (!phalcon_valid_foreach(g0 TSRMLS_CC)) {
		return;
	}
	
	ALLOC_HASHTABLE(ah0);
	zend_hash_init(ah0, 0, NULL, NULL, 0);
	zend_hash_copy(ah0, Z_ARRVAL_P(g0), NULL, NULL, sizeof(zval*));
	zend_hash_internal_pointer_reset_ex(ah0, &hp0);
	fes_9b93_0:
		if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){
			goto fee_9b93_0;
		}
		
		PHALCON_INIT_VAR(key);
		PHALCON_GET_FOREACH_KEY(key, ah0, hp0);
		PHALCON_INIT_VAR(value);
		ZVAL_ZVAL(value, *hd, 1, 0);
		phalcon_array_unset(g0, key);
		zend_hash_move_forward_ex(ah0, &hp0);
		goto fes_9b93_0;
	fee_9b93_0:
	zend_hash_destroy(ah0);
	efree(ah0);
	
	
	PHALCON_MM_RESTORE();
}
开发者ID:codeanu,项目名称:cphalcon,代码行数:48,代码来源:tag.c

示例2: zval_to_array

VALUE zval_to_array(zval *zv) {
    HashTable *ht;
    HashPosition pos;
    zval **data;
    VALUE ret;

    convert_to_array(zv);
    ht = Z_ARRVAL_P(zv);

    ret = rb_ary_new2(zend_hash_num_elements(ht));

    zend_hash_internal_pointer_reset_ex(ht, &pos);
        while (SUCCESS == zend_hash_get_current_data_ex(ht, (void **)&data, &pos)) {
        rb_ary_push(ret, new_php_embed_value(*data));
        zend_hash_move_forward_ex(ht, &pos);
    }
    return ret;
}
开发者ID:Epictetus,项目名称:php_embed,代码行数:18,代码来源:convert.c

示例3: php_mimepart_enum_child_parts

PHP_MAILPARSE_API void php_mimepart_enum_child_parts(php_mimepart *part, mimepart_child_enumerator_func callback, void *ptr)
{
	HashPosition pos;
	php_mimepart *childpart;
	zval *childpart_z;

	int index = 0;

	zend_hash_internal_pointer_reset_ex(&part->children, &pos);
	while ((childpart_z = zend_hash_get_current_data_ex(&part->children, &pos)) != NULL) {
		mailparse_fetch_mimepart_resource(childpart, childpart_z);
		if (FAILURE == (*callback)(part, childpart, index, ptr))
			return;

		zend_hash_move_forward_ex(&part->children, &pos);
		index++;
	}
}
开发者ID:php,项目名称:pecl-mail-mailparse,代码行数:18,代码来源:php_mailparse_mime.c

示例4: msgpack_check_ht_is_map

inline static int msgpack_check_ht_is_map(zval *array) 
{
    int count = zend_hash_num_elements(Z_ARRVAL_P(array));

    if (count != (Z_ARRVAL_P(array))->nNextFreeElement) {
        return 1;
    } else {
        int i;
        HashPosition pos = {0};
        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
        for (i = 0; i < count; i++) {
            if (zend_hash_get_current_key_type_ex(Z_ARRVAL_P(array), &pos) != HASH_KEY_IS_LONG) {
                return 1;
            }
            zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos);
        }
    }
    return 0;
}
开发者ID:caoge,项目名称:php-cp,代码行数:19,代码来源:msgpack_pack.c

示例5: php_hash_to_r

static SEXP php_hash_to_r(HashTable *ht) /* {{{ */
{
	SEXP values, keys, r_element;
	int n, i;
	HashPosition pos;
	zval **element;

	n = zend_hash_num_elements(ht);
	if (!n) {
		return 0;
	}

	PROTECT(values = NEW_LIST(n));
	PROTECT(keys = NEW_CHARACTER(n));

	i = 0;
	for (zend_hash_internal_pointer_reset_ex(ht, &pos);
			zend_hash_get_current_data_ex(ht, (void **) &element, &pos) == SUCCESS;
			zend_hash_move_forward_ex(ht, &pos)
		) {
		char *string_key;
		uint string_key_len;
		ulong num_key;

		r_element = php_zval_to_r(element);

		switch (zend_hash_get_current_key_ex(ht, &string_key, &string_key_len, &num_key, 0, &pos)) {
			case HASH_KEY_IS_STRING:
				if (string_key_len > 0) {
					SET_STRING_ELT(keys, i, COPY_TO_USER_STRING(string_key));
				}
				break;

			case HASH_KEY_IS_LONG:
				/* ignore the key */
				break;
		}
		i++;
	}
	SET_NAMES(values, keys);
	UNPROTECT(2);
	return values;
}
开发者ID:tony2001,项目名称:arrr,代码行数:43,代码来源:arrr.c

示例6: mysqlnd_minfo_print_hash

PHPAPI void mysqlnd_minfo_print_hash(zval *values)
{
	zval **values_entry;
	HashPosition pos_values;

	zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos_values);
	while (zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&values_entry, &pos_values) == SUCCESS) {
		char	*string_key;
		uint	string_key_len;
		ulong	num_key;

		zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, &string_key_len, &num_key, 0, &pos_values);

		convert_to_string(*values_entry);
		php_info_print_table_row(2, string_key, Z_STRVAL_PP(values_entry));

		zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values);
	}
}
开发者ID:66Ton99,项目名称:php5.4-ppa,代码行数:19,代码来源:php_mysqlnd.c

示例7: oauth_provider_apply_custom_param

static void oauth_provider_apply_custom_param(HashTable *ht, HashTable *custom) /* {{{ */
{
	HashPosition custompos;
	zval *entry;
	zend_string *key;
	ulong num_key;

	zend_hash_internal_pointer_reset_ex(custom, &custompos);
	do {
		if ((entry = zend_hash_get_current_data_ex(custom, &custompos)) != NULL && HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(custom, &key, &num_key, &custompos)) {
			if (IS_NULL == Z_TYPE_P(entry)) {
				zend_hash_del(ht, key);
			} else {
				Z_ADDREF_P(entry);
				zend_hash_update(ht, key, entry);
			}
		}
	} while (SUCCESS==zend_hash_move_forward_ex(custom, &custompos));
}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:19,代码来源:provider.c

示例8: print_hash

static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent)
{
	zval **tmp;
	char *string_key;
	HashPosition iterator;
	ulong num_key;
	uint str_len;
	int i;

	for (i=0; i<indent; i++) {
		ZEND_PUTS_EX(" ");
	}
	ZEND_PUTS_EX("(\n");
	indent += PRINT_ZVAL_INDENT;
	zend_hash_internal_pointer_reset_ex(ht, &iterator);
	while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
		for (i=0; i<indent; i++) {
			ZEND_PUTS_EX(" ");
		}
		ZEND_PUTS_EX("[");
		switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
			case HASH_KEY_IS_STRING:
				ZEND_WRITE_EX(string_key, str_len-1);
				break;
			case HASH_KEY_IS_LONG:
				{
					char key[25];
					sprintf(key, "%ld", num_key);
					ZEND_PUTS_EX(key);
				}
				break;
		}
		ZEND_PUTS_EX("] => ");
		zend_print_zval_r_ex(write_func, *tmp, indent+PRINT_ZVAL_INDENT);
		ZEND_PUTS_EX("\n");
		zend_hash_move_forward_ex(ht, &iterator);
	}
	indent -= PRINT_ZVAL_INDENT;
	for (i=0; i<indent; i++) {
		ZEND_PUTS_EX(" ");
	}
	ZEND_PUTS_EX(")\n");
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:43,代码来源:zend.c

示例9: foreach_in_hashtable

void foreach_in_hashtable(void* callingObj, void* custom_ptr, HashTable *ht, ht_entry_callback cb TSRMLS_DC)
{
    zval **data;
    HashPosition pointer;
    HashTable *hindex = ht;
    uint key_len, key_type;
    ulong index;
    int cnt = 0;
    char *key;
    for(zend_hash_internal_pointer_reset_ex(hindex, &pointer);
        zend_hash_get_current_data_ex(hindex, (void**)&data, &pointer) == SUCCESS;
        zend_hash_move_forward_ex(hindex, &pointer)) {
        key_type = zend_hash_get_current_key_ex(hindex, &key, &key_len, &index, 0, &pointer);
        if (key_type == HASH_KEY_IS_STRING) {
            (*cb)(callingObj, custom_ptr, key, key_len, 0, data, cnt++ TSRMLS_CC);
        } else if (key_type == HASH_KEY_IS_LONG) {
            (*cb)(callingObj, custom_ptr, NULL, 0, index, data, cnt++ TSRMLS_CC);
        }
    }
}
开发者ID:Elbandi,项目名称:php_riak,代码行数:20,代码来源:ht_utils.c

示例10: zend_hash_internal_pointer_reset_ex

PHP_MAILPARSE_API php_mimepart *php_mimepart_find_child_by_position(php_mimepart *parent, int position)
{
	HashPosition pos;
	php_mimepart *childpart = NULL;
	zval *childpart_z;

	zend_hash_internal_pointer_reset_ex(&parent->children, &pos);
	while(position-- > 0)
		if (FAILURE == zend_hash_move_forward_ex(&parent->children, &pos))
			return NULL;

	if ((childpart_z = zend_hash_get_current_data_ex(&parent->children, &pos)) != NULL) {
		mailparse_fetch_mimepart_resource(childpart, childpart_z);
		if(childpart) {
			return childpart;
		}
	}

	return NULL;
}
开发者ID:php,项目名称:pecl-mail-mailparse,代码行数:20,代码来源:php_mailparse_mime.c

示例11: PHP_METHOD

/* {{{ proto bool ProtocolBuffersEnum::isValid(long $value)
*/
PHP_METHOD(protocolbuffers_enum, isValid)
{
#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 3)
	zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "ProtocolBuffersEnum::isValid can't work under PHP 5.3. please consider upgrading your PHP");
	return;
#else
	long value;
	zval *result;

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

	if (zend_call_method_with_0_params(NULL, EG(called_scope), NULL, "getenumdescriptor", &result)) {
		zval *values, **entry;
		HashPosition pos;

		if (!instanceof_function_ex(Z_OBJCE_P(result), php_protocol_buffers_enum_descriptor_class_entry, 0 TSRMLS_CC)) {
			zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "ProtocolBuffersEnum::getEnumDescriptor returns unexpected value.");
			zval_ptr_dtor(&result);
			return;
		}

		php_protocolbuffers_read_protected_property(result, ZEND_STRS("values"), &values TSRMLS_CC);
		zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos);
		while (zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&entry, &pos) == SUCCESS) {
			if (Z_LVAL_PP(entry) == value) {
				RETVAL_TRUE;
				break;
			}
			zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos);
		}
		zval_ptr_dtor(&result);
		RETVAL_FALSE;
	} else {
			zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "cannot call ProtocolBuffersEnum::getEnumDescriptor.");
			return;
	}
#endif
}
开发者ID:Easthy,项目名称:php-protocolbuffers,代码行数:43,代码来源:enum.c

示例12: pthreads_stack_pop

/* {{{ pop for php */
size_t pthreads_stack_pop(PTHREAD thread, PTHREAD work TSRMLS_DC) {
	zend_bool locked;
	int remain = 0;
	
	if (pthreads_lock_acquire(thread->lock, &locked TSRMLS_CC)) {
		HashTable *stack = &thread->stack->objects;
		if (work) {
		    HashPosition position;
		    PTHREAD search = NULL;
		    
		    for (zend_hash_internal_pointer_reset_ex(stack, &position);
		        zend_hash_get_current_data_ex(stack, (void**)&search, &position) == SUCCESS;
		        zend_hash_move_forward_ex(stack, &position)) {
		        /* arghhh */
		    }
		} else zend_hash_destroy(stack);
		remain = zend_hash_num_elements(stack);
		pthreads_lock_release(thread->lock, locked TSRMLS_CC);
	} else remain = -1;
	return remain;
} /* }}} */
开发者ID:Danack,项目名称:pthreads,代码行数:22,代码来源:object.c

示例13: wkhtmltox_set_params

void wkhtmltox_set_params(void *settings, fp set_function, zval *params)
{
    zval **data;
    HashTable *params_hash;
    HashPosition pointer;
    int params_count;
    
    char *key;
    int key_len;
    long index;
    
    params_hash = Z_ARRVAL_P(params);
    params_count = zend_hash_num_elements(params_hash);
    for(zend_hash_internal_pointer_reset_ex(params_hash, &pointer); 
            zend_hash_get_current_data_ex(params_hash, (void **)&data, &pointer) == SUCCESS; 
            zend_hash_move_forward_ex(params_hash, &pointer)) {
        zval temp = **data;
        zval_copy_ctor(&temp);
        
        if (zend_hash_get_current_key_ex(params_hash, &key, &key_len, &index, 0, &pointer) == HASH_KEY_IS_STRING) {
            switch (Z_TYPE(temp)) {
                case IS_BOOL:
                    set_function(settings, key, Z_BVAL(temp) ? "true" : "false");
                    break;
                default:
                    convert_to_string(&temp);
                case IS_STRING:
                    set_function(settings, key, Z_STRVAL(temp));
                    break;
            }
            
            /*
            convert_to_string(&temp);
            php_printf("%s => %s\n", key, Z_STRVAL(temp));
            */
        }
        
        zval_dtor(&temp);
    }
} 
开发者ID:char101,项目名称:php-wkhtmltox,代码行数:40,代码来源:phpwkhtmltox.c

示例14: php_dba_make_key

/* {{{ php_dba_myke_key */
static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
{
	if (Z_TYPE_P(key) == IS_ARRAY) {
		zval *group, *name;
		HashPosition pos;
		size_t len;

		if (zend_hash_num_elements(Z_ARRVAL_P(key)) != 2) {
			php_error_docref(NULL, E_RECOVERABLE_ERROR, "Key does not have exactly two elements: (key, name)");
			return 0;
		}
		zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos);
		group = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos);
		zend_hash_move_forward_ex(Z_ARRVAL_P(key), &pos);
		name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos);
		convert_to_string_ex(group);
		convert_to_string_ex(name);
		if (Z_STRLEN_P(group) == 0) {
			*key_str = Z_STRVAL_P(name);
			*key_free = NULL;
			return Z_STRLEN_P(name);
		}
		len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name));
		*key_free = *key_str;
		return len;
	} else {
		zval tmp;
		int len;

		ZVAL_COPY(&tmp, key);
		convert_to_string(&tmp);

		len = Z_STRLEN(tmp);
		if (len) {
			*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
		}
		zval_ptr_dtor(&tmp);
		return len;
	}
}
开发者ID:Apfelfrisch,项目名称:php-src,代码行数:41,代码来源:dba.c

示例15: oauth_provider_remove_required_param

static int oauth_provider_remove_required_param(HashTable *ht, char *required_param) /* {{{ */
{
	zval *dest_entry;
	zend_string *key;
	ulong num_key;
	HashPosition hpos;

	if((dest_entry = zend_hash_str_find(ht, required_param, strlen(required_param))) == NULL) {
		return FAILURE;
	} else {
		zend_hash_internal_pointer_reset_ex(ht, &hpos);
		do {
			if(zend_hash_get_current_key_ex(ht, &key, &num_key, &hpos)!=FAILURE) {
				if(!strcmp(ZSTR_VAL(key), required_param)) {
					zend_hash_del(ht, key);
					return SUCCESS;
				}
			}
		} while(zend_hash_move_forward_ex(ht, &hpos)==SUCCESS);
	}
	return FAILURE;
}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:22,代码来源:provider.c


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