void CRowPhpBridge::addColumn(Php::Parameters ¶ms) { if(2 == params.size()) { if(params.at(0).isString()) { m_row.addColumn( params.at(0).stringValue(), CVariantPhpBridge(params.at(1))); } else { SYNOPSIS_ERR_LOG("Invalid type of parameter[0]:%d\n", params.at(0).type()); } } else { SYNOPSIS_ERR_LOG("Invalid number of parameters:%zu\n", params.size()); } }
void CRowPhpBridge::setKeyColumnName(Php::Parameters ¶ms) { if(1 == params.size()) { if(params.at(0).isString()) { SYNOPSIS_DBG_ERR_LOG("[%s] params.at(0):%s\n", __PRETTY_FUNCTION__, params.at(0).stringValue().c_str()); std::string sKeyColumnName = params.at(0).stringValue(); m_row.SetKeyColumnName(sKeyColumnName); } else { SYNOPSIS_ERR_LOG("Invalid type of parameter[0]:%d\n", params.at(0).type()); } } else { SYNOPSIS_ERR_LOG("Invalid number of parameters:%zu\n", params.size()); } }
/** * Assign a variable to the javascript context * * @param params array of parameters: * - string name of property to assign required * - mixed property value to assign required * - integer property attributes optional * * The property attributes can be one of the following values * * - ReadOnly * - DontEnum * - DontDelete * * If not specified, the property will be writable, enumerable and * deletable. */ void Context::assign(Php::Parameters ¶ms) { // create a local "scope" and "enter" our context v8::HandleScope scope(isolate()); v8::Context::Scope contextScope(_context); // retrieve the global object from the context v8::Local<v8::Object> global(_context->Global()); // the attribute for the newly assigned property v8::PropertyAttribute attribute(v8::None); // if an attribute was given, assign it if (params.size() > 2) { // check the attribute that was selected switch ((int16_t)params[2]) { case v8::None: attribute = v8::None; break; case v8::ReadOnly: attribute = v8::ReadOnly; break; case v8::DontDelete: attribute = v8::DontDelete; break; case v8::DontEnum: attribute = v8::DontEnum; break; } } // and store the value global->ForceSet(value(params[0]), value(params[1]), attribute); }
/** * my_with_undefined_parameters_function() * @param Php:Parameters the given parameters */ void my_with_undefined_parameters_function(Php::Parameters ¶ms) { for (unsigned int i = 0; i < params.size(); i++) { cout << "Parameter " << i << ": " << params[i] << endl; } }
Php::Value FastImage::resize(Php::Parameters ¶meters) { Php::Value self(this); int width = parameters[0]; int height = parameters[1]; bool save_ascpect_ratio = true; if (parameters.size() == 3) { save_ascpect_ratio = parameters[2]; } if (save_ascpect_ratio) { std::vector<int> calculated_size = calculateResizedImageSize(width, height); width = calculated_size[0]; height = calculated_size[1]; } cv::Mat resizedImage; if (width > 0 && height > 0) { cv::Size new_size; new_size.width = width; new_size.height = height; cv::resize(cvImage, resizedImage, new_size); } else { throwToSmallException("FastImage::resize"); } cvImage = resizedImage; resizedImage.release(); return self; }
/** * my_with_defined_object_parameters_function() * The use of objects is not yet implemented. * @param Php::Parameters the given parameters */ void my_with_defined_object_parameters_function(Php::Parameters ¶ms) { for (unsigned int i = 0; i < params.size(); i++) { cout << params[i] << endl; } }
Php::Value GtkDialog_::new_with_buttons(Php::Parameters ¶meters) { std::string s_title = parameters[0]; gchar *title = (gchar *)s_title.c_str(); GtkWindow *parent; if(parameters.size() > 1) { Php::Value object_parent = parameters[1]; GtkWindow_ *phpgtk_parent = (GtkWindow_ *)object_parent.implementation(); parent = GTK_WINDOW(phpgtk_parent->get_instance()); } int int_flags = (int)parameters[2]; GtkDialogFlags flags = (GtkDialogFlags)int_flags; // std::string s_first_button_text = parameters[3]; // gchar *first_button_text = (gchar *)s_first_button_text.c_str(); // Create object GtkDialog_ *dialog = new GtkDialog_(); // dialog->__construct(); // gtk_window_set_title(GTK_WINDOW(dialog->instance), title); // gtk_widget_set_parent(GTK_WIDGET(dialog->instance), GTK_WIDGET(parent)); // gtk_dialog_add_button(GTK_DIALOG(dialog->instance), "OK", GTK_RESPONSE_OK); // gtk_dialog_add_button(GTK_DIALOG(dialog->instance), "Cancel", GTK_RESPONSE_CANCEL); dialog->set_instance((gpointer *)gtk_dialog_new_with_buttons(title, GTK_WINDOW(parent), flags, "OK", GTK_RESPONSE_OK, "Cancel", GTK_RESPONSE_CANCEL, NULL)); return Php::Object("GtkDialog", dialog); }
Php::Value CRowPhpBridge::getColumnValue(Php::Parameters ¶ms) { if(1 == params.size()) { if(params.at(0).isString()) { SYNOPSIS_DBG_ERR_LOG("CRowPhpBridge::getColumnValue params.at(0):%s\n", params.at(0).stringValue().c_str()); std::string sKey = params.at(0).stringValue(); synopsis::CVariant varRes = m_row.getColumnValue(sKey); Php::Value phpRes = CVariant2PhpValue(varRes); return phpRes; } else { SYNOPSIS_ERR_LOG("Invalid type of parameter[0]:%d\n", params.at(0).type()); } } else { SYNOPSIS_ERR_LOG("Invalid number of parameters:%zu\n", params.size()); } return Php::Value(); }
void __construct(Php::Parameters ¶ms) { if (params.size() == 2) { r = params[0]; i = params[1]; } else { r = 0; i = 0; } }
/** * my_with_defined_parameters_function() * @param Php::Parameters the given parameters * @return Php::Value Param[0] and Param[1] added */ Php::Value my_with_defined_parameters_function(Php::Parameters ¶ms) { for (unsigned int i = 0; i < params.size(); i++) { cout << "Parameter " << i << ": " << params[i] << endl; } return params[0] + params[1]; }
Php::Value DI::get(Php::Parameters ¶ms) { try { Php::Value name = params.at(0); Php::Value parameters = params.size() > 1 ? params.at(1) : Php::Value(nullptr); } catch (const std::out_of_range& e) { throw Php::Exception("Invalid number of parameters supplied"); } return this; }
void GtkTextTagTable_::remove(Php::Parameters ¶meters) { GtkTextTag *tag; if(parameters.size() > 0) { Php::Value object_tag = parameters[0]; GtkTextTag_ *phpgtk_tag = (GtkTextTag_ *)object_tag.implementation(); tag = (phpgtk_tag->get_tag()); } gtk_text_tag_table_remove (GTK_TEXT_TAG_TABLE(instance), tag); }
Php::Value DI::set(Php::Parameters ¶ms) { try { Php::Value name = params.at(0); Php::Value definition = params.at(1); Php::Value shared = params.size() > 2 ? params.at(2) : Php::Value(false); } catch (const std::out_of_range& e) { throw Php::Exception("Invalid number of parameters supplied"); } return this; }
void GtkMenuItem_::set_submenu(Php::Parameters ¶meters) { GtkWidget *submenu; if(parameters.size() > 0) { Php::Value object_submenu = parameters[0]; GtkWidget_ *phpgtk_submenu = (GtkWidget_ *)object_submenu.implementation(); submenu = GTK_WIDGET(phpgtk_submenu->get_instance()); } gtk_menu_item_set_submenu (GTK_MENU_ITEM(instance), submenu); }
void GtkLabel_::set_mnemonic_widget(Php::Parameters ¶meters) { GtkWidget *widget; if(parameters.size() > 0) { Php::Value object_widget = parameters[0]; GtkWidget_ *phpgtk_widget = (GtkWidget_ *)object_widget.implementation(); widget = GTK_WIDGET(phpgtk_widget->get_instance()); } gtk_label_set_mnemonic_widget (GTK_LABEL(instance), widget); }
void GtkFileChooserDialog_::set_filter(Php::Parameters ¶meters) { GtkFileFilter *filter; if(parameters.size() > 0) { Php::Value object_filter = parameters[0]; GtkFileFilter_ *phpgtk_filter = (GtkFileFilter_ *)object_filter.implementation(); filter = GTK_FILE_FILTER(phpgtk_filter->get_instance()); } gtk_file_chooser_set_filter (GTK_FILE_CHOOSER(instance), filter); }
void GtkDialog_::get_response_for_widget(Php::Parameters ¶meters) { GtkWidget *widget; if(parameters.size() > 0) { Php::Value object_widget = parameters[0]; GtkWidget_ *phpgtk_widget = (GtkWidget_ *)object_widget.implementation(); widget = GTK_WIDGET(phpgtk_widget->get_instance()); } gtk_dialog_get_response_for_widget (GTK_DIALOG(instance), widget); }
void GtkClipboard_::set_image(Php::Parameters ¶meters) { GdkPixbuf *pixbuf; if(parameters.size() > 0) { Php::Value object_pixbuf = parameters[0]; GdkPixbuf_ *phpgtk_pixbuf = (GdkPixbuf_ *)object_pixbuf.implementation(); pixbuf = phpgtk_pixbuf->get_instance(); } gtk_clipboard_set_image (GTK_CLIPBOARD(instance), pixbuf); }
void GtkFileChooserDialog_::set_extra_widget(Php::Parameters ¶meters) { GtkWidget *extra_widget; if(parameters.size() > 0) { Php::Value object_extra_widget = parameters[0]; GtkWidget_ *phpgtk_extra_widget = (GtkWidget_ *)object_extra_widget.implementation(); extra_widget = GTK_WIDGET(phpgtk_extra_widget->get_instance()); } gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(instance), extra_widget); }
Php::Value GtkClipboard_::wait_is_image_available(Php::Parameters ¶meters) { GtkTextBuffer *buffer; if(parameters.size() > 0) { Php::Value object_buffer = parameters[0]; GtkTextBuffer_ *phpgtk_buffer = (GtkTextBuffer_ *)object_buffer.implementation(); buffer = GTK_TEXT_BUFFER(phpgtk_buffer->get_instance()); } gboolean ret = gtk_clipboard_wait_is_rich_text_available (GTK_CLIPBOARD(instance), buffer); return ret; }
void GtkClipboard_::set_text(Php::Parameters ¶meters) { std::string s_text = parameters[0]; gchar *text = (gchar *)s_text.c_str(); gint len = -1; if(parameters.size() >= 2) { len = (gint)parameters[1]; } gtk_clipboard_set_text (GTK_CLIPBOARD(instance), text, len); }
Php::Value GtkTextTagTable_::add(Php::Parameters ¶meters) { GtkTextTag *tag; if(parameters.size() > 0) { Php::Value object_tag = parameters[0]; GtkTextTag_ *phpgtk_tag = (GtkTextTag_ *)object_tag.implementation(); tag = (phpgtk_tag->get_tag()); } gboolean ret = gtk_text_tag_table_add (GTK_TEXT_TAG_TABLE(instance), tag); return ret; }
void GtkDialog_::add_action_widget(Php::Parameters ¶meters) { GtkWidget *child; if(parameters.size() > 0) { Php::Value object_child = parameters[0]; GtkWidget_ *phpgtk_child = (GtkWidget_ *)object_child.implementation(); child = GTK_WIDGET(phpgtk_child->get_instance()); } gint response_id = (gint)parameters[1]; gtk_dialog_add_action_widget (GTK_DIALOG(instance), child, response_id); }
void CRowsPhpBridge::pushBack(Php::Parameters ¶ms) { if(params.size() > 0) { if(Php::Type::Object == params.at(0).type()) { if(params.at(0).implementation()){ CRowPhpBridge *pRowPhpBridge = dynamic_cast<CRowPhpBridge*>(params.at(0).implementation()); if(pRowPhpBridge) { SYNOPSIS_DBG_ERR_LOG("CRowsPhpBridge::pushBack\n"); m_Rows.push_back(pRowPhpBridge->daoRow()); } } } } }
Php::Value FastImage::save(Php::Parameters ¶meters) { Php::Value self(this); Php::Value output = parameters[0]; Php::Value flags; if (parameters.size() == 2) { flags = parameters[1]; } cv::imwrite(output, cvImage, flags); return self; }
// Implementation of the PHP constructor. It initialize the handlers table and create a core object. void PhpLinphoneCore::__construct(Php::Parameters ¶meters) { LinphoneCoreVTable vTable = {0}; vTable.dtmf_received = dtmfHandler; const unsigned long size = parameters.size(); if (size == 1) { PhpLinphoneFactoryConfig *factoryConfig = (PhpLinphoneFactoryConfig *)parameters[0].implementation(); this->_core = linphone_core_new(&vTable,nullptr,factoryConfig->get(),nullptr); } else if (size == 2) { PhpLinphoneFactoryConfig *factoryConfig = (PhpLinphoneFactoryConfig *)parameters[0].implementation(); PhpLinphoneConfig *config = (PhpLinphoneConfig *)parameters[1].implementation(); this->_core = linphone_core_new(&vTable,config->get(),factoryConfig->get(),nullptr); } else if (size == 0) { this->_core = linphone_core_new(&vTable,nullptr,nullptr,nullptr); } }
Php::Value Database::Put(Php::Parameters ¶ms) { if(params.empty() || params.size() < 2) Php::ThrowError(ErrorMessages::ExpectedTwoParamters); if(!IsOpen()) { m_last_error = ErrorMessages::NoActiveConnection; return false; } std::string key = params[0].stringValue(); std::string value = params[1].stringValue(); m_rdb->Put(rocksdb::WriteOptions(), key, value); return true; }
Php::Value GtkTreeSelection_::get_selected_rows(Php::Parameters ¶meters) { GtkTreeModel *model; if(parameters.size() > 0) { Php::Value object_model = parameters[0]; GtkTreeModel_ *phpgtk_model = (GtkTreeModel_ *)object_model.implementation(); model = GTK_TREE_MODEL(phpgtk_model->get_model()); } GList *ret = gtk_tree_selection_get_selected_rows (GTK_TREE_SELECTION(instance), &model); Php::Value ret_arr; for(int index=0; GList *item=g_list_nth(ret, index); index++) { ret_arr[index] = (char *) item->data; } return ret_arr; }
Php::Value GtkTreeSelection_::get_selected(Php::Parameters ¶meters) { GtkTreeModel *model; if(parameters.size() > 0) { Php::Value object_model = parameters[0]; GtkTreeModel_ *phpgtk_model = (GtkTreeModel_ *)object_model.implementation(); model = GTK_TREE_MODEL(phpgtk_model->get_model()); } GtkTreeIter iter; gboolean ret = gtk_tree_selection_get_selected (GTK_TREE_SELECTION(instance), &model, &iter); if(!ret) { return false; } GtkTreeIter_ *return_parsed = new GtkTreeIter_(); return_parsed->set_instance(iter); return Php::Object("GtkTreeIter", return_parsed); }
Php::Value Config::dec(Php::Parameters ¶ms) { return _val -= params.size() > 0 ? (int) params[0] : 1; }