本文整理汇总了C++中nsCOMPtr::GetCollectionForSchema方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::GetCollectionForSchema方法的具体用法?C++ nsCOMPtr::GetCollectionForSchema怎么用?C++ nsCOMPtr::GetCollectionForSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::GetCollectionForSchema方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: key
nsresult
nsUnixSystemProxySettings::SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
nsACString& aResult)
{
nsDependentCString key(aKeyBase);
nsCOMPtr<nsIGSettingsCollection> proxy_settings = mSchemeProxySettings.Get(key);
nsresult rv;
if (!proxy_settings) {
rv = mGSettings->GetCollectionForSchema(key, getter_AddRefs(proxy_settings));
NS_ENSURE_SUCCESS(rv, rv);
mSchemeProxySettings.Put(key, proxy_settings);
}
nsAutoCString host;
rv = proxy_settings->GetString(NS_LITERAL_CSTRING("host"), host);
NS_ENSURE_SUCCESS(rv, rv);
if (host.IsEmpty())
return NS_ERROR_FAILURE;
int32_t port;
rv = proxy_settings->GetInt(NS_LITERAL_CSTRING("port"), &port);
NS_ENSURE_SUCCESS(rv, rv);
/* When port is 0, proxy is not considered as enabled even if host is set. */
if (port == 0)
return NS_ERROR_FAILURE;
SetProxyResult(aType, host, port, aResult);
return NS_OK;
}
示例2:
nsresult
nsUnixSystemProxySettings::Init()
{
mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
if (mGSettings) {
mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"),
getter_AddRefs(mProxySettings));
}
if (!mProxySettings) {
mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
}
return NS_OK;
}