本文整理汇总了C++中php::Parameters类的典型用法代码示例。如果您正苦于以下问题:C++ Parameters类的具体用法?C++ Parameters怎么用?C++ Parameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Parameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
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;
}
示例2: set
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;
}
示例3: pushBack
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());
}
}
}
}
}
示例4: Open
Php::Value Database::Open(Php::Parameters ¶ms)
{
if(IsOpen())
{
m_last_error = ErrorMessages::AlreadyActiveConnection;
return false;
}
bool create_if_missing = false;
if(params.empty() || !params[0].isBool())
create_if_missing = false;
else
create_if_missing = params[0].boolValue();
rocksdb::Options options;
options.create_if_missing = create_if_missing;
rocksdb::Status status = rocksdb::DB::Open(options, m_db_path, &m_rdb);
if(!status.ok())
{
m_last_error = status.ToString();
m_is_open = false;
return false;
}
m_is_open = true;
return true;
}
示例5: assign
/**
* 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);
}
示例6: resize
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;
}
示例7: my_with_defined_object_parameters_function
/**
* 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;
}
}
示例8: new_with_buttons
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);
}
示例9: __construct
void Database::__construct(Php::Parameters ¶ms)
{
if(params.empty() || !params[0].isString())
Php::ThrowError(ErrorMessages::InvalidParamExpectedString);
m_db_path = params[0].stringValue();
}
示例10: my_with_undefined_parameters_function
/**
* 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;
}
}
示例11: Put
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;
}
示例12: setDefault
void DI::setDefault(Php::Parameters ¶ms)
{
try {
Php::Value value = params.at(0);
_default = (DI *) value.implementation();
} catch (const std::out_of_range& e) {
throw Php::Exception("Invalid number of parameters supplied");
}
}
示例13: my_with_defined_parameters_function
/**
* 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];
}
示例14: __construct
void __construct(Php::Parameters ¶ms) {
if (params.size() == 2) {
r = params[0];
i = params[1];
} else {
r = 0;
i = 0;
}
}
示例15: set_image
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);
}