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


C++ nsIID::Equals方法代码示例

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


在下文中一共展示了nsIID::Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

NS_IMETHODIMP
FetchDriver::GetInterface(const nsIID& aIID, void **aResult)
{
  if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
    *aResult = static_cast<nsIChannelEventSink*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }

  nsresult rv;

  if (mNotificationCallbacks) {
    rv = mNotificationCallbacks->GetInterface(aIID, aResult);
    if (NS_SUCCEEDED(rv)) {
      NS_ASSERTION(*aResult, "Lying nsIInterfaceRequestor implementation!");
      return rv;
    }
  }
  else if (aIID.Equals(NS_GET_IID(nsIStreamListener))) {
    *aResult = static_cast<nsIStreamListener*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }
  else if (aIID.Equals(NS_GET_IID(nsIRequestObserver))) {
    *aResult = static_cast<nsIRequestObserver*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }

  return QueryInterface(aIID, aResult);
}
开发者ID:JasonJinCn,项目名称:gecko-dev,代码行数:31,代码来源:FetchDriver.cpp

示例2: QueryInterface

// here nsScriptablePeer should return three interfaces it can be asked for by their iid's
// static casts are necessary to ensure that correct pointer is returned
NS_IMETHODIMP nsScriptablePeer::QueryInterface(const nsIID & aIID,
					       void **aInstancePtr)
{
    if (!aInstancePtr)
	return NS_ERROR_NULL_POINTER;

    if (aIID.Equals(kIScriptableMplayerPluginIID)) {
	*aInstancePtr = static_cast < nsIScriptableMplayerPlugin *> (this);
	AddRef();
	return NS_OK;
    }

    if (aIID.Equals(kIClassInfoIID)) {
	*aInstancePtr = static_cast < nsIClassInfo *> (this);
	AddRef();
	return NS_OK;
    }

    if (aIID.Equals(kISupportsIID)) {
	*aInstancePtr =
	    static_cast < nsISupports *>
			   (static_cast < nsIScriptableMplayerPlugin *> (this));
	AddRef();
	return NS_OK;
    }

    return NS_NOINTERFACE;
}
开发者ID:fredjo,项目名称:gnomenut,代码行数:30,代码来源:nsScriptablePeer.cpp

示例3: CreateInstance

NS_IMETHODIMP CFactory::CreateInstance(nsISupports *aOuter, 
                                       const nsIID & iid,
                                       void * *result)
{
fprintf(stderr,"In CreateInstance\n");

    static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
    static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);

    if (result == NULL) {
        return NS_ERROR_UNEXPECTED;
    }

    *result = NULL;

    if (NULL != aOuter) {
        return NS_ERROR_NO_AGGREGATION;
    }

    if (! (iid.Equals(kIPluginInstanceIID) ||
           iid.Equals(kISupportsIID)))
        return NS_ERROR_NO_INTERFACE;

    ICreater * ic = NULL;
    m_pJavaService->QI(ICreater_IID,(void **) &ic);
    CPluginInstance * pi = new CPluginInstance(ic,m_pServiceManager);
    ic->release();

    return pi->QueryInterface(iid,result);
}
开发者ID:FredChap,项目名称:myforthprocessor,代码行数:30,代码来源:CFactory_IFactory.cpp

示例4: QueryInterface

NS_IMETHODIMP
HttpChannelParent::GetInterface(const nsIID& aIID, void **result)
{
  if (aIID.Equals(NS_GET_IID(nsIAuthPromptProvider)) ||
      aIID.Equals(NS_GET_IID(nsISecureBrowserUI))) {
    if (mTabParent) {
      return mTabParent->QueryInterface(aIID, result);
    }
  }

  // Only support nsIAuthPromptProvider in Content process
  if (XRE_IsParentProcess() &&
      aIID.Equals(NS_GET_IID(nsIAuthPromptProvider))) {
    *result = nullptr;
    return NS_OK;
  }

  // Only support nsILoadContext if child channel's callbacks did too
  if (aIID.Equals(NS_GET_IID(nsILoadContext)) && mLoadContext) {
    nsCOMPtr<nsILoadContext> copy = mLoadContext;
    copy.forget(result);
    return NS_OK;
  }

  return QueryInterface(aIID, result);
}
开发者ID:WuChengLin,项目名称:gecko-dev,代码行数:26,代码来源:HttpChannelParent.cpp

示例5: if

// nsIInterfaceRequestor method
NS_IMETHODIMP
nsXPInstallManager::GetInterface(const nsIID & eventSinkIID, void* *_retval)
{
    if (eventSinkIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
        *_retval = nsnull;

        nsresult rv;
        nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
        NS_ENSURE_SUCCESS(rv, rv);

        nsCOMPtr<nsIAuthPrompt> prompt;
        rv = ww->GetNewAuthPrompter(nsnull, getter_AddRefs(prompt));
        NS_ENSURE_SUCCESS(rv, rv);

        nsIAuthPrompt *p = prompt.get();
        NS_ADDREF(p);
        *_retval = p;
        return NS_OK;
    }
    else if (eventSinkIID.Equals(NS_GET_IID(nsIBadCertListener2))) {
        // If we aren't chrome triggered fall back to the default dialogs
        if (!mFromChrome)
            return NS_ERROR_NO_INTERFACE;
    }
    return QueryInterface(eventSinkIID, (void**)_retval);
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:27,代码来源:nsXPInstallManager.cpp

示例6: QueryInterface

NS_IMETHODIMP
EventSource::GetInterface(const nsIID & aIID,
                          void **aResult)
{
  if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
    *aResult = static_cast<nsIChannelEventSink*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }

  if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) ||
      aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) {
    nsresult rv = CheckInnerWindowCorrectness();
    NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIPromptFactory> wwatch =
      do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    // Get the an auth prompter for our window so that the parenting
    // of the dialogs works as it should when using tabs.

    nsCOMPtr<nsIDOMWindow> window;
    if (GetOwner()) {
      window = GetOwner()->GetOuterWindow();
    }

    return wwatch->GetPrompt(window, aIID, aResult);
  }

  return QueryInterface(aIID, aResult);
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:32,代码来源:EventSource.cpp

示例7:

NS_IMETHODIMP
nsWebSocket::GetInterface(const nsIID &aIID, void **aResult)
{
  NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");

  if (mDisconnected)
    return NS_ERROR_FAILURE;

  if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) ||
      aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) {
    nsresult rv;

    nsCOMPtr<nsIDocument> doc =
      nsContentUtils::GetDocumentFromScriptContext(mScriptContext);
    if (!doc)
      return NS_ERROR_NOT_AVAILABLE;

    nsCOMPtr<nsIPromptFactory> wwatch =
      do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsPIDOMWindow> outerWindow = doc->GetWindow();
    return wwatch->GetPrompt(outerWindow, aIID, aResult);
  }

  return NS_ERROR_UNEXPECTED;
}
开发者ID:ehsan,项目名称:test,代码行数:27,代码来源:nsWebSocket.cpp

示例8: QueryInterface

NS_IMETHODIMP CFactory::QueryInterface(const nsIID & iid, void **ptr)
{
    fprintf(stderr,"In QueryInterface\n");

    static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
    static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
    static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
    static NS_DEFINE_IID(kIJVMPluginIID, NS_IJVMPLUGIN_IID);
    static NS_DEFINE_IID(kIJVMConsoleIID, NS_IJVMCONSOLE_IID);

    if (NULL == ptr) {
        return NS_ERROR_NULL_POINTER;
    } 

    if(iid.Equals(kISupportsIID) || iid.Equals(kIJVMPluginIID)) {
        *ptr = (void*) (nsIJVMPlugin*) this;
    } else if (iid.Equals(kIPluginIID)) {
        *ptr = (void*) (nsIPlugin*) this;
    } else if (iid.Equals(kIFactoryIID)) {
        *ptr = (void*) (nsIFactory*) this;
    } else if (iid.Equals(kIJVMConsoleIID)) {
fprintf(stderr,"Looking for the Console Interface\n");
        *ptr = (void*) (nsIJVMConsole*) this;
    } else {
        return NS_NOINTERFACE;
    }
    
    AddRef();
    return NS_OK;
}
开发者ID:FredChap,项目名称:myforthprocessor,代码行数:30,代码来源:CFactory_ISupports.cpp

示例9: QueryInterface

NS_IMETHODIMP
FTPChannelParent::GetInterface(const nsIID& uuid, void** result)
{
  if (uuid.Equals(NS_GET_IID(nsIAuthPromptProvider)) ||
      uuid.Equals(NS_GET_IID(nsISecureBrowserUI))) {
    if (mTabParent) {
      return mTabParent->QueryInterface(uuid, result);
    }
  } else if (uuid.Equals(NS_GET_IID(nsIAuthPrompt)) ||
             uuid.Equals(NS_GET_IID(nsIAuthPrompt2))) {
    nsCOMPtr<nsIAuthPromptProvider> provider(do_QueryObject(mTabParent));
    if (provider) {
      return provider->GetAuthPrompt(nsIAuthPromptProvider::PROMPT_NORMAL,
                                     uuid,
                                     result);
    }
  }

  // Only support nsILoadContext if child channel's callbacks did too
  if (uuid.Equals(NS_GET_IID(nsILoadContext)) && mLoadContext) {
    nsCOMPtr<nsILoadContext> copy = mLoadContext;
    copy.forget(result);
    return NS_OK;
  }

  return QueryInterface(uuid, result);
}
开发者ID:flodolo,项目名称:gecko-dev,代码行数:27,代码来源:FTPChannelParent.cpp

示例10: parent

NS_IMETHODIMP
EmbedPromptFactory::GetPrompt(nsIDOMWindow* aParent, const nsIID& iid, void **result)
{
    nsCOMPtr<nsIDOMWindow> parent(aParent);
    if (!parent) { // if no parent provided, consult the window watcher:
        nsresult rv;
        nsCOMPtr<nsIWindowWatcher> wwatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv, rv);
        wwatcher->GetActiveWindow(getter_AddRefs(parent));
        if (!parent) {
            return NS_ERROR_FAILURE;
        }
    }

    if (iid.Equals(NS_GET_IID(nsIAuthPrompt)) ||
        iid.Equals(NS_GET_IID(nsIAuthPrompt2))) {
        nsRefPtr<EmbedAuthPromptService> service = new EmbedAuthPromptService(parent);
        *result = service.forget().get();
    } else if (iid.Equals(NS_GET_IID(nsIPrompt))) {
        nsRefPtr<EmbedPromptService> service = new EmbedPromptService(parent);
        *result = service.forget().get();
    }

    return NS_OK;
}
开发者ID:rojkov,项目名称:embedlite-components,代码行数:25,代码来源:EmbedPromptService.cpp

示例11: CallQueryInterface

NS_IMETHODIMP
SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
{
  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");

  if (aIID.Equals(NS_GET_IID(nsIRadioInterfaceLayer))) {
    NS_IF_ADDREF(*reinterpret_cast<nsIRadioInterfaceLayer**>(aResult) = mRIL);
    return NS_OK;
  }

  if (aIID.Equals(NS_GET_IID(nsIWifi))) {
    return CallQueryInterface(mWifiWorker,
                              reinterpret_cast<nsIWifi**>(aResult));
  }

#ifdef MOZ_WIDGET_GONK
  if (aIID.Equals(NS_GET_IID(nsINetworkManager))) {
    return CallQueryInterface(mNetdWorker,
                              reinterpret_cast<nsINetworkManager**>(aResult));
  }
#endif

  NS_WARNING("Got nothing for the requested IID!");
  return NS_ERROR_NO_INTERFACE;
}
开发者ID:kusl,项目名称:releases-mozilla-release,代码行数:25,代码来源:SystemWorkerManager.cpp

示例12: GetInterface

NS_INTERFACE_MAP_END

//*****************************************************************************
// nsChromeTreeOwner::nsIInterfaceRequestor
//*****************************************************************************   

NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
{
  NS_ENSURE_ARG_POINTER(aSink);

  if(aIID.Equals(NS_GET_IID(nsIPrompt))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if(aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->QueryInterface(aIID, aSink);
  }

  return QueryInterface(aIID, aSink);
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:33,代码来源:nsChromeTreeOwner.cpp

示例13: if

// Custom QueryInterface impl to deal with the IDispatch tearoff
NS_IMETHODIMP
nsScriptablePeer::QueryInterface(const nsIID & aIID, void **aInstancePtr)
{
    NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
    if (!aInstancePtr)
        return NS_ERROR_NULL_POINTER;
    *aInstancePtr = nsnull;

    nsISupports* foundInterface = nsnull;
    if (aIID.Equals(NS_GET_IID(nsISupports)))
        foundInterface = static_cast<nsISupports *>(static_cast<nsIClassInfo *>(this));
    else if (aIID.Equals(NS_GET_IID(nsIClassInfo)))
        foundInterface = static_cast<nsIClassInfo*>(this);
    else if (aIID.Equals(NS_GET_IID(nsIMozAxPlugin)))
        foundInterface = static_cast<nsIMozAxPlugin*>(this);
    else if (memcmp(&aIID, &__uuidof(IDispatch), sizeof(nsID)) == 0)
    {
        HRESULT hr = mTearOff->QueryInterface(__uuidof(IDispatch), aInstancePtr);
        if (SUCCEEDED(hr)) return NS_OK;
        return E_FAIL;
    }

    NS_IF_ADDREF(foundInterface);
    *aInstancePtr = foundInterface;
    return (*aInstancePtr) ? NS_OK : NS_NOINTERFACE;
}
开发者ID:pauldorn,项目名称:v8monkey,代码行数:27,代码来源:XPConnect.cpp

示例14: printf

NS_IMETHODIMP
nsSanePluginFactoryImpl::QueryInterface(const nsIID &aIID, 
                                        void **aInstancePtr)
{
#ifdef DEBUG
    printf("nsSanePluginFactoryImpl::QueryInterface()\n");
#endif

    if (!aInstancePtr)
        return NS_ERROR_NULL_POINTER;

    if (aIID.Equals(kISupportsIID)) {
        *aInstancePtr = static_cast<nsISupports*>(this);
    } else if (aIID.Equals(kIFactoryIID)) {
        *aInstancePtr = static_cast<nsISupports*>
                                   (static_cast<nsIFactory*>(this));
    } else if (aIID.Equals(kIPluginIID)) {
        *aInstancePtr = static_cast<nsISupports*>
                                   (static_cast<nsIPlugin*>(this));
    } else {
        *aInstancePtr = nsnull;
        return NS_ERROR_NO_INTERFACE;
    }

    NS_ADDREF(reinterpret_cast<nsISupports*>(*aInstancePtr));

    return NS_OK;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:28,代码来源:nsSanePluginFactory.cpp

示例15: wwatch

NS_IMETHODIMP
nsHTTPIndex::GetInterface(const nsIID &anIID, void **aResult ) 
{
    if (anIID.Equals(NS_GET_IID(nsIFTPEventSink))) {
        // If we don't have a container to store the logged data
        // then don't report ourselves back to the caller

        if (!mRequestor)
          return NS_ERROR_NO_INTERFACE;
        *aResult = static_cast<nsIFTPEventSink*>(this);
        NS_ADDREF(this);
        return NS_OK;
    }

    if (anIID.Equals(NS_GET_IID(nsIPrompt))) {
        
        if (!mRequestor) 
            return NS_ERROR_NO_INTERFACE;

        nsCOMPtr<nsPIDOMWindowOuter> aDOMWindow = do_GetInterface(mRequestor);
        if (!aDOMWindow) 
            return NS_ERROR_NO_INTERFACE;

        nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
        
        return wwatch->GetNewPrompter(aDOMWindow, (nsIPrompt**)aResult);
    }  

    if (anIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
        
        if (!mRequestor) 
            return NS_ERROR_NO_INTERFACE;

        nsCOMPtr<nsPIDOMWindowOuter> aDOMWindow = do_GetInterface(mRequestor);
        if (!aDOMWindow) 
            return NS_ERROR_NO_INTERFACE;

        nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
        
        return wwatch->GetNewAuthPrompter(aDOMWindow, (nsIAuthPrompt**)aResult);
    }  

    if (anIID.Equals(NS_GET_IID(nsIProgressEventSink))) {

        if (!mRequestor) 
            return NS_ERROR_NO_INTERFACE;

        nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mRequestor);
        if (!sink) 
            return NS_ERROR_NO_INTERFACE;
        
        *aResult = sink;
        NS_ADDREF((nsISupports*)*aResult);
        return NS_OK;
    }

    return NS_ERROR_NO_INTERFACE;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:58,代码来源:nsDirectoryViewer.cpp


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