本文整理汇总了C++中fb::VariantList类的典型用法代码示例。如果您正苦于以下问题:C++ VariantList类的具体用法?C++ VariantList怎么用?C++ VariantList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VariantList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stopRunning
FB::VariantList btlauncherAPI::stopRunning(const std::string& val) {
FBLOG_INFO("stopRunning()", "START");
FBLOG_INFO("stopRunning()", val.c_str());
FB::VariantList list;
bool foundIt = false;
size_t procCount = 0;
kinfo_proc *procList = NULL;
GetBSDProcessList(&procList, &procCount);
size_t i;
for (i = 0; i < procCount; i++) {
if (!strcmp(procList[i].kp_proc.p_comm, val.c_str())) {
FBLOG_INFO("stopRunning()", val.c_str());
kill(procList[i].kp_proc.p_pid, SIGKILL);
foundIt = true;
}
}
free(procList);
if (foundIt) {
list.push_back("ok");
} else {
list.push_back("could not open process");
}
FBLOG_INFO("stopRunning()", "END");
return list;
}
示例2: jsonValueToVariant
FB::variant jsonValueToVariant( Json::Value root )
{
Json::Value def;
if (root.isString())
return root.asString();
else if (root.isBool())
return root.asBool();
else if (root.isDouble())
return root.asDouble();
else if (root.isInt())
return root.asInt();
else if (root.isUInt())
return root.asUInt();
else if (root.isNull())
return FB::FBNull();
else if (root.isArray()) {
FB::VariantList outList;
for (size_t i = 0; i < root.size(); ++i) {
outList.push_back(jsonValueToVariant(root.get(i, def)));
}
return outList;
} else if (root.isObject()) {
Json::Value::Members members = root.getMemberNames();
FB::VariantMap outMap;
for (Json::Value::Members::iterator it = members.begin(); it != members.end(); ++it)
{
outMap[*it] = jsonValueToVariant(root.get(*it, def));
}
return outMap;
} else {
return FB::FBVoid();
}
}
示例3: while
void DialogManagerX11::_showFolderDialog(FB::PluginWindow* win, bool multi, const PathCallback& cb)
{
FB::VariantList out;
// Create the dialog. Do it the hard way so we can override the default
// behavior which does not allow files and directories to be selected together.
GtkWidget *dialog = gtk_dialog_new_with_buttons("Open", NULL, GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
GtkWidget *action_area = gtk_dialog_get_action_area(GTK_DIALOG(dialog));
GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
// Some nicer formatting
gtk_box_set_spacing(GTK_BOX(content_area), 2);
gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
gtk_container_set_border_width(GTK_CONTAINER(action_area), 5);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
// Create the file chooser widget
GtkWidget *chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN);
if (multi)
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE);
// And add it to the dialog
gtk_container_add(GTK_CONTAINER(content_area), chooser);
gtk_widget_show(chooser);
// for the life of me I can't figure out how to get the filechooserwidget
// to return an actual requested size. Going with the simple hard coded
// size until that can be figured out.
gtk_window_resize(GTK_WINDOW(dialog), 600, 400);
// run the dialog
gint result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT) {
char *buffer;
std::string filename;
GSList *filenames, *iterator;
filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(chooser));
iterator = filenames;
while (iterator) {
buffer = (char *)g_slist_nth_data(iterator, 0);
filename = std::string(buffer);
g_free(buffer);
// append a trailing slash if the name is a directory
if (fs::is_directory(filename))
filename.push_back('/');
out.push_back(filename);
iterator = g_slist_next(iterator);
}
g_slist_free(filenames);
}
gtk_widget_destroy(dialog);
// call the callback with the results
cb(out);
}
示例4: exec
FB::variant FB::JSFunction::call( const std::vector<variant>& args )
{
FB::VariantList list;
if (args.size() >= 1) {
list.insert(list.end(), args.begin()+1, args.end());
}
return exec(list);
}
示例5:
FB::VariantList FB::JSArray::Values()
{
FB::VariantList output;
for (size_t i = 0; i < GetLength(); i++) {
output.push_back((*this)[i]);
}
return output;
}
示例6: countArrayLength
long FBTestPluginAPI::countArrayLength(const FB::JSObjectPtr &jso)
{
if (!jso->HasProperty("getArray"))
throw FB::invalid_arguments();
FB::VariantList array = jso->GetProperty("getArray").cast<FB::VariantList>();
long len = array.size();// array->GetProperty("length").convert_cast<long>();
return len;
}
示例7: getPropertiesForItems
FB::VariantList HPCCSystemsGraphViewControlAPI::getPropertiesForItems(const std::vector<int> & items)
{
FB::VariantList retVal;
for(std::vector<int>::const_iterator itr = items.begin(); itr != items.end(); ++itr)
retVal.push_back(getProperties(*itr));
return retVal;
}
示例8: push
FB::JSArray::JSArray(BrowserHostPtr host, const FB::VariantList& values)
{
m_obj = host->getDOMWindow()->createArray();
for (FB::VariantList::const_iterator it = values.begin(); it != values.end(); ++it)
{
push(*it);
}
RegisterMethods();
}
示例9: reverseArray
FB::VariantList FBTestPluginAPI::reverseArray(const std::vector<std::string>& arr)
{
FB::VariantList outArr;
for (std::vector<std::string>::const_reverse_iterator it = arr.rbegin(); it != arr.rend(); it++)
{
outArr.push_back(*it);
}
return outArr;
}
示例10: getVertices
FB::VariantList HPCCSystemsGraphViewControlAPI::getVertices()
{
FB::VariantList items;
std::vector<int> vertices;
getPlugin()->GetVertices(vertices);
for(std::vector<int>::const_iterator itr = vertices.begin(); itr != vertices.end(); ++itr)
items.push_back(*itr);
return items;
}
示例11: getObjectValues
FB::VariantList FBTestPluginAPI::getObjectValues(const FB::JSObjectPtr& arr)
{
FB::VariantList outArr;
std::map<std::string, FB::variant> inMap;
arr->GetObjectValues(arr, inMap);
for (std::map<std::string, FB::variant>::iterator it = inMap.begin(); it != inMap.end(); it++) {
outArr.push_back(it->second);
}
return outArr;
}
示例12: getSelectionAsGlobalID
FB::VariantList HPCCSystemsGraphViewControlAPI::getSelectionAsGlobalID()
{
FB::VariantList retVal;
std::vector<std::string> selectedItems;
getPlugin()->GetSelection(selectedItems);
for(std::vector<std::string>::const_iterator itr = selectedItems.begin(); itr != selectedItems.end(); ++itr)
retVal.push_back(*itr);
return retVal;
}
示例13: find
FB::VariantList HPCCSystemsGraphViewControlAPI::find(const std::string & text, boost::optional<bool> includeProperties)
{
assert(getPlugin());
FB::VariantList retVal;
std::vector<int> foundItems;
getPlugin()->Find(text, includeProperties ? *includeProperties : true, foundItems);
for(std::vector<int>::const_iterator itr = foundItems.begin(); itr != foundItems.end(); ++itr)
retVal.push_back(*itr);
return retVal;
}
示例14: runProgram
FB::variant btlauncherAPI::runProgram(const std::string& program, const FB::JSObjectPtr& callback) {
FBLOG_INFO("runProgram()", "START");
string exe = this->installPath;
if (program == "SoShare")
exe += SOSHARE_EXE_PATH;
else if (program == "Torque")
exe += TORQUE_EXE_PATH;
else
exe += BTLIVE_EXE_PATH;
FBLOG_INFO("runProgram()", exe.c_str());
struct stat st;
if (stat(exe.c_str(), &st) == -1 || !S_ISREG(st.st_mode)) {
FBLOG_INFO("runProgram()", "stat check problem");
callback->InvokeAsync("", FB::variant_list_of(false)(0));
FBLOG_INFO("runProgram()", "END");
return 0;
}
FB::VariantList list = isRunning(program);
if (list.empty()) {
switch(fork())
{
case -1: {
perror("BTLauncher Run Program Fork");
FBLOG_INFO("runProgram()", "fork - failure");
break;
}
case 0: {
FBLOG_INFO("runProgram()", "fork - child process");
FBLOG_INFO("runProgram()", exe.c_str());
execlp(exe.c_str(), exe.c_str(), NULL);
FBLOG_INFO("runProgram()", "child process exit");
exit(1);
}
default: {
break;
}
}
}
callback->InvokeAsync("", FB::variant_list_of(true)(1));
FBLOG_INFO("runProgram()", "END");
return 0;
}
示例15: isRunning
FB::VariantList btlauncherAPI::isRunning(const std::string& val) {
FBLOG_INFO("isRunning()", "START");
FB::VariantList list;
size_t procCount = 0;
kinfo_proc *procList = NULL;
GetBSDProcessList(&procList, &procCount);
size_t i;
for (i = 0; i < procCount; i++) {
if (!strcmp(procList[i].kp_proc.p_comm, val.c_str())) {
FBLOG_INFO("isRunning()", val.c_str());
list.push_back(procList[i].kp_proc.p_comm);
}
}
free(procList);
FBLOG_INFO("isRunning()", "END");
return list;
}