Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsXPCDispTestWrappedJS Class Reference

#include <nsXPCDispTestWrappedJS.h>

Inheritance diagram for nsXPCDispTestWrappedJS:
Inheritance graph
[legend]
Collaboration diagram for nsXPCDispTestWrappedJS:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsXPCDispTestWrappedJS ()
STDMETHOD() InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() TestParamTypes (IDispatch *obj, BSTR *errMsg)
 This tests interacting with JS Objects via IDispatch.

Detailed Description

Definition at line 17 of file nsXPCDispTestWrappedJS.h.


Constructor & Destructor Documentation

Definition at line 24 of file nsXPCDispTestWrappedJS.h.

{}

Member Function Documentation

Definition at line 12 of file nsXPCDispTestWrappedJS.cpp.

{
       static const IID* arr[] = 
       {
              &IID_nsIXPCDispTestWrappedJS,
       };

       for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
       {
              if (InlineIsEqualGUID(*arr[i],riid))
                     return S_OK;
       }
       return S_FALSE;
}
STDMETHODIMP nsXPCDispTestWrappedJS::TestParamTypes ( IDispatch obj,
BSTR *  errMsg 
)

This tests interacting with JS Objects via IDispatch.

Parameters:
objthe object being tested
errMsgstring receiving any error message, blank if no error

Definition at line 137 of file nsXPCDispTestWrappedJS.cpp.

{
    CComPtr<IDispatch> ptr;
    CComBSTR progID("XPCIDispatchTest.nsXPCDispSimple.1");
    ptr.CoCreateInstance(progID);
    _variant_t dispatchPtr;
    dispatchPtr = static_cast<IDispatch*>(ptr);
    CURRENCY currency;
    currency.int64 = 55555;
    _variant_t date(3000.0, VT_DATE);
    _variant_t nullVariant;
    nullVariant.ChangeType(VT_NULL);
    const TestData tests[] =
    {
        TestData("Boolean", _variant_t(true), CompareVariant),
        TestData("Short", _variant_t(short(4200)), reinterpret_cast<TestData::CompFunc>(CompareVariantlong)),
        TestData("Long", _variant_t(long(-42000000)), CompareVariantlong),
        TestData("Float", _variant_t(float(4.5)), CompareVariantfloat),
        TestData("Double", _variant_t(-11111.11), CompareVariant),
//        TestData("Currency", _variant_t(currency), CompareVariantdouble),
        TestData("Date", date, CompareVariant_bstr_t),
        TestData("String", _variant_t("A String"), CompareVariant),
        TestData("DispatchPtr", dispatchPtr, CompareVariant),
//        TestData("SCode", _variant_t(long(5), VT_ERROR), CompareVariant_bstr_t),
        TestData("Variant", nullVariant, CompareVariant),
        TestData("Char", _variant_t(BYTE('x')), CompareVariant_bstr_t)
    };
    std::string errors;
    for (size_t index = 0; index < sizeof(tests) / sizeof(TestData); ++index)
    {
        std::string msg = DispInvoke(obj, tests[index]);
        if (!msg.empty())
        {
            errors += msg;
            errors += "\r\n";
        }
    }
    CComBSTR errorMsg(errors.c_str());
    *errMsg = errorMsg.Detach();
    return S_OK;
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: