本文整理汇总了C++中PHALCON_CPY_WRT函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_CPY_WRT函数的具体用法?C++ PHALCON_CPY_WRT怎么用?C++ PHALCON_CPY_WRT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_CPY_WRT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Check whether resource exist in the resources list
*
* @param string $resourceName
* @return boolean
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, isResource){
zval *resource_name, *resources_names, *is_resource = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &resource_name) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_OBS_VAR(resources_names);
phalcon_read_property(&resources_names, this_ptr, SL("_resourcesNames"), PH_NOISY_CC);
PHALCON_INIT_VAR(r0);
ZVAL_BOOL(r0, phalcon_array_isset(resources_names, resource_name));
PHALCON_CPY_WRT(is_resource, r0);
RETURN_NCTOR(is_resource);
}
示例2: PHP_METHOD
/**
* Phalcon_Translate_Adapter_Array constructor
*
* @param array $data
*/
PHP_METHOD(Phalcon_Translate_Adapter_Array, __construct){
zval *options = NULL, *data = NULL;
zval *r0 = NULL;
zval *i0 = NULL, *i1 = NULL;
zval *c0 = NULL, *c1 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &options) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
eval_int = phalcon_array_isset_string(options, "content", strlen("content")+1);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r0);
phalcon_array_fetch_string(&r0, options, "content", strlen("content"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(data, r0);
if (Z_TYPE_P(data) != IS_ARRAY) {
PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, phalcon_translate_exception_ce);
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "Translation data must be an array", 1);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", c0, PHALCON_CHECK);
phalcon_throw_exception(i0 TSRMLS_CC);
return;
}
} else {
PHALCON_ALLOC_ZVAL_MM(i1);
object_init_ex(i1, phalcon_translate_exception_ce);
PHALCON_INIT_VAR(c1);
ZVAL_STRING(c1, "Translation content was not provided", 1);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i1, "__construct", c1, PHALCON_CHECK);
phalcon_throw_exception(i1 TSRMLS_CC);
return;
}
phalcon_update_property_zval(this_ptr, "_traslate", strlen("_traslate"), data TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例3: PHP_METHOD
/**
* Returns the translation related to the given key
*
* @param string $index
* @param array $placeholders
* @param string $domain
* @return string
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, query){
zval *index, *placeholders = NULL, *domain = NULL;
zval *translation, *key = NULL, *value = NULL, *key_placeholder = NULL, *replaced = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
char *msgstr;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 2, &index, &placeholders, &domain);
if (!domain) {
msgstr = gettext(Z_STRVAL_P(index));
} else {
msgstr = dgettext(Z_STRVAL_P(domain), Z_STRVAL_P(index));
}
PHALCON_INIT_VAR(translation);
ZVAL_STRING(translation, msgstr, 1);
if (placeholders && Z_TYPE_P(placeholders) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(placeholders))) {
phalcon_is_iterable(placeholders, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(key, ah0, hp0);
PHALCON_GET_HVALUE(value);
PHALCON_INIT_NVAR(key_placeholder);
PHALCON_CONCAT_SVS(key_placeholder, "%", key, "%");
PHALCON_INIT_NVAR(replaced);
phalcon_fast_str_replace(replaced, key_placeholder, value, translation);
PHALCON_CPY_WRT(translation, replaced);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
RETURN_CTOR(translation);
}
示例4: PHP_METHOD
/**
* Phalcon_Transaction constructor
*
* @param boolean $autoBegin
*/
PHP_METHOD(Phalcon_Transaction, __construct){
zval *a0 = NULL, *a1 = NULL;
zval *v0 = NULL, *v1 = NULL;
zval *r0 = NULL, *r1 = NULL;
zval *t0 = NULL;
zval *p0[] = { NULL };
PHALCON_MM_GROW();
PHALCON_INIT_VAR(a0);
array_init(a0);
zend_update_property(phalcon_transaction_class_entry, this_ptr, "_dependencies", strlen("_dependencies"), a0 TSRMLS_CC);
PHALCON_INIT_VAR(a1);
array_init(a1);
zend_update_property(phalcon_transaction_class_entry, this_ptr, "_messages", strlen("_messages"), a1 TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &v0) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!v0) {
PHALCON_INIT_VAR(v0);
ZVAL_BOOL(v0, 0);
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_INIT_VAR(p0[0]);
ZVAL_BOOL(p0[0], 1);
PHALCON_CALL_STATIC_PARAMS(r0, "phalcon_db_pool", "getconnection", 1, p0);
PHALCON_CPY_WRT(v1, r0);
phalcon_update_property_zval(this_ptr, "_connection", strlen("_connection"), v1 TSRMLS_CC);
PHALCON_INIT_VAR(t0);
ZVAL_BOOL(t0, 1);
PHALCON_ALLOC_ZVAL_MM(r1);
is_equal_function(r1, v0, t0 TSRMLS_CC);
if (zend_is_true(r1)) {
PHALCON_CALL_METHOD_NORETURN(v1, "begin", PHALCON_CALL_DEFAULT);
}
PHALCON_MM_RESTORE();
RETURN_NULL();
}
示例5: PHP_METHOD
/**
* Handles user-defined error
*
* @param int $severity
* @param string $message
* @param string $file
* @param string $line
* @param array $context
* @return boolean
*/
PHP_METHOD(Phalcon_Debug, onUserDefinedError){
zval *severity, *message, *file = NULL, *line = NULL, *context = NULL, *e, *previous = NULL, *exception;
zend_class_entry *default_exception_ce;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 3, &severity, &message, &file, &line, &context);
if (!file) {
file = PHALCON_GLOBAL(z_null);
}
if (!line) {
line = PHALCON_GLOBAL(z_null);
}
if (context && Z_TYPE_P(context) == IS_ARRAY) {
if (
phalcon_array_isset_string_fetch(&e, context, SS("e")) &&
Z_TYPE_P(e) == IS_OBJECT &&
instanceof_function_ex(Z_OBJCE_P(e), zend_exception_get_default(TSRMLS_C), 1 TSRMLS_CC)
) {
PHALCON_CPY_WRT(previous, e);
} else {
previous = PHALCON_GLOBAL(z_null);
}
} else {
previous = PHALCON_GLOBAL(z_null);
}
default_exception_ce = zend_get_error_exception(TSRMLS_C);
ALLOC_INIT_ZVAL(exception);
object_init_ex(exception, default_exception_ce);
PHALCON_CALL_METHOD(NULL, exception, "__construct", message, PHALCON_GLOBAL(z_zero), severity, file, line, previous);
zend_throw_exception_object(exception TSRMLS_CC);
RETURN_MM_TRUE;
}
示例6: PHP_METHOD
/**
* Dumps the complete result of a query into an array
*
* @param string $sqlQuery
* @param int $fetchMode
* @return array
*/
PHP_METHOD(Phalcon_Db, fetchAll){
zval *sql_query = NULL, *fetch_mode = NULL, *results = NULL, *result = NULL;
zval *row = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &sql_query, &fetch_mode) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!fetch_mode) {
PHALCON_ALLOC_ZVAL_MM(fetch_mode);
ZVAL_LONG(fetch_mode, 2);
}
PHALCON_INIT_VAR(results);
array_init(results);
PHALCON_INIT_VAR(result);
PHALCON_CALL_METHOD_PARAMS_1(result, this_ptr, "query", sql_query, PH_NO_CHECK);
if (Z_TYPE_P(result) == IS_OBJECT) {
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", fetch_mode, PH_NO_CHECK);
ph_cycle_start_0:
PHALCON_INIT_VAR(r0);
PHALCON_CALL_METHOD(r0, result, "fetcharray", PH_NO_CHECK);
PHALCON_CPY_WRT(row, r0);
if (!zend_is_true(row)) {
goto ph_cycle_end_0;
}
phalcon_array_append(&results, row, PH_SEPARATE TSRMLS_CC);
goto ph_cycle_start_0;
ph_cycle_end_0:
if(0){}
}
RETURN_CTOR(results);
}
示例7: PHP_METHOD
/**
* Choose a view different to render than last-controller/last-action
*
* <code>
* class ProductsController extends Phalcon\Mvc\Controller
* {
*
* public function saveAction()
* {
*
* //Do some save stuff...
*
* //Then show the list view
* $this->view->pick("products/list");
* }
* }
* </code>
*
* @param string $renderView
*/
PHP_METHOD(Phalcon_Mvc_View, pick){
zval *render_view = NULL, *separator = NULL, *pick_view = NULL, *layout = NULL;
zval *have_separator = NULL, *parts = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &render_view) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(separator);
ZVAL_STRING(separator, "/", 1);
if (Z_TYPE_P(render_view) == IS_ARRAY) {
PHALCON_CPY_WRT(pick_view, render_view);
} else {
PHALCON_INIT_VAR(layout);
ZVAL_NULL(layout);
PHALCON_INIT_VAR(have_separator);
phalcon_fast_strpos(have_separator, render_view, separator TSRMLS_CC);
if (Z_TYPE_P(have_separator) != IS_BOOL || (Z_TYPE_P(have_separator) == IS_BOOL && Z_BVAL_P(have_separator))) {
PHALCON_INIT_VAR(parts);
phalcon_fast_explode(parts, separator, render_view TSRMLS_CC);
PHALCON_INIT_VAR(layout);
phalcon_array_fetch_long(&layout, parts, 0, PH_NOISY_CC);
}
PHALCON_INIT_VAR(pick_view);
array_init(pick_view);
phalcon_array_append(&pick_view, render_view, PH_SEPARATE TSRMLS_CC);
if (Z_TYPE_P(layout) != IS_NULL) {
phalcon_array_append(&pick_view, layout, PH_SEPARATE TSRMLS_CC);
}
}
phalcon_update_property_zval(this_ptr, SL("_pickView"), pick_view TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例8: PHP_METHOD
/**
* Adds a column to a table
*
* @param string $tableName
* @param string $schemaName
* @param Phalcon_Db_Column $column
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Adapter_Mysql, addColumn){
zval *table_name = NULL, *schema_name = NULL, *column = NULL, *sql = NULL;
zval *r0 = NULL, *r1 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz", &table_name, &schema_name, &column) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_STATIC_PARAMS_3(r0, "phalcon_db_dialect_mysql", "addcolumn", table_name, schema_name, column);
PHALCON_CPY_WRT(sql, r0);
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_CALL_METHOD_PARAMS_1(r1, this_ptr, "query", sql, PHALCON_NO_CHECK);
RETURN_DZVAL(r1);
}
示例9: PHP_METHOD
PHP_METHOD(Phalcon_Internal_TestTemp, e10a){
zval *a = NULL;
zval *a0 = NULL;
zval *t0 = NULL, *t1 = NULL;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(a0);
array_init(a0);
PHALCON_CPY_WRT(a, a0);
PHALCON_INIT_VAR(t0);
ZVAL_STRING(t0, "LOL", 1);
phalcon_array_update_long(&a, 0, &t0, PHALCON_SEPARATE_PLZ, PHALCON_COPY, PHALCON_NO_CTOR TSRMLS_CC);
PHALCON_INIT_VAR(t1);
ZVAL_LONG(t1, 0);
phalcon_array_update_string(&a, "LOL", strlen("LOL"), &t1, PHALCON_SEPARATE_PLZ, PHALCON_COPY, PHALCON_NO_CTOR TSRMLS_CC);
PHALCON_RETURN_CTOR(a);
}
示例10: PHP_METHOD
/**
* Sends arbitrary text to a related logger in the instance
*
* @param string $sqlStatement
* @param int $type
*/
PHP_METHOD(Phalcon_Db, log){
zval *sql_statement = NULL, *type = NULL, *logger = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &sql_statement, &type) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "_logger", sizeof("_logger")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(logger, t0);
if (zend_is_true(logger)) {
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(logger, "log", sql_statement, type, PHALCON_NO_CHECK);
}
PHALCON_MM_RESTORE();
}
示例11: PHP_METHOD
/**
* Gets HTTP user agent used to made the request
*
* @return string
*/
PHP_METHOD(Phalcon_Http_Request, getUserAgent){
zval *server = NULL, *user_agent = NULL;
zval *g0 = NULL;
int eval_int;
PHALCON_MM_GROW();
phalcon_get_global(&g0, SL("_SERVER")+1 TSRMLS_CC);
PHALCON_CPY_WRT(server, g0);
eval_int = phalcon_array_isset_string(server, SL("HTTP_USER_AGENT")+1);
if (eval_int) {
PHALCON_INIT_VAR(user_agent);
phalcon_array_fetch_string(&user_agent, server, SL("HTTP_USER_AGENT"), PH_NOISY_CC);
} else {
PHALCON_INIT_VAR(user_agent);
ZVAL_STRING(user_agent, "", 1);
}
RETURN_CCTOR(user_agent);
}
示例12: PHP_METHOD
/**
*
* @param string $session_id optional, session id
*
* @return boolean
*/
PHP_METHOD(Phalcon_Session_Adapter_Memcache, destroy){
zval *_sid = NULL, sid = {}, *memcache;
phalcon_fetch_params(0, 0, 1, &_sid);
if (!_sid) {
PHALCON_CALL_SELFW(&sid, "getid");
} else {
PHALCON_CPY_WRT(&sid, _sid);
}
memcache = phalcon_read_property(getThis(), SL("_memcache"), PH_NOISY);
if (Z_TYPE_P(memcache) == IS_OBJECT) {
PHALCON_RETURN_CALL_METHODW(memcache, "delete", &sid);
return;
} else {
RETURN_FALSE;
}
}
示例13: PHP_METHOD
/**
* Get instance of model query
*
* @param string $modelName
* @param array $data
* @return Phalcon_Model_Query $query
*/
PHP_METHOD(Phalcon_Model_Query, fromInput){
zval *model_name = NULL, *data = NULL, *query = NULL;
zval *i0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &model_name, &data) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, phalcon_model_query_ce);
PHALCON_CALL_METHOD_NORETURN(i0, "__construct", PHALCON_CHECK);
PHALCON_CPY_WRT(query, i0);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(query, "from", model_name, PHALCON_NO_CHECK);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(query, "setinputdata", data, PHALCON_NO_CHECK);
PHALCON_RETURN_CTOR(query);
}
示例14: PHP_METHOD
/**
* Get rewrite info
*
* @return string
*/
PHP_METHOD(Phalcon_Mvc_Router, _getRewriteUri){
zval *get = NULL;
zval *g0 = NULL;
zval *r0 = NULL;
int eval_int;
PHALCON_MM_GROW();
phalcon_get_global(&g0, SL("_GET")+1 TSRMLS_CC);
PHALCON_CPY_WRT(get, g0);
eval_int = phalcon_array_isset_string(get, SL("_url")+1);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r0);
phalcon_array_fetch_string(&r0, get, SL("_url"), PH_NOISY_CC);
RETURN_CCTOR(r0);
}
PHALCON_MM_RESTORE();
RETURN_NULL();
}
示例15: PHP_METHOD
/**
* Check whether a model is already initialized
*
* @param string $modelName
* @return bool
*/
PHP_METHOD(Phalcon_Mvc_Collection_Manager, isInitialized){
zval *model_name, *initialized, *lowercased;
zval *is_intitialized = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &model_name);
PHALCON_OBS_VAR(initialized);
phalcon_read_property_this(&initialized, this_ptr, SL("_initialized"), PH_NOISY_CC);
PHALCON_INIT_VAR(lowercased);
phalcon_fast_strtolower(lowercased, model_name);
PHALCON_INIT_VAR(r0);
ZVAL_BOOL(r0, phalcon_array_isset(initialized, lowercased));
PHALCON_CPY_WRT(is_intitialized, r0);
RETURN_NCTOR(is_intitialized);
}