Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
TestCallTemplates.cpp File Reference
#include "nsISupportsUtils.h"
#include "nsIWeakReference.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsWeakReference.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"

Go to the source code of this file.


protocol  NS_NO_VTABLE
 Private interface implemented by the nsXFormsUtilityService in XForms extension. More...
class  nsTestService




int main ()

Class Documentation

class nsTestService

Definition at line 63 of file TestCallTemplates.cpp.

Define Documentation

{0x127b5253, 0x37b1, 0x43c7, \
    { 0x96, 0x2b, 0xab, 0xf1, 0x2d, 0x22, 0x56, 0xae }}

Definition at line 54 of file TestCallTemplates.cpp.

{0xa00c1406, 0x283a, 0x45c9, \
    {0xae, 0xd2, 0x1a, 0xb6, 0xdd, 0xba, 0xfe, 0x53}}

Definition at line 72 of file TestCallTemplates.cpp.


Definition at line 71 of file TestCallTemplates.cpp.

Function Documentation

int main ( void  )


Definition at line 77 of file TestCallTemplates.cpp.

     * NOTE:  This does NOT demonstrate how these functions are
     * intended to be used.  They are intended for filling in out
     * parameters that need to be |AddRef|ed.  I'm just too lazy
     * to write lots of little getter functions for a test program
     * when I don't need to.

    NS_NOTREACHED("This test is not intended to run, only to compile!");

    /* Test CallQueryInterface */

    nsISupports *mySupportsPtr = NS_REINTERPRET_CAST(nsISupports*, 0x1000);

    nsITestService *myITestService = nsnull;
    CallQueryInterface(mySupportsPtr, &myITestService);

    nsTestService *myTestService =
        NS_REINTERPRET_CAST(nsTestService*, mySupportsPtr);
    nsISupportsWeakReference *mySupportsWeakRef;
    CallQueryInterface(myTestService, &mySupportsWeakRef);

    /* Test CallQueryReferent */

    nsIWeakReference *myWeakRef =
        NS_STATIC_CAST(nsIWeakReference*, mySupportsPtr);
    CallQueryReferent(myWeakRef, &myITestService);

    /* Test CallCreateInstance */

    CallCreateInstance(kTestServiceCID, mySupportsPtr, &myITestService);
    CallCreateInstance(kTestServiceCID, &myITestService);
    CallCreateInstance(NS_TEST_SERVICE_CONTRACTID, mySupportsPtr,
    CallCreateInstance(NS_TEST_SERVICE_CONTRACTID, &myITestService);

    /* Test CallGetService */
    CallGetService(kTestServiceCID, &myITestService);
    CallGetService(NS_TEST_SERVICE_CONTRACTID, &myITestService);

    /* Test CallGetInterface */
    nsIInterfaceRequestor *myInterfaceRequestor =
        NS_STATIC_CAST(nsIInterfaceRequestor*, mySupportsPtr);
    CallGetInterface(myInterfaceRequestor, &myITestService);

    return 0;

Here is the call graph for this function:

static NS_DEFINE_CID ( kTestServiceCID  ,
) [static]