Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsComponentManagerUtils.h File Reference
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsIFactory.h"

Go to the source code of this file.

Classes

protocol  NS_COM_GLUE
protocol  NS_COM_GLUE
protocol  NS_COM_GLUE
protocol  NS_COM_GLUE
protocol  NS_COM_GLUE

Functions

NS_COM_GLUE nsresult CallCreateInstance (const nsCID &aClass, nsISupports *aDelegate, const nsIID &aIID, void **aResult)
NS_COM_GLUE nsresult CallCreateInstance (const char *aContractID, nsISupports *aDelegate, const nsIID &aIID, void **aResult)
NS_COM_GLUE nsresult CallGetClassObject (const nsCID &aClass, const nsIID &aIID, void **aResult)
NS_COM_GLUE nsresult CallGetClassObject (const char *aContractID, const nsIID &aIID, void **aResult)
const nsCreateInstanceByCID do_CreateInstance (const nsCID &aCID, nsresult *error=0)
const nsCreateInstanceByCID do_CreateInstance (const nsCID &aCID, nsISupports *aOuter, nsresult *error=0)
const nsCreateInstanceByContractID do_CreateInstance (const char *aContractID, nsresult *error=0)
const nsCreateInstanceByContractID do_CreateInstance (const char *aContractID, nsISupports *aOuter, nsresult *error=0)
const nsCreateInstanceFromFactory do_CreateInstance (nsIFactory *aFactory, nsresult *error=0)
const nsCreateInstanceFromFactory do_CreateInstance (nsIFactory *aFactory, nsISupports *aOuter, nsresult *error=0)
const nsGetClassObjectByCID do_GetClassObject (const nsCID &aCID, nsresult *error=0)
 do_GetClassObject can be used to improve performance of callers that call |CreateInstance| many times.
const nsGetClassObjectByContractID do_GetClassObject (const char *aContractID, nsresult *error=0)
template<class DestinationType >
nsresult CallCreateInstance (const nsCID &aClass, nsISupports *aDelegate, DestinationType **aDestination)
template<class DestinationType >
nsresult CallCreateInstance (const nsCID &aClass, DestinationType **aDestination)
template<class DestinationType >
nsresult CallCreateInstance (const char *aContractID, nsISupports *aDelegate, DestinationType **aDestination)
template<class DestinationType >
nsresult CallCreateInstance (const char *aContractID, DestinationType **aDestination)
template<class DestinationType >
nsresult CallCreateInstance (nsIFactory *aFactory, nsISupports *aDelegate, DestinationType **aDestination)
template<class DestinationType >
nsresult CallCreateInstance (nsIFactory *aFactory, DestinationType **aDestination)
template<class DestinationType >
nsresult CallGetClassObject (const nsCID &aClass, DestinationType **aDestination)
template<class DestinationType >
nsresult CallGetClassObject (const char *aContractID, DestinationType **aDestination)

Function Documentation

NS_COM_GLUE nsresult CallCreateInstance ( const nsCID aClass,
nsISupports *  aDelegate,
const nsIID aIID,
void **  aResult 
)

Definition at line 102 of file nsComponentManagerUtils.cpp.

{
    nsCOMPtr<nsIComponentManager> compMgr;
    nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
    if (compMgr)
        status = compMgr->CreateInstance(aCID, aDelegate, aIID, aResult);
    return status;
}

Here is the call graph for this function:

NS_COM_GLUE nsresult CallCreateInstance ( const char *  aContractID,
nsISupports *  aDelegate,
const nsIID aIID,
void **  aResult 
)

Definition at line 113 of file nsComponentManagerUtils.cpp.

{
    nsCOMPtr<nsIComponentManager> compMgr;
    nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
    if (compMgr)
        status = compMgr->CreateInstanceByContractID(aContractID, aDelegate,
                                                     aIID, aResult);
    return status;
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallCreateInstance ( const nsCID aClass,
nsISupports *  aDelegate,
DestinationType **  aDestination 
) [inline]

Definition at line 229 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aDestination, "null parameter");
    
    return CallCreateInstance(aClass, aDelegate,
                              NS_GET_IID(DestinationType),
                              NS_REINTERPRET_CAST(void**, aDestination));
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallCreateInstance ( const nsCID aClass,
DestinationType **  aDestination 
) [inline]

Definition at line 243 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aDestination, "null parameter");
    
    return CallCreateInstance(aClass, nsnull,
                              NS_GET_IID(DestinationType),
                              NS_REINTERPRET_CAST(void**, aDestination));
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallCreateInstance ( const char *  aContractID,
nsISupports *  aDelegate,
DestinationType **  aDestination 
) [inline]

Definition at line 256 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aContractID, "null parameter");
    NS_PRECONDITION(aDestination, "null parameter");
    
    return CallCreateInstance(aContractID, 
                              aDelegate,
                              NS_GET_IID(DestinationType),
                              NS_REINTERPRET_CAST(void**, aDestination));
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallCreateInstance ( const char *  aContractID,
DestinationType **  aDestination 
) [inline]

Definition at line 272 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aContractID, "null parameter");
    NS_PRECONDITION(aDestination, "null parameter");
    
    return CallCreateInstance(aContractID, nsnull,
                              NS_GET_IID(DestinationType),
                              NS_REINTERPRET_CAST(void**, aDestination));
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallCreateInstance ( nsIFactory aFactory,
nsISupports *  aDelegate,
DestinationType **  aDestination 
) [inline]

Definition at line 286 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aFactory, "null parameter");
    NS_PRECONDITION(aDestination, "null parameter");
    
    return aFactory->CreateInstance(aDelegate,
                                    NS_GET_IID(DestinationType),
                                    NS_REINTERPRET_CAST(void**, aDestination));
}
template<class DestinationType >
nsresult CallCreateInstance ( nsIFactory aFactory,
DestinationType **  aDestination 
) [inline]

Definition at line 301 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aFactory, "null parameter");
    NS_PRECONDITION(aDestination, "null parameter");
    
    return aFactory->CreateInstance(nsnull,
                                    NS_GET_IID(DestinationType),
                                    NS_REINTERPRET_CAST(void**, aDestination));
}
NS_COM_GLUE nsresult CallGetClassObject ( const nsCID aClass,
const nsIID aIID,
void **  aResult 
)

Definition at line 125 of file nsComponentManagerUtils.cpp.

{
    nsCOMPtr<nsIComponentManager> compMgr;
    nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
    if (compMgr)
        status = compMgr->GetClassObject(aCID, aIID, aResult);
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_COM_GLUE nsresult CallGetClassObject ( const char *  aContractID,
const nsIID aIID,
void **  aResult 
)

Definition at line 135 of file nsComponentManagerUtils.cpp.

{
    nsCOMPtr<nsIComponentManager> compMgr;
    nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
    if (compMgr)
        status = compMgr->GetClassObjectByContractID(aContractID, aIID,
                                                     aResult);
    return status;
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallGetClassObject ( const nsCID aClass,
DestinationType **  aDestination 
) [inline]

Definition at line 315 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aDestination, "null parameter");
    
    return CallGetClassObject(aClass,
        NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}

Here is the call graph for this function:

template<class DestinationType >
nsresult CallGetClassObject ( const char *  aContractID,
DestinationType **  aDestination 
) [inline]

Definition at line 327 of file nsComponentManagerUtils.h.

{
    NS_PRECONDITION(aDestination, "null parameter");
    
    return CallGetClassObject(aContractID,
        NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}

Here is the call graph for this function:

const nsCreateInstanceByCID do_CreateInstance ( const nsCID aCID,
nsresult error = 0 
) [inline]

Definition at line 131 of file nsComponentManagerUtils.h.

{
    return nsCreateInstanceByCID(aCID, 0, error);
}
const nsCreateInstanceByCID do_CreateInstance ( const nsCID aCID,
nsISupports *  aOuter,
nsresult error = 0 
) [inline]

Definition at line 138 of file nsComponentManagerUtils.h.

{
    return nsCreateInstanceByCID(aCID, aOuter, error);
}
const nsCreateInstanceByContractID do_CreateInstance ( const char *  aContractID,
nsresult error = 0 
) [inline]

Definition at line 145 of file nsComponentManagerUtils.h.

{
    return nsCreateInstanceByContractID(aContractID, 0, error);
}
const nsCreateInstanceByContractID do_CreateInstance ( const char *  aContractID,
nsISupports *  aOuter,
nsresult error = 0 
) [inline]

Definition at line 152 of file nsComponentManagerUtils.h.

{
    return nsCreateInstanceByContractID(aContractID, aOuter, error);
}
const nsCreateInstanceFromFactory do_CreateInstance ( nsIFactory aFactory,
nsresult error = 0 
) [inline]

Definition at line 159 of file nsComponentManagerUtils.h.

{
    return nsCreateInstanceFromFactory(aFactory, 0, error);
}
const nsCreateInstanceFromFactory do_CreateInstance ( nsIFactory aFactory,
nsISupports *  aOuter,
nsresult error = 0 
) [inline]

Definition at line 166 of file nsComponentManagerUtils.h.

{
    return nsCreateInstanceFromFactory(aFactory, aOuter, error);
}
const nsGetClassObjectByCID do_GetClassObject ( const nsCID aCID,
nsresult error = 0 
) [inline]

do_GetClassObject can be used to improve performance of callers that call |CreateInstance| many times.

They can cache the factory and call do_CreateInstance or CallCreateInstance with the cached factory rather than having the component manager retrieve it every time.

Definition at line 214 of file nsComponentManagerUtils.h.

{
    return nsGetClassObjectByCID(aCID, error);
}

Here is the caller graph for this function:

const nsGetClassObjectByContractID do_GetClassObject ( const char *  aContractID,
nsresult error = 0 
) [inline]

Definition at line 220 of file nsComponentManagerUtils.h.

{
    return nsGetClassObjectByContractID(aContractID, error);
}