当前位置: 首页>>代码示例>>C++>>正文


C++ nsInterfaceHashtable::Get方法代码示例

本文整理汇总了C++中nsInterfaceHashtable::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ nsInterfaceHashtable::Get方法的具体用法?C++ nsInterfaceHashtable::Get怎么用?C++ nsInterfaceHashtable::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nsInterfaceHashtable的用法示例。


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

示例2:

bool
ContentDialogChild::Recv__delete__(const InfallibleTArray<int>& aIntParams,
                                   const InfallibleTArray<nsString>& aStringParams)
{
  nsCOMPtr<nsIDialogParamBlock> params;
  if (gActiveDialogs.Get(this, getter_AddRefs(params))) {
    TabChild::ArraysToParams(aIntParams, aStringParams, params);
    gActiveDialogs.Remove(this);
  }
  return true;
}
开发者ID:bebef1987,项目名称:mozilla-central,代码行数:11,代码来源:TabChild.cpp

示例3: xtf_contract_id

nsresult
nsXTFService::CreateElement(nsIContent** aResult, nsINodeInfo* aNodeInfo)
{
  nsCOMPtr<nsIXTFElementFactory> factory;

  // Check if we have an xtf factory for the given namespaceid in our cache:
  if (!mFactoryHash.Get(aNodeInfo->NamespaceID(), getter_AddRefs(factory))) {
    // No. See if there is one registered with the component manager:
    nsCAutoString xtf_contract_id(NS_XTF_ELEMENT_FACTORY_CONTRACTID_PREFIX);
    nsAutoString uri;
    aNodeInfo->GetNamespaceURI(uri);
    AppendUTF16toUTF8(uri, xtf_contract_id);
#ifdef DEBUG_xtf_verbose
    printf("Testing for XTF factory at %s\n", xtf_contract_id.get());
#endif
    factory = do_GetService(xtf_contract_id.get());
    if (factory) {
#ifdef DEBUG
      printf("We've got an XTF factory: %s \n", xtf_contract_id.get());
#endif
      // Put into hash:
      mFactoryHash.Put(aNodeInfo->NamespaceID(), factory);
    }
  }
  if (!factory) return NS_ERROR_FAILURE;

  // We have an xtf factory. Now try to create an element for the given tag name:
  nsCOMPtr<nsIXTFElement> elem;
  nsAutoString tagName;
  aNodeInfo->GetName(tagName);
  factory->CreateElement(tagName, getter_AddRefs(elem));
  if (!elem) return NS_ERROR_FAILURE;
  
  // We've got an xtf element. Create a wrapper for it:
  return NS_NewXTFElementWrapper(elem, aNodeInfo, aResult);
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:36,代码来源:nsXTFService.cpp

示例4: relURI

nsresult
RDFContentSinkImpl::GetResourceAttribute(const PRUnichar** aAttributes,
                                         nsIRDFResource** aResource)
{
  nsCOMPtr<nsIAtom> localName;

  nsAutoString nodeID;

  for (; *aAttributes; aAttributes += 2) {
      const nsDependentSubstring& nameSpaceURI =
          SplitExpatName(aAttributes[0], getter_AddRefs(localName));

      // We'll accept `resource' or `rdf:resource', under the spirit
      // that we should be liberal towards the input that we
      // receive.
      if (!nameSpaceURI.IsEmpty() &&
          !nameSpaceURI.EqualsLiteral(RDF_NAMESPACE_URI)) {
          continue;
      }

      // XXX you can't specify both, but we'll just pick up the
      // first thing that was specified and ignore the other.

      if (localName == kResourceAtom) {
          // XXX Take the URI and make it fully qualified by
          // sticking it into the document's URL. This may not be
          // appropriate...
          nsAutoString relURI(aAttributes[1]);
          if (rdf_RequiresAbsoluteURI(relURI)) {
              nsresult rv;
              nsCAutoString uri;

              rv = mDocumentURL->Resolve(NS_ConvertUTF16toUTF8(aAttributes[1]), uri);
              if (NS_FAILED(rv)) return rv;

              return gRDFService->GetResource(uri, aResource);
          } 
          return gRDFService->GetResource(NS_ConvertUTF16toUTF8(aAttributes[1]), 
                                          aResource);
      }
      else if (localName == kNodeIdAtom) {
          nodeID.Assign(aAttributes[1]);
      }
  }
    
  // If nodeID is present, check if we already know about it. If we've seen
  // the nodeID before, use the same resource, otherwise generate a new one.
  if (!nodeID.IsEmpty()) {
      mNodeIDMap.Get(nodeID,aResource);

      if (!*aResource) {
          nsresult rv;
          rv = gRDFService->GetAnonymousResource(aResource);
          if (NS_FAILED(rv)) {
              return rv;
          }
          mNodeIDMap.Put(nodeID,*aResource);
      }
      return NS_OK;
  }

  return NS_ERROR_FAILURE;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:63,代码来源:nsRDFContentSink.cpp

示例5: xtf_contract_id

nsresult
nsXTFService::CreateElement(nsIContent** aResult, nsINodeInfo* aNodeInfo)
{
  nsCOMPtr<nsIXTFElementFactory> factory;

  // Check if we have an xtf factory for the given namespaceid in our cache:
  if (!mFactoryHash.Get(aNodeInfo->NamespaceID(), getter_AddRefs(factory))) {
    // No. See if there is one registered with the component manager:
    nsCAutoString xtf_contract_id(NS_XTF_ELEMENT_FACTORY_CONTRACTID_PREFIX);
    nsAutoString uri;
    aNodeInfo->GetNamespaceURI(uri);
    AppendUTF16toUTF8(uri, xtf_contract_id);
#ifdef DEBUG_xtf_verbose
    printf("Testing for XTF factory at %s\n", xtf_contract_id.get());
#endif
    factory = do_GetService(xtf_contract_id.get());
    if (factory) {
#ifdef DEBUG
      printf("We've got an XTF factory.\n");
#endif
      // Put into hash:
      mFactoryHash.Put(aNodeInfo->NamespaceID(), factory);
    }
  }
  if (!factory) return NS_ERROR_FAILURE;

  // We have an xtf factory. Now try to create an element for the given tag name:
  nsCOMPtr<nsIXTFElement> elem;
  nsAutoString tagName;
  aNodeInfo->GetName(tagName);
  factory->CreateElement(tagName, getter_AddRefs(elem));
  if (!elem) return NS_ERROR_FAILURE;
  
  // We've got an xtf element. Create an appropriate wrapper for it:
  PRUint32 elementType;
  elem->GetElementType(&elementType);
  switch (elementType) {
    case nsIXTFElement::ELEMENT_TYPE_GENERIC_ELEMENT:
    {
      nsCOMPtr<nsIXTFGenericElement> elem2 = do_QueryInterface(elem);
      return NS_NewXTFGenericElementWrapper(elem2, aNodeInfo, aResult);
    }
    case nsIXTFElement::ELEMENT_TYPE_BINDABLE:
    {
      nsCOMPtr<nsIXTFBindableElement> elem2 = do_QueryInterface(elem);
      return NS_NewXTFBindableElementWrapper(elem2, aNodeInfo, aResult);
    }
    case nsIXTFElement::ELEMENT_TYPE_SVG_VISUAL:
    {
#ifdef MOZ_SVG
      nsCOMPtr<nsIXTFSVGVisual> elem2 = do_QueryInterface(elem);
      return NS_NewXTFSVGVisualWrapper(elem2, aNodeInfo, aResult);
#else
      NS_ERROR("xtf svg visuals are only supported in mozilla builds with native svg support");
      break;
#endif
    }
    case nsIXTFElement::ELEMENT_TYPE_XML_VISUAL:
    {
      nsCOMPtr<nsIXTFXMLVisual> elem2 = do_QueryInterface(elem);
      return NS_NewXTFXMLVisualWrapper(elem2, aNodeInfo, aResult);
    }
    case nsIXTFElement::ELEMENT_TYPE_XUL_VISUAL:
    {
      nsCOMPtr<nsIXTFXULVisual> elem2 = do_QueryInterface(elem);
      return NS_NewXTFXULVisualWrapper(elem2, aNodeInfo, aResult);
    }
    default:
      NS_ERROR("unknown xtf element type");
      break;
  }
  return NS_ERROR_FAILURE;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:73,代码来源:nsXTFService.cpp


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