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


C++ zend_hash_get_current_key_ex函数代码示例

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


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

示例1: array

/* complete -
	should deal either with:
			hash keys = keys, hash values = values
			hash = array( keys, values )
			hash = array( value )
*/
void activerecord_sql_create_where_zval( activerecord_sql *sql, zval *hash )
{
	int len, i = 0;
	zval **value;
	char **keys, **values;
	HashPosition pos;

	if( Z_TYPE_P(hash) != IS_ARRAY )
		/* throw exception */;

	len = zend_hash_num_elements( Z_ARRVAL_P(hash) );
	keys = (char**)emalloc( sizeof(char*)*len );
	values = (char**)emalloc( sizeof(char*)*len );

	for( 
		zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(joins), &pos);
		zend_hash_get_current_data_ex(Z_ARRVAL_P(joins), (void **)&value, &pos) == SUCCESS;
		zend_hash_move_forward_ex(Z_ARRVAL_P(joins), &pos)
	)
	{
		zval **key;
		int key_len;

		if( HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &key, &key_len, &j, 0, &pos) )
		{
			keys[i] = key;
			values[i] = Z_STRVAL_PP(value);
		}
	}

	activerecord_sql_create_where( sql, keys, values, len );
}
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:38,代码来源:activerecord_sql.c

示例2: binary_serialize_spec

static
void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec) {
    HashPosition key_ptr;
    zval* val_ptr;

    for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr);
            (val_ptr = zend_hash_get_current_data_ex(spec, &key_ptr)) != nullptr;
            zend_hash_move_forward_ex(spec, &key_ptr)) {

        zend_ulong fieldno;
        if (zend_hash_get_current_key_ex(spec, nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) {
            throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
            return;
        }
        HashTable* fieldspec = Z_ARRVAL_P(val_ptr);

        // field name
        val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
        char* varname = Z_STRVAL_P(val_ptr);

        // thrift type
        val_ptr = zend_hash_str_find(fieldspec, "type", sizeof("type")-1);
        if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
        int8_t ttype = Z_LVAL_P(val_ptr);

        zval rv;
        zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv);
        if (Z_TYPE_P(prop) != IS_NULL) {
            transport.writeI8(ttype);
            transport.writeI16(fieldno);
            binary_serialize(ttype, transport, prop, fieldspec);
        }
    }
    transport.writeI8(T_STOP); // struct end
}
开发者ID:angejia,项目名称:thrift,代码行数:35,代码来源:php_thrift_protocol7.cpp

示例3: util_array_flatten

void util_array_flatten(zval* arr, zval* result, zend_bool preserve_keys) {
	zval **zvalue;
	char *key;
	uint keylen;
	ulong idx;
	int type;
	HashTable* arr_hash;
	HashPosition pointer;

	// Copy a temp array
	zval temp;
	temp = *arr;
	zval_copy_ctor(&temp);

	arr_hash = Z_ARRVAL_P(&temp);
	zend_hash_internal_pointer_reset_ex(arr_hash, &pointer);
	while (zend_hash_get_current_data_ex(arr_hash, (void**) &zvalue, &pointer) == SUCCESS) {
		if (Z_TYPE_P(*zvalue) == IS_ARRAY) {
			util_array_flatten(*zvalue, result, preserve_keys);
		} else {
			type = zend_hash_get_current_key_ex(arr_hash, &key, &keylen, &idx, 0, &pointer);
			if (preserve_keys && type != HASH_KEY_IS_LONG) {
				add_assoc_zval(result, key, *zvalue);
			} else {
				add_next_index_zval(result, *zvalue);
			}
		}
		zend_hash_move_forward_ex(arr_hash, &pointer);
		//ALLOC_INIT_ZVAL(*zvalue);
	}
}
开发者ID:CraryPrimitiveMan,项目名称:util,代码行数:31,代码来源:util.c

示例4: activerecord_is_options_hash

zend_bool activerecord_is_options_hash( zval * arr, zend_bool throw_e )
{
    HashPosition pos;
    char * key;
    int key_len, res;

    if( !activerecord_is_hash(arr) )
        return 0;

    for(
        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
        HASH_KEY_NON_EXISTANT != (res = zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &key, &key_len, &j, 0, &pos));
        zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos)
    )
    {
        int i;

        if( res != HASH_KEY_IS_STRING )
            /* throw exception */;

        found = false;
        for( i = 0; i < 11; i++ )
        {
            if( !strncmp(activerecord_valid_options[i], key, key_len) )
                found = true;
        }
        if( !found && throw_e)
            /* throw exception */;
    }

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

示例5: 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) {
		zstr	string_key;
		uint	string_key_len;
		ulong	num_key;
		int		s_len;
		char	*s = NULL;

		TSRMLS_FETCH();
		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);

		if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
								   &s, &s_len, string_key.u, string_key_len TSRMLS_CC) == SUCCESS) {
			php_info_print_table_row(2, s, Z_STRVAL_PP(values_entry));
		}
		if (s) {
			mnd_efree(s);
		}

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

示例6: binary_serialize_hashtable_key

static
void binary_serialize_hashtable_key(int8_t keytype, PHPOutputTransport& transport, HashTable* ht, HashPosition& ht_pos) {
  bool keytype_is_numeric = (!((keytype == T_STRING) || (keytype == T_UTF8) || (keytype == T_UTF16)));

  zend_string* key;
  uint key_len;
  long index = 0;

  zval z;

  int res = zend_hash_get_current_key_ex(ht, &key, (zend_ulong*)&index, &ht_pos);
  if (keytype_is_numeric) {
    if (res == HASH_KEY_IS_STRING) {
      index = strtol(ZSTR_VAL(key), nullptr, 10);
    }
    ZVAL_LONG(&z, index);
  } else {
    char buf[64];
    if (res == HASH_KEY_IS_STRING) {
      ZVAL_STR_COPY(&z, key);
    } else {
      snprintf(buf, 64, "%ld", index);
      ZVAL_STRING(&z, buf);
    }
  }
  binary_serialize(keytype, transport, &z, nullptr);
  zval_dtor(&z);
}
开发者ID:apupier,项目名称:fn,代码行数:28,代码来源:php_thrift_protocol7.cpp

示例7: php_mimepart_remove_from_parent

PHP_MAILPARSE_API void php_mimepart_remove_from_parent(php_mimepart *part)
{
	php_mimepart *parent = part->parent;
	HashPosition pos;
	php_mimepart *childpart;
	zval *childpart_z;

	if (parent == NULL)
		return;

	part->parent = NULL;

	zend_hash_internal_pointer_reset_ex(&parent->children, &pos);
	while((childpart_z = zend_hash_get_current_data_ex(&parent->children, &pos)) != NULL) {
		if ((childpart_z = zend_hash_get_current_data_ex(&parent->children, &pos)) != NULL) {
			mailparse_fetch_mimepart_resource(childpart, childpart_z);
			if (childpart == part) {
				ulong h;
				zend_hash_get_current_key_ex(&parent->children, NULL, &h, &pos);
				zend_hash_index_del(&parent->children, h);
				break;
			}
		}
		zend_hash_move_forward_ex(&parent->children, &pos);
	}
}
开发者ID:php,项目名称:pecl-mail-mailparse,代码行数:26,代码来源:php_mailparse_mime.c

示例8: zend_hash_get_current_key_ex

int CPHPArray::get_key()
{
	ulong retval;
	zend_hash_get_current_key_ex(Z_ARRVAL_P(m_arr), NULL, NULL, &retval, 0, &m_pos);

	return retval;
};
开发者ID:tantra35,项目名称:PyRender,代码行数:7,代码来源:PHPArray.cpp

示例9: PHP_METHOD

/* {{{ proto array SolrInputDocument::getFieldNames(void)
   Returns an array of all the field names in the document. */
PHP_METHOD(SolrInputDocument, getFieldNames)
{
	solr_document_t *doc_entry = NULL;

	/* Retrieve the document entry for the SolrDocument instance */
	if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS)
	{
		HashTable *fields_ht = doc_entry->fields;
		register zend_bool duplicate = 0;

		array_init(return_value);

		SOLR_HASHTABLE_FOR_LOOP(fields_ht)
		{
			char *fieldname       = NULL;
			uint fieldname_length = 0U;
			ulong num_index       = 0L;

			solr_field_list_t **field      = NULL;
			zend_bool duplicate_field_name = 1;

			zend_hash_get_current_key_ex(fields_ht, &fieldname, &fieldname_length, &num_index, duplicate, NULL);
			zend_hash_get_current_data_ex(fields_ht, (void **) &field, NULL);

			add_next_index_string(return_value, (char *) (*field)->field_name, duplicate_field_name);
		}

		/* We are done */
		return;
	}
开发者ID:cfgxy,项目名称:php-solr,代码行数:32,代码来源:php_solr_input_document.c

示例10: PHP_METHOD

// CHash method setTargets(array(<target> => <weight> [, ...])) -> long
PHP_METHOD(CHash, setTargets)
{
    HashPosition position;
    chash_object *instance = (chash_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
    zval         *targets, **weight;
    char         *target;
    ulong        unused;
    uint         length;
    int          status;

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &targets) != SUCCESS)
    {
        RETURN_LONG(chash_return(instance, CHASH_ERROR_INVALID_PARAMETER))
    }
    if ((status = chash_clear_targets(&(instance->context))) < 0)
    {
        RETURN_LONG(chash_return(instance, status))
    }
    for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(targets), &position);
         zend_hash_get_current_key_ex(Z_ARRVAL_P(targets), &target, &length, &unused, 0, &position) == HASH_KEY_IS_STRING &&
         zend_hash_get_current_data_ex(Z_ARRVAL_P(targets), (void **)&weight, &position) == SUCCESS &&
         Z_TYPE_PP(weight) == IS_LONG;
         zend_hash_move_forward_ex(Z_ARRVAL_P(targets), &position))
    {
        if ((status = chash_add_target(&(instance->context), target, Z_LVAL_PP(weight))) < 0)
        {
            RETURN_LONG(chash_return(instance, status))
        }
    }
    RETURN_LONG(chash_return(instance, chash_targets_count(&(instance->context))))
}
开发者ID:dailymotion,项目名称:chash,代码行数:32,代码来源:chash.c

示例11: rpb_print_hashtable

void rpb_print_hashtable(HashTable *arr_hash) {
    HashPosition pointer;

        char *str_key;
    uint key_len;
    ulong int_key;
    zval **data;
    
    for(zend_hash_internal_pointer_reset_ex(arr_hash, &pointer); zend_hash_get_current_data_ex(arr_hash, (void**) &data, &pointer) == SUCCESS; zend_hash_move_forward_ex(arr_hash, &pointer)) {
        

        zend_hash_get_current_key_ex(arr_hash, &str_key, &key_len, &int_key,0, &pointer);
        if(zend_hash_get_current_key_type_ex(arr_hash, &pointer) == IS_STRING) {
      //      zend_print_pval_r(str_key,0);
            printf("%s\n", str_key);
        }
        else {
            printf("%s\n", str_key);

          //  zend_print_pval_r(data,0);
        }
        
        
        
    }

}
开发者ID:nickjenkin,项目名称:Ruby-PHP-Bridge,代码行数:27,代码来源:php_helpers.c

示例12: binary_serialize_hashtable_key

void binary_serialize_hashtable_key(int8_t keytype, PHPOutputTransport& transport, HashTable* ht, HashPosition& ht_pos) {
    bool keytype_is_numeric = (!((keytype == T_STRING) || (keytype == T_UTF8) || (keytype == T_UTF16)));

    char* key;
    uint key_len;
    long index = 0;

    zval* z;
    MAKE_STD_ZVAL(z);

    int res = zend_hash_get_current_key_ex(ht, &key, &key_len, (ulong*)&index, 0, &ht_pos);
    if (keytype_is_numeric) {
        if (res == HASH_KEY_IS_STRING) {
            index = strtol(key, NULL, 10);
        }
        ZVAL_LONG(z, index);
    } else {
        char buf[64];
        if (res == HASH_KEY_IS_STRING) {
            key_len -= 1; // skip the null terminator
        } else {
            sprintf(buf, "%ld", index);
            key = buf;
            key_len = strlen(buf);
        }
        ZVAL_STRINGL(z, key, key_len, 1);
    }
    binary_serialize(keytype, transport, &z, NULL);
    zval_ptr_dtor(&z);
}
开发者ID:wmorgan,项目名称:thrift,代码行数:30,代码来源:php_thrift_protocol.cpp

示例13: 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

示例14: 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

示例15: binary_serialize_spec

void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec) {
    HashPosition key_ptr;
    zval** val_ptr;

    TSRMLS_FETCH();
    zend_class_entry* ce = zend_get_class_entry(zthis TSRMLS_CC);

    for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr); zend_hash_get_current_data_ex(spec, (void**)&val_ptr, &key_ptr) == SUCCESS; zend_hash_move_forward_ex(spec, &key_ptr)) {
        ulong fieldno;
        if (zend_hash_get_current_key_ex(spec, NULL, NULL, &fieldno, 0, &key_ptr) != HASH_KEY_IS_LONG) {
            throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
            return;
        }
        HashTable* fieldspec = Z_ARRVAL_PP(val_ptr);

        // field name
        zend_hash_find(fieldspec, "var", 4, (void**)&val_ptr);
        char* varname = Z_STRVAL_PP(val_ptr);

        // thrift type
        zend_hash_find(fieldspec, "type", 5, (void**)&val_ptr);
        if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
        int8_t ttype = Z_LVAL_PP(val_ptr);

        zval* prop = zend_read_property(ce, zthis, varname, strlen(varname), false TSRMLS_CC);
        if (Z_TYPE_P(prop) != IS_NULL) {
            transport.writeI8(ttype);
            transport.writeI16(fieldno);
            binary_serialize(ttype, transport, &prop, fieldspec);
        }
    }
    transport.writeI8(T_STOP); // struct end
}
开发者ID:wmorgan,项目名称:thrift,代码行数:33,代码来源:php_thrift_protocol.cpp


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