本文整理汇总了C++中zend_read_static_property函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_read_static_property函数的具体用法?C++ zend_read_static_property怎么用?C++ zend_read_static_property使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zend_read_static_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zend_read_static_property
zval *air_config_get_data(TSRMLS_D){
zval *data = zend_read_static_property(air_config_ce, ZEND_STRL("_data"), 1 TSRMLS_CC);
if(Z_TYPE_P(data) == IS_NULL){
air_config_init_default(TSRMLS_C);
data = zend_read_static_property(air_config_ce, ZEND_STRL("_data"), 1 TSRMLS_CC);
}
return data;
}
示例2: fool_loader_instance
/*{{{ zval* get_instance(TSRMLS_D)
*/
zval* fool_loader_instance(TSRMLS_D)
{
zval* instance;
instance = zend_read_static_property(fool_loader_ce,ZEND_STRL(FOOL_LOADER_PROPERTY_NAME_INSTANCE),1 TSRMLS_CC);
if(Z_TYPE_P(instance) == IS_OBJECT){
//Z_ADDREF_P(instance); ?????????????????
return instance;
}
object_init_ex(instance,fool_loader_ce);
zend_update_static_property(fool_loader_ce,ZEND_STRL(FOOL_LOADER_PROPERTY_NAME_INSTANCE),instance TSRMLS_CC);
char* include_path;// = emalloc(strlen(FOOL_G(class_map)) + strlen(FOOL_G(config_path)) + 2);
spprintf(&include_path,0,"%s/%s",FOOLPHP_G(config_path),FOOLPHP_G(class_map));
if(instance){
//include class_map
fool_loader_include(include_path TSRMLS_CC);
efree(include_path);
return instance;
}
efree(include_path);
return NULL;
}
示例3: fool_view_instance
/**{{{ zval* get_instance(TSRMLS_D)
*/
zval* fool_view_instance(TSRMLS_D)
{
zval* instance;
zval* var;
instance = zend_read_static_property(fool_view_ce,ZEND_STRL(FOOL_VIEW_PROPERTY_NAME_INSTANCE),1 TSRMLS_CC);
if(Z_TYPE_P(instance) == IS_OBJECT){
//Z_ADDREF_P(instance); //?????????????????
return instance;
}
object_init_ex(instance,fool_view_ce);
zend_update_static_property(fool_view_ce,ZEND_STRL(FOOL_VIEW_PROPERTY_NAME_INSTANCE),instance TSRMLS_CC);
if(instance){
MAKE_STD_ZVAL(var);
array_init(var);
zend_update_property(fool_view_ce,instance,ZEND_STRL(FOOL_VIEW_PROPERTY_NAME_VAR),var TSRMLS_CC);
return instance;
}
return NULL;
}
示例4: 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;
}
示例5: 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;
}
示例6: ZEND_METHOD
ZEND_METHOD( alinq_class , Single )
{
zend_fcall_info fci;
zend_fcall_info_cache fci_cache;
zend_class_entry *ce;
ce = Z_OBJCE_P(getThis());
zval * reVal;
char aReturnType;
int aReturnTypeLen;
// aReturnType = 'bool';
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fci_cache) == FAILURE) {
return;
}
// zval *arrayValues;
zval *ALINQ_CLOSURE_RETURN_TYPE_BOOL;
ALINQ_CLOSURE_RETURN_TYPE_BOOL = zend_read_static_property(ce, "ALINQ_CLOSURE_RETURN_TYPE_BOOL", sizeof("ALINQ_CLOSURE_RETURN_TYPE_BOOL")-1, 0 TSRMLS_DC);
// walu_call_user_function(&arrayValues, getThis(), "GetApplicables", "fl", fci,1);
reVal = GetApplicables(getThis(),fci,fci_cache,1,Z_STRVAL_P(ALINQ_CLOSURE_RETURN_TYPE_BOOL),sizeof(Z_STRVAL_P(ALINQ_CLOSURE_RETURN_TYPE_BOOL)));
RETURN_ZVAL(reVal,1,1);
// php_printf("fine");
// RETURN_ZVAL(arrayValues,1,1);
// walu_call_anony_function(&arrayValues, NULL, fci, "sz", key, keylen,tmpcopy);
}
示例7: activerecord_model_assign_attributes
void activerecord_model_assign_attributes( zval * model, zval * attributes, zend_bool guard )
{
zval * accessible = zend_read_static_property(activerecord_model_ce, "attr_accessible", 15, 0 TSRMLS_CC);
zval * protected = zend_read_static_property(activerecord_model_ce, "attr_protected", 14, 0 TSRMLS_CC);
zval ** attribute;
int acc_count = zend_hash_num_elements(Z_ARRVAL_P(accessible));
int prt_count = zend_hash_num_elements(Z_ARRVAL_P(protected));
HashPosition pos;
int index, key_len;
char * key_name;
for( zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(attributes), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_P(attributes), (void **) &attribute, &pos) == SUCCESS;
zend_hash_move_forward_ex(Z_ARRVAL_P(attributes), &pos) )
{
/*
if (array_key_exists($name,$table->columns))
{
$value = $table->columns[$name]->cast($value,$connection);
$name = $table->columns[$name]->inflected_name;
}
*/
zend_hash_get_current_key_ex( Z_ARRVAL_P(attributes), &key_name, &key_len, &index, 0, &pos);
if( guard )
{
if( acc_count > 0 && !activerecord_model_array_search( accessible, key_name ) )
continue;
if( prt_count > 0 && activerecord_model_array_search( protected, key_name ) )
continue;
activerecord_model_magic_set( model, key_name, key_len, *attribute );
}
else if( strcmp(key_name, "ar_rnum__") )
{
activerecord_assign_attribute( model, key_name, key_len, *attribute );
}
}
示例8: zend_read_static_property
/**{{{
*/
zval *_getInstance(void) {
zval *instance;
instance = zend_read_static_property(mylogs_ce, ZEND_STRL(MYLOGS_INSTANCE), 0 TSRMLS_CC);
if(IS_OBJECT == Z_TYPE_P(instance)
&& instanceof_function(Z_OBJCE_P(instance), mylogs_ce TSRMLS_CC)) {
return instance;
}
MAKE_STD_ZVAL(instance);
object_init_ex(instance, mylogs_ce);
zend_update_static_property(mylogs_ce, ZEND_STRL(MYLOGS_INSTANCE), instance TSRMLS_CC);
return instance;
}
示例9: validate_thrift_object
//is used to validate objects before serialization and after deserialization. For now, only required fields are validated.
static
void validate_thrift_object(zval* object) {
zend_class_entry* object_class_entry = Z_OBJCE_P(object);
zval* is_validate = zend_read_static_property(object_class_entry, "isValidate", sizeof("isValidate")-1, false);
zval* spec = zend_read_static_property(object_class_entry, "_TSPEC", sizeof("_TSPEC")-1, false);
HashPosition key_ptr;
zval* val_ptr;
if (Z_TYPE_INFO_P(is_validate) == IS_TRUE) {
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(spec), &key_ptr);
(val_ptr = zend_hash_get_current_data_ex(Z_ARRVAL_P(spec), &key_ptr)) != nullptr;
zend_hash_move_forward_ex(Z_ARRVAL_P(spec), &key_ptr)) {
zend_ulong fieldno;
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(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
zval* zvarname = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
char* varname = Z_STRVAL_P(zvarname);
zval* is_required = zend_hash_str_find(fieldspec, "isRequired", sizeof("isRequired")-1);
zval rv;
zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false, &rv);
if (Z_TYPE_INFO_P(is_required) == IS_TRUE && Z_TYPE_P(prop) == IS_NULL) {
char errbuf[128];
snprintf(errbuf, 128, "Required field %s.%s is unset!", ZSTR_VAL(object_class_entry->name), varname);
throw_tprotocolexception(errbuf, INVALID_DATA);
}
}
}
}
示例10: PHP_METHOD
PHP_METHOD(slightphp, setZoneAlias)
{
char *zone, *alias;
int zone_len, alias_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &zone, &zone_len, &alias ,&alias_len) == FAILURE) {
RETURN_FALSE;
}
zval *zoneAlias = zend_read_static_property(slightphp_ce_ptr,"zoneAlias",sizeof("zoneAlias")-1,1 TSRMLS_CC);
if(!zoneAlias){ RETURN_FALSE; }
if(Z_TYPE_P(zoneAlias)!=IS_ARRAY){
array_init(zoneAlias);
}
add_assoc_string(zoneAlias,zone,alias,1);
zend_update_static_property(slightphp_ce_ptr,"zoneAlias",sizeof("zoneAlias")-1,zoneAlias TSRMLS_CC);
RETURN_TRUE;
}
示例11: zephir_read_static_property_ce
int zephir_read_static_property_ce(zval *result, zend_class_entry *ce, const char *property, int len, int flags)
{
zval *tmp = zend_read_static_property(ce, property, len, (zend_bool) ZEND_FETCH_CLASS_SILENT);
//zval_ptr_dtor(result);
ZVAL_NULL(result);
if (tmp)
{
if ((flags & PH_READONLY) == PH_READONLY) {
ZVAL_COPY_VALUE(result, tmp);
} else {
ZVAL_COPY(result, tmp);
}
return SUCCESS;
}
return FAILURE;
}
示例12: PHP_METHOD
/* {{{ PHP METHODS */
PHP_METHOD(air_async_service, __construct) {
AIR_INIT_THIS;
zval *waiter = NULL;
zval *request = NULL;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &waiter, &request) == FAILURE){
AIR_NEW_EXCEPTION(1, "invalid __construct params");
}
//check if waiter is instance of air\waiter
if(Z_TYPE_P(waiter) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(waiter), air_async_waiter_ce TSRMLS_CC)) {
air_throw_exception(1, "param waiter must be a instance of air\\waiter");
}
zend_update_property(air_async_service_ce, self, ZEND_STRL("_waiter"), waiter TSRMLS_CC);
zend_update_property(air_async_service_ce, self, ZEND_STRL("request"), request TSRMLS_CC);
zval *__id = zend_read_static_property(air_async_service_ce, ZEND_STRL("__id"), 0 TSRMLS_CC);
(*__id).value.lval++;
zend_update_property_long(air_async_service_ce, self, ZEND_STRL("_id"), Z_LVAL_P(__id) TSRMLS_CC);
}
示例13: yaf_trigger_error
/** {{{void yaf_trigger_error(int type TSRMLS_DC, char *format, ...)
*/
void yaf_trigger_error(int type TSRMLS_DC, char *format, ...) {
va_list args;
char *message;
uint msg_len;
va_start(args, format);
msg_len = vspprintf(&message, 0, format, args);
va_end(args);
if (YAF_G(throw_exception)) {
yaf_throw_exception(type, message TSRMLS_CC);
} else {
yaf_application_t *app = zend_read_static_property(yaf_application_ce, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_APP), 1 TSRMLS_CC);
zend_update_property_long(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_ERRNO), type TSRMLS_CC);
zend_update_property_stringl(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_ERRMSG), message, msg_len TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, message);
}
efree(message);
}
示例14: fool_application_instance
/*{{{ zval* fool_application_instance(TSRMLS_D)
*/
zval* fool_application_instance(TSRMLS_D)
{
zval* instance;
zval* dispatcher;
zval* loader;
instance = zend_read_static_property(fool_application_ce,ZEND_STRL(FOOL_APPLICATION_PROPERTY_NAME_INSTANCE),1 TSRMLS_CC);
if(Z_TYPE_P(instance) == IS_OBJECT){
//Z_ADDREF_P(instance);
return instance;
}
object_init_ex(instance,fool_application_ce);
zend_update_static_property(fool_application_ce,ZEND_STRL(FOOL_APPLICATION_PROPERTY_NAME_INSTANCE),instance TSRMLS_CC);
if(instance){
//init dispatcher
dispatcher = fool_dispatcher_instance(TSRMLS_C);
if(!dispatcher){
return NULL;
}
loader = fool_loader_instance(TSRMLS_CC);
if(!loader){
return NULL;
}
fool_loader_register_autoload(loader TSRMLS_CC);
zend_update_property(fool_application_ce,instance,ZEND_STRL(FOOL_APPLICATION_PROPERTY_NAME_DISPATCHER),dispatcher TSRMLS_CC);
//init config
fool_config_init(TSRMLS_C);
//init object
fool_object_instance(TSRMLS_C);
return instance;
}
return NULL;
}
示例15: Copyright
/*{{{LICENSE
+-----------------------------------------------------------------------+
| slightphp Framework |
+-----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation. You should have received a copy of the |
| GNU General Public License along with this program. If not, see |
| http://www.gnu.org/licenses/. |
| Copyright (C) 2008-2009. All Rights Reserved. |
+-----------------------------------------------------------------------+
| Supports: http://www.slightphp.com |
+-----------------------------------------------------------------------+
}}}*/
int debug(char*format,...){
TSRMLS_FETCH();
zval *_debug_flag = zend_read_static_property(slightphp_ce_ptr,"_debug",sizeof("_debug")-1,1 );
convert_to_long(_debug_flag);
if(Z_LVAL_P(_debug_flag))
{
va_list args;
char *buffer;
int size;
TSRMLS_FETCH();
va_start(args, format);
size = vspprintf(&buffer, 0, format, args);
_php_error_log(0,buffer,NULL,NULL );
zend_printf("<!--slightphp debug:%s-->",buffer);
efree(buffer);
va_end(args);
}
zval_dtor(_debug_flag);
}