本文整理汇总了C++中PHPInputTransport::readI16方法的典型用法代码示例。如果您正苦于以下问题:C++ PHPInputTransport::readI16方法的具体用法?C++ PHPInputTransport::readI16怎么用?C++ PHPInputTransport::readI16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPInputTransport
的用法示例。
在下文中一共展示了PHPInputTransport::readI16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: binary_deserialize_spec
void binary_deserialize_spec(const Object& zthis, PHPInputTransport& transport,
const Array& spec) {
// SET and LIST have 'elem' => array('type', [optional] 'class')
// MAP has 'val' => array('type', [optiona] 'class')
while (true) {
Variant val;
int8_t ttype = transport.readI8();
if (ttype == T_STOP) return;
int16_t fieldno = transport.readI16();
if (!(val = spec.rvalAt(fieldno)).isNull()) {
Array fieldspec = val.toArray();
// pull the field name
// zend hash tables use the null at the end in the length... so strlen(hash key) + 1.
String varname = fieldspec.rvalAt(PHPTransport::s_var).toString();
// and the type
int8_t expected_ttype = fieldspec.rvalAt(PHPTransport::s_type).toInt64();
if (ttypes_are_compatible(ttype, expected_ttype)) {
Variant rv = binary_deserialize(ttype, transport, fieldspec);
zthis->o_set(varname, rv, zthis->getClassName());
} else {
skip_element(ttype, transport);
}
} else {
skip_element(ttype, transport);
}
}
}
示例2: binary_deserialize_spec
static
void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec) {
// SET and LIST have 'elem' => array('type', [optional] 'class')
// MAP has 'val' => array('type', [optiona] 'class')
zend_class_entry* ce = Z_OBJCE_P(zthis);
while (true) {
int8_t ttype = transport.readI8();
if (ttype == T_STOP) {
validate_thrift_object(zthis);
return;
}
int16_t fieldno = transport.readI16();
zval* val_ptr = zend_hash_index_find(spec, fieldno);
if (val_ptr != nullptr) {
HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
// pull the field name
val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
char* varname = Z_STRVAL_P(val_ptr);
// and the 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 expected_ttype = Z_LVAL_P(val_ptr);
if (ttypes_are_compatible(ttype, expected_ttype)) {
zval rv;
ZVAL_UNDEF(&rv);
binary_deserialize(ttype, transport, &rv, fieldspec);
zend_update_property(ce, zthis, varname, strlen(varname), &rv);
zval_ptr_dtor(&rv);
} else {
skip_element(ttype, transport);
}
} else {
skip_element(ttype, transport);
}
}
}
示例3: binary_deserialize_spec
void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec) {
// SET and LIST have 'elem' => array('type', [optional] 'class')
// MAP has 'val' => array('type', [optiona] 'class')
TSRMLS_FETCH();
zend_class_entry* ce = zend_get_class_entry(zthis TSRMLS_CC);
while (true) {
zval** val_ptr = NULL;
int8_t ttype = transport.readI8();
if (ttype == T_STOP) return;
int16_t fieldno = transport.readI16();
if (zend_hash_index_find(spec, fieldno, (void**)&val_ptr) == SUCCESS) {
HashTable* fieldspec = Z_ARRVAL_PP(val_ptr);
// pull the field name
// zend hash tables use the null at the end in the length... so strlen(hash key) + 1.
zend_hash_find(fieldspec, "var", 4, (void**)&val_ptr);
char* varname = Z_STRVAL_PP(val_ptr);
// and the 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 expected_ttype = Z_LVAL_PP(val_ptr);
if (ttypes_are_compatible(ttype, expected_ttype)) {
zval* rv = NULL;
MAKE_STD_ZVAL(rv);
binary_deserialize(ttype, transport, rv, fieldspec);
zend_update_property(ce, zthis, varname, strlen(varname), rv TSRMLS_CC);
zval_ptr_dtor(&rv);
} else {
skip_element(ttype, transport);
}
} else {
skip_element(ttype, transport);
}
}
}