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


C++ zend_hash_internal_pointer_reset函数代码示例

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


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

示例1: PHP_METHOD

PHP_METHOD(MIME, load) {
	zval *array, *arg, retval;

	/* Fetch allowHEAD */
	MAKE_STD_ZVAL(array);
	array_init_size(array, 2);
	add_next_index_stringl(array, "Pancake\\Config", sizeof("Pancake\\Config") - 1, 1);
	add_next_index_stringl(array, "get", 3, 1);

	MAKE_STD_ZVAL(arg);
	Z_TYPE_P(arg) = IS_STRING;
	Z_STRLEN_P(arg) = 4;
	Z_STRVAL_P(arg) = estrndup("mime", 4);

	call_user_function(CG(function_table), NULL, array, &retval, 1, &arg TSRMLS_CC);

	if(Z_TYPE(retval) != IS_ARRAY) {
		zend_error(E_ERROR, "Bad MIME type array - Please check Pancake MIME type configuration");
	}

	ALLOC_HASHTABLE(PANCAKE_GLOBALS(mimeTable));
	zend_hash_init(PANCAKE_GLOBALS(mimeTable), 0, NULL, ZVAL_PTR_DTOR, 0);

	zval **data, **ext;
	char *key;

	for(zend_hash_internal_pointer_reset(Z_ARRVAL(retval));
		zend_hash_get_current_data(Z_ARRVAL(retval), (void**) &data) == SUCCESS &&
		zend_hash_get_current_key(Z_ARRVAL(retval), &key, NULL, 0) == HASH_KEY_IS_STRING;
		zend_hash_move_forward(Z_ARRVAL(retval))) {

		for(zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));
			zend_hash_get_current_data(Z_ARRVAL_PP(data), (void**) &ext) == SUCCESS;
			zend_hash_move_forward(Z_ARRVAL_PP(data))) {

			zval *zkey;
			MAKE_STD_ZVAL(zkey);
			Z_TYPE_P(zkey) = IS_STRING;
			Z_STRLEN_P(zkey) = strlen(key);
			Z_STRVAL_P(zkey) = estrndup(key, Z_STRLEN_P(zkey));

			zend_hash_add(PANCAKE_GLOBALS(mimeTable), Z_STRVAL_PP(ext), Z_STRLEN_PP(ext), (void*) &zkey, sizeof(zval*), NULL);
		}
	}

	MAKE_STD_ZVAL(PANCAKE_GLOBALS(defaultMimeType));
	Z_TYPE_P(PANCAKE_GLOBALS(defaultMimeType)) = IS_STRING;
	Z_STRLEN_P(PANCAKE_GLOBALS(defaultMimeType)) = sizeof("application/octet-stream") - 1;
	Z_STRVAL_P(PANCAKE_GLOBALS(defaultMimeType)) = estrndup("application/octet-stream", sizeof("application/octet-stream") - 1);

	free:
	zval_dtor(&retval);
	zval_ptr_dtor(&array);
	zval_ptr_dtor(&arg);
}
开发者ID:nhnam,项目名称:Pancake,代码行数:55,代码来源:Pancake_MIME.c

示例2: PHP_METHOD

/**
 * Rewinds resultset to its beginning
 *
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind){

	zval *type, *z_zero, *rows;

	z_zero = &PHALCON_GLOBAL(z_zero);

	type = phalcon_read_property(getThis(), SL("_type"), PH_NOISY);
	if (zend_is_true(type)) {

		/** 
		 * Here, the resultset act as a result that is fetched one by one
		 */
		zval *result = phalcon_read_property(getThis(), SL("_result"), PH_NOISY);
		if (PHALCON_IS_NOT_FALSE(result)) {

			zval *active_row = phalcon_read_property(getThis(), SL("_activeRow"), PH_NOISY);
			if (Z_TYPE_P(active_row) != IS_NULL) {
				PHALCON_MM_GROW();
				PHALCON_CALL_METHOD(NULL, result, "dataseek", z_zero);
				PHALCON_MM_RESTORE();
			}
		}
	} else {
		/** 
		 * Here, the resultset act as an array
		 */
		rows = phalcon_read_property(getThis(), SL("_rows"), PH_NOISY);
		if (Z_TYPE_P(rows) == IS_NULL) {

			zval *result = phalcon_read_property(getThis(), SL("_result"), PH_NOISY);
			if (Z_TYPE_P(result) == IS_OBJECT) {
				zval *r = NULL;
				PHALCON_CALL_METHODW(&r, result, "fetchall");
				if (likely(Z_TYPE_P(r) == IS_ARRAY)) {
					zend_hash_internal_pointer_reset(Z_ARRVAL_P(r));
				}

				phalcon_update_property_this(getThis(), SL("_rows"), r);
				zval_ptr_dtor(r);
			}
		}
		else if (Z_TYPE_P(rows) == IS_ARRAY) {
			zend_hash_internal_pointer_reset(Z_ARRVAL_P(rows));
		}
	}

	phalcon_update_property_this(getThis(), SL("_pointer"), z_zero);
}
开发者ID:Myleft,项目名称:cphalcon7,代码行数:52,代码来源:resultset.c

示例3: pip_hash_to_list

/* {{{ pip_hash_to_list(zval **hash)
   Convert a PHP hash to a Python list */
PyObject *
pip_hash_to_list(zval **hash)
{
	PyObject *list, *item;
	zval **entry;
	long pos = 0;

	/* Make sure we were given a PHP hash */
	if (Z_TYPE_PP(hash) != IS_ARRAY) {
		return NULL;
	}

	/* Create a list with the same number of elements as the hash */
	list = PyList_New(zend_hash_num_elements(Z_ARRVAL_PP(hash)));

	/* Let's start at the very beginning, a very good place to start. */
	zend_hash_internal_pointer_reset(Z_ARRVAL_PP(hash));

	/* Iterate over the hash's elements */
	while (zend_hash_get_current_data(Z_ARRVAL_PP(hash),
									  (void **)&entry) == SUCCESS) {

		/* Convert the PHP value to its Python equivalent */
		item = pip_zval_to_pyobject(entry);

		/* Add this item to the list and increment the position */
		PyList_SetItem(list, pos++, item);

		/* Advance to the next entry */
		zend_hash_move_forward(Z_ARRVAL_PP(hash));
	}

	return list;
}
开发者ID:demos,项目名称:Motif,代码行数:36,代码来源:pip_convert.c

示例4: PHP_METHOD

/**
 * @brief void Phalcon\Registry::rewind()
 */
PHP_METHOD(Phalcon_Registry, rewind){

	zval data = {};

	phalcon_read_property(&data, getThis(), SL("_data"), PH_NOISY);
	zend_hash_internal_pointer_reset(Z_ARRVAL(data));
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:10,代码来源:registry.c

示例5: air_arr_del_index_el

zval* air_arr_del_index_el(zval *arr) {
	HashTable *ht = Z_ARRVAL_P(arr);
	zval *tmp;
	MAKE_STD_ZVAL(tmp);
	array_init(tmp);
	for(
		zend_hash_internal_pointer_reset(ht);
		zend_hash_has_more_elements(ht) == SUCCESS;
		zend_hash_move_forward(ht)
	){
		int type;
		ulong idx;
		char *key;
		uint key_len;
		zval **tmp_data;

		type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL);
		if(type == HASH_KEY_IS_STRING){
			if(zend_hash_get_current_data(ht, (void**)&tmp_data) != FAILURE) {
				add_assoc_stringl_ex(tmp, key, key_len, Z_STRVAL_PP(tmp_data), Z_STRLEN_PP(tmp_data), 1);
			}
		}
	}
	return tmp;
}
开发者ID:jaykizhou,项目名称:air,代码行数:25,代码来源:air_router.c

示例6: MAKE_STD_ZVAL

/* {{{ static zval* array_to_hash */
static zval *array_to_hash(zval *array)
{
	zval *hash, **entry;
	char *name_lc;

	/*
	 * Well, this just transposes the array, popularly known as flipping it, or
	 * giving it the finger.
	 */
	MAKE_STD_ZVAL(hash);
	array_init(hash);
	for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
		 zend_hash_get_current_data(Z_ARRVAL_P(array), (void**)&entry) == SUCCESS;
		 zend_hash_move_forward(Z_ARRVAL_P(array))) {
		if (Z_TYPE_PP(entry) == IS_STRING) {
			/*
			 * I hate case-insensitivity. Die, die, die.
			 */
			name_lc = estrndup(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
			zend_str_tolower(name_lc, Z_STRLEN_PP(entry));
			add_assoc_bool_ex(hash, name_lc, Z_STRLEN_PP(entry)+1, 1);
			efree(name_lc);
		}
	}

	return hash;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:28,代码来源:aggregation.c

示例7: yaf_application_is_module_name

/** {{{ int yaf_application_is_module_name(char *name, int len TSRMLS_DC)
 *	判断名称是否是已经注册了的module的名称
*/
int yaf_application_is_module_name(char *name, int len TSRMLS_DC) {
	zval 				*modules, **ppzval;
	HashTable 			*ht;
	yaf_application_t 	*app;
	/* 获取类的实例,$app = self::$_app */
	app = zend_read_static_property(yaf_application_ce, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_APP), 1 TSRMLS_CC);
	if (!app || Z_TYPE_P(app) != IS_OBJECT) {
		return 0;
	}
	/* $modules = $this->_modules */
	modules = zend_read_property(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_MODULES), 1 TSRMLS_CC);
	if (!modules || Z_TYPE_P(modules) != IS_ARRAY) {
		return 0;
	}
	/* 检测name是否在$this->_modules数组中,在就返回1,不在返回0 */
	ht = Z_ARRVAL_P(modules);
	zend_hash_internal_pointer_reset(ht);
	while (zend_hash_get_current_data(ht, (void **)&ppzval) == SUCCESS) {
		if (Z_TYPE_PP(ppzval) == IS_STRING && Z_STRLEN_PP(ppzval) == len
				&& strncasecmp(Z_STRVAL_PP(ppzval), name, len) == 0) {
			return 1;
		}
		zend_hash_move_forward(ht);
	}
	return 0;
}
开发者ID:vicenteforever,项目名称:annotated_yaf_source,代码行数:29,代码来源:yaf_application.c

示例8: yaf_application_is_module_name

/** {{{ int yaf_application_is_module_name(char *name, int len TSRMLS_DC)
*/
int yaf_application_is_module_name(char *name, int len TSRMLS_DC) {
	zval 			*modules, **ppzval;
	HashTable 		*ht;
	yaf_application_t 	*app;

	app = zend_read_static_property(yaf_application_ce, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_APP), 1 TSRMLS_CC);
	if (Z_TYPE_P(app) != IS_OBJECT) {
		return 0;
	}

	modules = zend_read_property(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_MODULES), 1 TSRMLS_CC);
	if (Z_TYPE_P(modules) != IS_ARRAY) {
		return 0;
	}

	ht = Z_ARRVAL_P(modules);
	zend_hash_internal_pointer_reset(ht);
	while (zend_hash_get_current_data(ht, (void **)&ppzval) == SUCCESS) {
		if (Z_STRLEN_PP(ppzval) == len && strncasecmp(Z_STRVAL_PP(ppzval), name, len) == 0) {
			return 1;
		}
		zend_hash_move_forward(ht);
	}
	return 0;
}
开发者ID:Alhep,项目名称:php-yaf,代码行数:27,代码来源:yaf_application.c

示例9: create_php_config

void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
{
	php_conf_rec *d = base_conf, *e = new_conf, *n = NULL;
	php_dir_entry *pe;
	php_dir_entry *data;
	char *str;
	uint str_len;
	ulong num_index;

	n = create_php_config(p, "merge_php_config");
	zend_hash_copy(&n->config, &e->config, NULL, NULL, sizeof(php_dir_entry));

	phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n));
	for (zend_hash_internal_pointer_reset(&d->config);
			zend_hash_get_current_key_ex(&d->config, &str, &str_len, 
				&num_index, 0, NULL) == HASH_KEY_IS_STRING;
			zend_hash_move_forward(&d->config)) {
		pe = NULL;
		zend_hash_get_current_data(&d->config, (void **) &data);
		if (zend_hash_find(&n->config, str, str_len, (void **) &pe) == SUCCESS) {
			if (pe->status >= data->status) continue;
		}
		zend_hash_update(&n->config, str, str_len, data, sizeof(*data), NULL);
		phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
	}

	return n;
}
开发者ID:Doap,项目名称:php-src,代码行数:28,代码来源:apache_config.c

示例10: activerecord_extract_validate_options

zval * activerecord_extract_validate_options( zval * arr )
{
    zval * retval;

    MAKE_STD_ZVAL( retval );
    array_init( retval );

    if( Z_TYPE_P(arr) == IS_ARRAY && zend_hash_num_elements( Z_ARRVAL_P(arr) ) > 0 )
    {
        zval **last;
        char *key;
        int key_len, j;

        zend_hash_internal_pointer_end(Z_ARRVAL_P(arr));
        zend_hash_get_current_data(Z_ARRVAL_P(arr), (void **)&last);

        if( activerecord_is_options_hash(last, 0) )
        {
            retval = last;
            zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &key, &key_len, &j, 0, NULL);
            zend_hash_del_key_or_index(Z_ARRVAL_P(arr), key, key_len, j, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX);
            if( !key_len && j >= Z_ARRVAL_P(arr)->nNextFreeElement - 1 )
                Z_ARRVAL_P(arr)->nNextFreeElement = Z_ARRVAL_P(arr)->nNextFreeElement - 1;
            zend_hash_internal_pointer_reset(Z_ARRVAL_P(arr));
        }
        else
        {
            if( !activerecord_is_hash(last) )
                /* throw exception */;
            zend_hash_add( Z_ARRVAL_P(retval), "conditions", 10, last, sizeof(zval*), NULL );
        }
    }

    return retval;
}
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:35,代码来源:activerecord_model.c

示例11: phar_dir_seek

/**
 * Used for seeking on a phar directory handle
 */
static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset) /* {{{ */
{
	HashTable *data = (HashTable *)stream->abstract;

	if (!data) {
		return -1;
	}

	if (whence == SEEK_END) {
		whence = SEEK_SET;
		offset = zend_hash_num_elements(data) + offset;
	}

	if (whence == SEEK_SET) {
		zend_hash_internal_pointer_reset(data);
	}

	if (offset < 0) {
		return -1;
	} else {
		*newoffset = 0;
		while (*newoffset < offset && zend_hash_move_forward(data) == SUCCESS) {
			++(*newoffset);
		}
		return 0;
	}
}
开发者ID:GreenLightt,项目名称:php-src,代码行数:30,代码来源:dirstream.c

示例12: PHP_METHOD

PHP_METHOD(air_router, reset) {
	AIR_INIT_THIS;

	zval *original_rules = zend_read_property(air_router_ce, self, ZEND_STRL("_original_rules"), 1 TSRMLS_CC);
	HashTable *ro = Z_ARRVAL_P(original_rules);
	zend_hash_internal_pointer_reset(ro);
	php_error(E_NOTICE, "router cursor has been reset");
	AIR_RET_THIS;
}
开发者ID:jaykizhou,项目名称:air,代码行数:9,代码来源:air_router.c

示例13: PHP_METHOD

/* {{{ proto int symbol.setpoints(array points)
   Set the points of the symbol ) */ 
PHP_METHOD(symbolObj, setPoints)
{
    zval *zpoints, **ppzval;
    HashTable *points_hash = NULL;
    zval *zobj = getThis();
    int index = 0, flag = 0, numelements = 0;
    php_symbol_object *php_symbol;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a",
                              &zpoints) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_symbol = (php_symbol_object *) zend_object_store_get_object(zobj TSRMLS_CC);
    points_hash = Z_ARRVAL_P(zpoints);

    numelements = zend_hash_num_elements(points_hash);
    if ((numelements == 0) || (numelements % 2 != 0))
    {
        mapscript_report_php_error(E_WARNING, 
                                   "symbol->setpoints : invalid array of %d element(s) as parameter." TSRMLS_CC, numelements);
        RETURN_LONG(MS_FAILURE);
        
    }

    for(zend_hash_internal_pointer_reset(points_hash); 
        zend_hash_has_more_elements(points_hash) == SUCCESS; 
        zend_hash_move_forward(points_hash))
    { 
        
        zend_hash_get_current_data(points_hash, (void **)&ppzval);
        if (Z_TYPE_PP(ppzval) != IS_DOUBLE)
            convert_to_double(*ppzval);
	     
        if (!flag)
        {
            php_symbol->symbol->points[index].x = Z_DVAL_PP(ppzval);
            php_symbol->symbol->sizex = MS_MAX(php_symbol->symbol->sizex, php_symbol->symbol->points[index].x);
        }
        else
        {
            php_symbol->symbol->points[index].y = Z_DVAL_PP(ppzval);
            php_symbol->symbol->sizey = MS_MAX(php_symbol->symbol->sizey, php_symbol->symbol->points[index].y);
            index++;
        }    
        flag = !flag;
    }

    php_symbol->symbol->numpoints = (numelements/2);

    RETURN_LONG(MS_SUCCESS);
}
开发者ID:bb1ackwe11,项目名称:mapserver,代码行数:57,代码来源:symbol.c

示例14: php_get_warnings

/* {{{ MYSQLI_WARNING *php_get_warnings(MYSQL *mysql) */
MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql)
{
	MYSQLI_WARNING	*w, *first = NULL, *prev = NULL;
	MYSQL_RES		*result;
	zval			row;

	if (mysql->m->query(mysql, "SHOW WARNINGS", 13)) {
		return NULL;
	}

	result = mysql->m->use_result(mysql, 0);

	for (;;) {
		zval *entry;
		int errno;

		mysqlnd_fetch_into(result, MYSQLND_FETCH_NUM, &row, MYSQLND_MYSQLI);
		if (Z_TYPE(row) != IS_ARRAY) {
			zval_ptr_dtor(&row);
			break;
		}
		zend_hash_internal_pointer_reset(Z_ARRVAL(row));
		/* 0. we don't care about the first */
		zend_hash_move_forward(Z_ARRVAL(row));

		/* 1. Here comes the error no */
		entry = zend_hash_get_current_data(Z_ARRVAL(row));
		convert_to_long_ex(entry);
		errno = Z_LVAL_P(entry);
		zend_hash_move_forward(Z_ARRVAL(row));

		/* 2. Here comes the reason */
		entry = zend_hash_get_current_data(Z_ARRVAL(row));

		w = php_new_warning(entry, errno);
		/*
		  Don't destroy entry, because the row destroy will decrease
		  the refcounter. Decreased twice then mysqlnd_free_result()
		  will crash, because it will try to access already freed memory.
		*/
		if (!first) {
			first = w;
		}
		if (prev) {
			prev->next = (void *)w;
		}
		prev = w;

		zval_ptr_dtor(&row);
	}

	mysql_free_result(result);
	return first;
}
开发者ID:13572293130,项目名称:php-src,代码行数:55,代码来源:mysqli_warning.c

示例15: php_map_from_HasTable

/**
 * Convert a php Array to a map
 *
 * @param t the php Array to convert
 * @return the created map
 */
map* php_map_from_HasTable(HashTable* t){
#ifdef DEBUG
  fprintf(stderr,"mapsFromPHPArray start\n");
#endif
  map* final_res=(map*)malloc(MAP_SIZE);
  final_res=NULL;
  char key[1024];
  for(zend_hash_internal_pointer_reset(t);
      zend_hash_has_more_elements(t) == SUCCESS;
      zend_hash_move_forward(t)) {
    char *key;
    uint keylen;
    ulong idx;
    int type;
    int len;
    zval **ppzval, tmpcopy;
    type = zend_hash_get_current_key_ex(t, &key, &keylen, &idx, 0, NULL); 
    if (zend_hash_get_current_data(t, (void**)&ppzval) == FAILURE) { 
      /* Should never actually fail * since the key is known to exist. */ 
      continue; 
    }
    /**
     * Duplicate the zval so that * the orignal’s contents are not destroyed 
     */ 
    tmpcopy = **ppzval; 
    zval_copy_ctor(&tmpcopy); 
    /**
     * Reset refcount & Convert 
     */ 
    INIT_PZVAL(&tmpcopy); 
    convert_to_string(&tmpcopy);
    if(strncmp(key,"value",5)==0){
      len=Z_STRLEN_P(&tmpcopy);      
	  final_res = addToMapWithSize(final_res,key,Z_STRVAL_P(&tmpcopy),len);
    }
    else{
      if(final_res==NULL){
#ifdef DEBUG
	fprintf(stderr,"%s => %s\n",key,Z_STRVAL(tmpcopy));
#endif
	final_res=createMap(key,Z_STRVAL(tmpcopy));
      }
      else{
#ifdef DEBUG
	fprintf(stderr,"%s => %s\n",key,Z_STRVAL(tmpcopy));
#endif
	addToMap(final_res,key,Z_STRVAL(tmpcopy));
      }
    }
    /* Toss out old copy */ 
    zval_dtor(&tmpcopy); 
  }
  return final_res;
}
开发者ID:OSGeo,项目名称:zoo-project,代码行数:60,代码来源:service_internal_php.c


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