コード例 #1
0
void CRowPhpBridge::addColumn(Php::Parameters &params)
{
    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());
    }
}
コード例 #2
0
void CRowPhpBridge::setKeyColumnName(Php::Parameters &params)
{
    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());
    }
}
コード例 #3
0
ファイル: context.cpp プロジェクト: hanigamal/PHP-JS
/**
 *  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 &params)
{
    // 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);
}
コード例 #4
0
/**
 *  my_with_undefined_parameters_function()
 *  @param  Php:Parameters  the given parameters
 */
void my_with_undefined_parameters_function(Php::Parameters &params)
{
    for (unsigned int i = 0; i < params.size(); i++)
    {
        cout << "Parameter " << i << ": " << params[i] << endl;
    }
}
コード例 #5
0
Php::Value FastImage::resize(Php::Parameters &parameters)
{
	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;
}
コード例 #6
0
/**
 *  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 &params)
{
    for (unsigned int i = 0; i < params.size(); i++)
    {
        cout << params[i] << endl;
    }
}
コード例 #7
0
Php::Value GtkDialog_::new_with_buttons(Php::Parameters &parameters)
{
	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);
}
コード例 #8
0
Php::Value CRowPhpBridge::getColumnValue(Php::Parameters &params)
{
    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();
}
コード例 #9
0
ファイル: main.cpp プロジェクト: georaphael/complex
 void __construct(Php::Parameters &params) {
     if (params.size() == 2) {
         r = params[0];
         i = params[1];
     } else {
         r = 0;
         i = 0;
     }
 }
コード例 #10
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 &params)
{
    for (unsigned int i = 0; i < params.size(); i++)
    {
        cout << "Parameter " << i << ": " << params[i] << endl;
    }
    
    return params[0] + params[1];
}
コード例 #11
0
ファイル: DI.cpp プロジェクト: xubingyue/cpphalcon
	Php::Value DI::get(Php::Parameters &params)
	{
		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;
	}
コード例 #12
0
void GtkTextTagTable_::remove(Php::Parameters &parameters)
{
	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);

}
コード例 #13
0
ファイル: DI.cpp プロジェクト: xubingyue/cpphalcon
	Php::Value DI::set(Php::Parameters &params)
	{
		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;
	}
コード例 #14
0
void GtkMenuItem_::set_submenu(Php::Parameters &parameters)
{
	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);

}
コード例 #15
0
ファイル: GtkLabel.cpp プロジェクト: scorninpc/php-gtk3-tests
void GtkLabel_::set_mnemonic_widget(Php::Parameters &parameters)
{
	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);

}
コード例 #16
0
void GtkFileChooserDialog_::set_filter(Php::Parameters &parameters)
{
	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);

}
コード例 #17
0
void GtkDialog_::get_response_for_widget(Php::Parameters &parameters)
{
	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);

}
コード例 #18
0
void GtkClipboard_::set_image(Php::Parameters &parameters)
{
	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);

}
コード例 #19
0
void GtkFileChooserDialog_::set_extra_widget(Php::Parameters &parameters)
{
	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);

}
コード例 #20
0
Php::Value GtkClipboard_::wait_is_image_available(Php::Parameters &parameters)
{
	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;
}
コード例 #21
0
void GtkClipboard_::set_text(Php::Parameters &parameters)
{
	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);

}
コード例 #22
0
Php::Value GtkTextTagTable_::add(Php::Parameters &parameters)
{
	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;
}
コード例 #23
0
void GtkDialog_::add_action_widget(Php::Parameters &parameters)
{
	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);

}
コード例 #24
0
void CRowsPhpBridge::pushBack(Php::Parameters &params)
{
    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());
                }
            }
        }
    }
}
コード例 #25
0
Php::Value FastImage::save(Php::Parameters &parameters)
{
    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;
}
コード例 #26
0
// Implementation of the PHP constructor. It initialize the handlers table and create a core object.
void PhpLinphoneCore::__construct(Php::Parameters &parameters) {
    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);
    }
}
コード例 #27
0
ファイル: database.cpp プロジェクト: Photonios/rocksdb-php
Php::Value Database::Put(Php::Parameters &params)
{
	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;
}
コード例 #28
0
Php::Value GtkTreeSelection_::get_selected_rows(Php::Parameters &parameters)
{
	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;
}
コード例 #29
0
Php::Value GtkTreeSelection_::get_selected(Php::Parameters &parameters)
{
	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);
}
コード例 #30
0
ファイル: config.cpp プロジェクト: debli/mungbean
Php::Value Config::dec(Php::Parameters &params)
{ 
    return _val -= params.size() > 0 ? (int) params[0] : 1;
}