• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ fb::VariantList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中fb::VariantList的典型用法代码示例。如果您正苦于以下问题:C++ VariantList类的具体用法?C++ VariantList怎么用?C++ VariantList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VariantList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:beride,项目名称:btlauncher,代码行数:28,代码来源:btlauncherAPI.cpp


示例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();
    }
}
开发者ID:GarysRefererence2014,项目名称:FireBreath,代码行数:33,代码来源:fbjson.cpp


示例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);
}
开发者ID:Buranz,项目名称:browser-plugin,代码行数:59,代码来源:DialogManagerX11.cpp


示例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);
}
开发者ID:1833183060,项目名称:FireBreath,代码行数:8,代码来源:JSFunction.cpp


示例5:

FB::VariantList FB::JSArray::Values()
{
    FB::VariantList output;
    for (size_t i = 0; i < GetLength(); i++) {
        output.push_back((*this)[i]);
    }
    return output;
}
开发者ID:Ankso,项目名称:FireBreath,代码行数:8,代码来源:JSArray.cpp


示例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;
}
开发者ID:scjohn,项目名称:FireBreath,代码行数:8,代码来源:FBTestPluginAPI.cpp


示例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;
}
开发者ID:pschwartz,项目名称:GraphControl,代码行数:8,代码来源:HPCCSystemsGraphViewControlAPI.cpp


示例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();
}
开发者ID:Ankso,项目名称:FireBreath,代码行数:9,代码来源:JSArray.cpp


示例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;
}
开发者ID:NoAntzWk,项目名称:FireBreath,代码行数:9,代码来源:FBTestPluginAPI.cpp


示例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;
}
开发者ID:pschwartz,项目名称:GraphControl,代码行数:10,代码来源:HPCCSystemsGraphViewControlAPI.cpp


示例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;
}
开发者ID:NoAntzWk,项目名称:FireBreath,代码行数:11,代码来源:FBTestPluginAPI.cpp


示例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;
}
开发者ID:pschwartz,项目名称:GraphControl,代码行数:11,代码来源:HPCCSystemsGraphViewControlAPI.cpp


示例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;
}
开发者ID:pschwartz,项目名称:GraphControl,代码行数:12,代码来源:HPCCSystemsGraphViewControlAPI.cpp


示例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;
}
开发者ID:beride,项目名称:btlauncher,代码行数:45,代码来源:btlauncherAPI.cpp


示例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;
}
开发者ID:beride,项目名称:btlauncher,代码行数:19,代码来源:btlauncherAPI.cpp


示例16: stopRunning

FB::VariantList btlauncherAPI::stopRunning(const std::wstring& val) {
	FB::VariantList list;
	if (wcsstr(val.c_str(), _T(BT_HEXCODE)) || wcsstr(val.c_str(), _T(BTLIVE_CODE))) {
		HWND hWnd = FindWindow( val.c_str(), NULL );
		DWORD pid;
		DWORD parent;
		parent = GetWindowThreadProcessId(hWnd, &pid);
		HANDLE pHandle = OpenProcess(PROCESS_TERMINATE, NULL, pid);
		if (! pHandle) {
			list.push_back("could not open process");
			list.push_back(GetLastError());
		} else {
			BOOL result = TerminateProcess(pHandle, 0);
			list.push_back("ok");
			list.push_back(result);
		}
	}
	return list;
}
开发者ID:bbarrows,项目名称:btlauncher,代码行数:19,代码来源:btlauncherAPI.cpp


示例17: getStatusDict

FB::VariantMap UploadQueue::getStatusDict(bool include_filenames) {
    FB::VariantMap d;
    // whole-queue stats
    d["queue_name"] = name;
    d["current_queue_bytes_remaining"] = current_queue_bytes;
    d["total_queue_bytes"] = total_queue_bytes;
    d["total_queue_files"] = total_queue_files;
    d["current_queue_files_remaining"] = files_waiting;
    d["batches_remaining"] = ceil(static_cast<float>(files_waiting) / static_cast<float>(batch_size));
    d["status"] = "Uploading";

    // this-batch stats
    if (include_filenames) {
        FB::VariantList cf;
        for (std::set<std::wstring>::const_iterator it = current_upload_files.begin();
            it != current_upload_files.end(); ++it)  {
                cf.push_back(*it);
        }
        d["current_files"] = cf;
    }
    d["current_batch_bytes_total"] = current_batch_bytes;

    double current_batch_pct_complete = 0.0;

    if (current_upload_request) {
        HTTP::Status st = current_upload_request->getStatus();
        FB::VariantMap status(st.asDict());
        d.insert(status.begin(), status.end());
        if (st.send_total) {
            current_batch_pct_complete = static_cast<double>(st.bytes_sent)
                / static_cast<double>(st.send_total);
        }
    }

    d["current_batch_pct_complete"] = current_batch_pct_complete;
    d["overall_progress_pct"] = static_cast<double>(
        (total_queue_bytes - (current_queue_bytes + current_batch_bytes))
            + (current_batch_pct_complete *  current_batch_bytes))
        / static_cast<double>(total_queue_bytes);

    return d;
}
开发者ID:letolabs,项目名称:FireBreath,代码行数:42,代码来源:UploadQueue.cpp


示例18: Construct

FB::variant NPObjectAPI::Construct( const FB::VariantList& args )
{
    if (m_browser.expired())
        return false;

    NpapiBrowserHostPtr browser(getHost());
    if (!browser->isMainThread()) {
        return browser->CallOnMainThread(boost::bind((FB::ConstructType)&NPObjectAPI::Construct, this, args));
    }
    if (is_JSAPI) {
        FB::JSAPIPtr tmp = inner.lock();
        if (tmp)
            return tmp->Construct(args);
        else 
            return false;
    }
    NPVariant retVal;

    // Convert the arguments to NPVariants
    boost::scoped_array<NPVariant> npargs(new NPVariant[args.size()]);
    for (unsigned int i = 0; i < args.size(); i++) {
        browser->getNPVariant(&npargs[i], args[i]);
    }

    bool res = false;
    // construct
    res = browser->Construct(obj, npargs.get(), args.size(), &retVal);

    // Free the NPVariants that we earlier allocated
    for (unsigned int i = 0; i < args.size(); i++) {
        browser->ReleaseVariantValue(&npargs[i]);
    }

    if (!res) { // If the method call failed, throw an exception
        throw script_error("constructor");
    } else {
        FB::variant ret = browser->getVariant(&retVal);
        browser->ReleaseVariantValue(&retVal);  // Always release the return value!
        return ret;
    }
}
开发者ID:linkotec,项目名称:FireBreath,代码行数:41,代码来源:NPObjectAPI.cpp


示例19: getUserData

FB::VariantMap FBTestPluginAPI::getUserData()
{
    FB::VariantMap map;
    map["Name"] = "Richard Bateman";
    map["Location"] = "Somewhere in Utah";
    map["EyeColor"] = "Hazel";
    map["HairColor"] = "Brown";
    FB::VariantList kids;
    kids.push_back("Caleb");
    kids.push_back("Unknown");
    kids.push_back("Ok, I only have one, but I'm filling space");
    FB::VariantMap innerMap;
    innerMap["test"] = 12;
    innerMap["test2"] = true;
    innerMap["test3"] = 12.4;
    innerMap["test4"] = "asdf";
    map["inner"] = innerMap;
    kids.push_back(innerMap);
    map["Kids"] = kids;
    return map;
}
开发者ID:NoAntzWk,项目名称:FireBreath,代码行数:21,代码来源:FBTestPluginAPI.cpp


示例20: variantToJsonValue

Json::Value variantToJsonValue(const FB::variant &val)
{
    if (val.is_of_type<std::string>()) {
        return Json::Value(val.convert_cast<std::string>());
    } else if (val.is_of_type<FB::VariantMap>()) {
        Json::Value retVal(Json::objectValue);
        FB::VariantMap map = val.cast<FB::VariantMap>();
        for (FB::VariantMap::iterator it = map.begin(); it != map.end(); ++it) {
            retVal[it->first] = variantToJsonValue(it->second);
        }
        return retVal;
    } else if (val.is_of_type<FB::VariantList>()) {
        Json::Value retVal(Json::arrayValue);
        FB::VariantList list = val.cast<FB::VariantList>();
        for (FB::VariantList::iterator it = list.begin(); it != list.end(); ++it) {
            retVal.append(variantToJsonValue(*it));
        }
        return retVal;
    } else if (val.is_of_type<int>()
               || val.is_of_type<char>()
               || val.is_of_type<short>()
               || val.is_of_type<long>()) {
        return Json::Value((Json::Int)val.convert_cast<long>());
    } else if (val.is_of_type<unsigned int>()
               || val.is_of_type<unsigned short>()
               || val.is_of_type<unsigned char>()
               || val.is_of_type<unsigned long>()) {
        return Json::Value((Json::UInt) val.convert_cast<unsigned long>());
    } else if (val.is_of_type<double>() || val.is_of_type<float>()) {
        return Json::Value(val.convert_cast<double>());
    } else if (val.is_of_type<bool>()) {
        return Json::Value(val.convert_cast<bool>());
    } else {
        return Json::Value(Json::nullValue);
    }
}
开发者ID:GarysRefererence2014,项目名称:FireBreath,代码行数:36,代码来源:fbjson.cpp



注:本文中的fb::VariantList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ fc::path类代码示例发布时间:2022-05-31
下一篇:
C++ fb::JSObjectPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap