Back to index

lightning-sunbird  0.9+nobinonly
nsXPCDispTestProperties.cpp
Go to the documentation of this file.
00001 // nsXPCDispTestProperties.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
00002 
00003 #include "stdafx.h"
00004 #include "XPCIDispatchTest.h"
00005 #include "nsXPCDispTestProperties.h"
00006 
00007 const long PARAMETERIZED_PROPERTY_COUNT = 5;
00009 //
00010 
00011 STDMETHODIMP nsXPCDispTestProperties::InterfaceSupportsErrorInfo(REFIID riid)
00012 {
00013     static const IID* arr[] = 
00014     {
00015         &IID_nsIXPCDispTestProperties,
00016     };
00017 
00018     for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
00019     {
00020         if (InlineIsEqualGUID(*arr[i],riid))
00021             return S_OK;
00022     }
00023     return S_FALSE;
00024 }
00025 
00026 nsXPCDispTestProperties::nsXPCDispTestProperties() :
00027     mChar('a'),
00028     mBOOL(FALSE),
00029     mSCode(0),
00030     mDATE(0),
00031     mDouble(0.0),
00032     mFloat(0.0f),
00033     mLong(0),
00034     mShort(0),
00035     mParameterizedProperty(new long[PARAMETERIZED_PROPERTY_COUNT])
00036 {
00037     mCURRENCY.int64 = 0;
00038     CComBSTR string("Initial value");
00039     mBSTR = string.Detach();
00040     for (long index = 0; index < PARAMETERIZED_PROPERTY_COUNT; ++index)
00041         mParameterizedProperty[index] = index + 1;
00042 }
00043 
00044 nsXPCDispTestProperties::~nsXPCDispTestProperties()
00045 {
00046     delete [] mParameterizedProperty;
00047 }
00048 
00049 STDMETHODIMP nsXPCDispTestProperties::get_Short(short *pVal)
00050 {
00051     *pVal = mShort;
00052 
00053     return S_OK;
00054 }
00055 
00056 STDMETHODIMP nsXPCDispTestProperties::put_Short(short newVal)
00057 {
00058     mShort = newVal;
00059 
00060     return S_OK;
00061 }
00062 
00063 STDMETHODIMP nsXPCDispTestProperties::get_Long(long *pVal)
00064 {
00065     *pVal = mLong;
00066 
00067     return S_OK;
00068 }
00069 
00070 STDMETHODIMP nsXPCDispTestProperties::put_Long(long newVal)
00071 {
00072     mLong = newVal;
00073 
00074     return S_OK;
00075 }
00076 
00077 STDMETHODIMP nsXPCDispTestProperties::get_Float(float *pVal)
00078 {
00079     *pVal = mFloat;
00080 
00081     return S_OK;
00082 }
00083 
00084 STDMETHODIMP nsXPCDispTestProperties::put_Float(float newVal)
00085 {
00086     mFloat = newVal;
00087 
00088     return S_OK;
00089 }
00090 
00091 STDMETHODIMP nsXPCDispTestProperties::get_Double(double *pVal)
00092 {
00093     *pVal = mDouble;
00094 
00095     return S_OK;
00096 }
00097 
00098 STDMETHODIMP nsXPCDispTestProperties::put_Double(double newVal)
00099 {
00100     mDouble = newVal;
00101 
00102     return S_OK;
00103 }
00104 
00105 STDMETHODIMP nsXPCDispTestProperties::get_Currency(CURRENCY *pVal)
00106 {
00107     *pVal = mCURRENCY;
00108 
00109     return S_OK;
00110 }
00111 
00112 STDMETHODIMP nsXPCDispTestProperties::put_Currency(CURRENCY newVal)
00113 {
00114     mCURRENCY = newVal;
00115 
00116     return S_OK;
00117 }
00118 
00119 STDMETHODIMP nsXPCDispTestProperties::get_Date(DATE *pVal)
00120 {
00121     *pVal = mDATE;
00122 
00123     return S_OK;
00124 }
00125 
00126 STDMETHODIMP nsXPCDispTestProperties::put_Date(DATE newVal)
00127 {
00128     mDATE = newVal;
00129 
00130     return S_OK;
00131 }
00132 
00133 STDMETHODIMP nsXPCDispTestProperties::get_String(BSTR *pVal)
00134 {
00135     *pVal = mBSTR.Copy();
00136 
00137     return S_OK;
00138 }
00139 
00140 STDMETHODIMP nsXPCDispTestProperties::put_String(BSTR newVal)
00141 {
00142     mBSTR = newVal;
00143 
00144     return S_OK;
00145 }
00146 
00147 STDMETHODIMP nsXPCDispTestProperties::get_DispatchPtr(IDispatch **pVal)
00148 {
00149     mIDispatch.CopyTo(pVal);
00150 
00151     return S_OK;
00152 }
00153 
00154 STDMETHODIMP nsXPCDispTestProperties::put_DispatchPtr(IDispatch *newVal)
00155 {
00156     mIDispatch = newVal;
00157 
00158     return S_OK;
00159 }
00160 
00161 STDMETHODIMP nsXPCDispTestProperties::get_SCode(SCODE *pVal)
00162 {
00163     *pVal = mSCode;
00164 
00165     return S_OK;
00166 }
00167 
00168 STDMETHODIMP nsXPCDispTestProperties::put_SCode(SCODE newVal)
00169 {
00170     mSCode = newVal;
00171 
00172     return S_OK;
00173 }
00174 
00175 STDMETHODIMP nsXPCDispTestProperties::get_Boolean(BOOL *pVal)
00176 {
00177     *pVal = mBOOL;
00178 
00179     return S_OK;
00180 }
00181 
00182 STDMETHODIMP nsXPCDispTestProperties::put_Boolean(BOOL newVal)
00183 {
00184     mBOOL = newVal;
00185 
00186     return S_OK;
00187 }
00188 
00189 STDMETHODIMP nsXPCDispTestProperties::get_Variant(VARIANT *pVal)
00190 {
00191     ::VariantCopy(pVal, &mVariant);
00192 
00193     return S_OK;
00194 }
00195 
00196 STDMETHODIMP nsXPCDispTestProperties::put_Variant(VARIANT newVal)
00197 {
00198     mVariant = newVal;
00199 
00200     return S_OK;
00201 }
00202 
00203 STDMETHODIMP nsXPCDispTestProperties::get_COMPtr(IUnknown **pVal)
00204 {
00205     mIUnknown.CopyTo(pVal);
00206 
00207     return S_OK;
00208 }
00209 
00210 STDMETHODIMP nsXPCDispTestProperties::put_COMPtr(IUnknown *newVal)
00211 {
00212     mIUnknown = newVal;
00213 
00214     return S_OK;
00215 }
00216 
00217 STDMETHODIMP nsXPCDispTestProperties::get_Char(unsigned char *pVal)
00218 {
00219     *pVal = mChar;
00220 
00221     return S_OK;
00222 }
00223 
00224 STDMETHODIMP nsXPCDispTestProperties::put_Char(unsigned char newVal)
00225 {
00226     mChar = newVal;
00227 
00228     return S_OK;
00229 }
00230 
00231 STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedProperty(long aIndex, long *pVal)
00232 {
00233     if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
00234         return E_FAIL;
00235 
00236        *pVal = mParameterizedProperty[aIndex];
00237 
00238        return S_OK;
00239 }
00240 
00241 STDMETHODIMP nsXPCDispTestProperties::put_ParameterizedProperty(long aIndex, long newVal)
00242 {
00243     if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
00244         return E_FAIL;
00245 
00246        mParameterizedProperty[aIndex] = newVal;
00247 
00248        return S_OK;
00249 }
00250 
00251 STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedPropertyCount(long *pVal)
00252 {
00253        *pVal = PARAMETERIZED_PROPERTY_COUNT;
00254 
00255        return S_OK;
00256 }