~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/js/src/xpconnect/tests/idispatch/COM/nsXPCDispTestProperties.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// nsXPCDispTestProperties.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
 
2
 
 
3
#include "stdafx.h"
 
4
#include "XPCIDispatchTest.h"
 
5
#include "nsXPCDispTestProperties.h"
 
6
 
 
7
const long PARAMETERIZED_PROPERTY_COUNT = 5;
 
8
/////////////////////////////////////////////////////////////////////////////
 
9
//
 
10
 
 
11
STDMETHODIMP nsXPCDispTestProperties::InterfaceSupportsErrorInfo(REFIID riid)
 
12
{
 
13
    static const IID* arr[] = 
 
14
    {
 
15
        &IID_nsIXPCDispTestProperties,
 
16
    };
 
17
 
 
18
    for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
 
19
    {
 
20
        if (InlineIsEqualGUID(*arr[i],riid))
 
21
            return S_OK;
 
22
    }
 
23
    return S_FALSE;
 
24
}
 
25
 
 
26
nsXPCDispTestProperties::nsXPCDispTestProperties() :
 
27
    mChar('a'),
 
28
    mBOOL(FALSE),
 
29
    mSCode(0),
 
30
    mDATE(0),
 
31
    mDouble(0.0),
 
32
    mFloat(0.0f),
 
33
    mLong(0),
 
34
    mShort(0),
 
35
    mParameterizedProperty(new long[PARAMETERIZED_PROPERTY_COUNT])
 
36
{
 
37
    mCURRENCY.int64 = 0;
 
38
    CComBSTR string("Initial value");
 
39
    mBSTR = string.Detach();
 
40
    for (long index = 0; index < PARAMETERIZED_PROPERTY_COUNT; ++index)
 
41
        mParameterizedProperty[index] = index + 1;
 
42
}
 
43
 
 
44
nsXPCDispTestProperties::~nsXPCDispTestProperties()
 
45
{
 
46
    delete [] mParameterizedProperty;
 
47
}
 
48
 
 
49
STDMETHODIMP nsXPCDispTestProperties::get_Short(short *pVal)
 
50
{
 
51
    *pVal = mShort;
 
52
 
 
53
    return S_OK;
 
54
}
 
55
 
 
56
STDMETHODIMP nsXPCDispTestProperties::put_Short(short newVal)
 
57
{
 
58
    mShort = newVal;
 
59
 
 
60
    return S_OK;
 
61
}
 
62
 
 
63
STDMETHODIMP nsXPCDispTestProperties::get_Long(long *pVal)
 
64
{
 
65
    *pVal = mLong;
 
66
 
 
67
    return S_OK;
 
68
}
 
69
 
 
70
STDMETHODIMP nsXPCDispTestProperties::put_Long(long newVal)
 
71
{
 
72
    mLong = newVal;
 
73
 
 
74
    return S_OK;
 
75
}
 
76
 
 
77
STDMETHODIMP nsXPCDispTestProperties::get_Float(float *pVal)
 
78
{
 
79
    *pVal = mFloat;
 
80
 
 
81
    return S_OK;
 
82
}
 
83
 
 
84
STDMETHODIMP nsXPCDispTestProperties::put_Float(float newVal)
 
85
{
 
86
    mFloat = newVal;
 
87
 
 
88
    return S_OK;
 
89
}
 
90
 
 
91
STDMETHODIMP nsXPCDispTestProperties::get_Double(double *pVal)
 
92
{
 
93
    *pVal = mDouble;
 
94
 
 
95
    return S_OK;
 
96
}
 
97
 
 
98
STDMETHODIMP nsXPCDispTestProperties::put_Double(double newVal)
 
99
{
 
100
    mDouble = newVal;
 
101
 
 
102
    return S_OK;
 
103
}
 
104
 
 
105
STDMETHODIMP nsXPCDispTestProperties::get_Currency(CURRENCY *pVal)
 
106
{
 
107
    *pVal = mCURRENCY;
 
108
 
 
109
    return S_OK;
 
110
}
 
111
 
 
112
STDMETHODIMP nsXPCDispTestProperties::put_Currency(CURRENCY newVal)
 
113
{
 
114
    mCURRENCY = newVal;
 
115
 
 
116
    return S_OK;
 
117
}
 
118
 
 
119
STDMETHODIMP nsXPCDispTestProperties::get_Date(DATE *pVal)
 
120
{
 
121
    *pVal = mDATE;
 
122
 
 
123
    return S_OK;
 
124
}
 
125
 
 
126
STDMETHODIMP nsXPCDispTestProperties::put_Date(DATE newVal)
 
127
{
 
128
    mDATE = newVal;
 
129
 
 
130
    return S_OK;
 
131
}
 
132
 
 
133
STDMETHODIMP nsXPCDispTestProperties::get_String(BSTR *pVal)
 
134
{
 
135
    *pVal = mBSTR.Copy();
 
136
 
 
137
    return S_OK;
 
138
}
 
139
 
 
140
STDMETHODIMP nsXPCDispTestProperties::put_String(BSTR newVal)
 
141
{
 
142
    mBSTR = newVal;
 
143
 
 
144
    return S_OK;
 
145
}
 
146
 
 
147
STDMETHODIMP nsXPCDispTestProperties::get_DispatchPtr(IDispatch **pVal)
 
148
{
 
149
    mIDispatch.CopyTo(pVal);
 
150
 
 
151
    return S_OK;
 
152
}
 
153
 
 
154
STDMETHODIMP nsXPCDispTestProperties::put_DispatchPtr(IDispatch *newVal)
 
155
{
 
156
    mIDispatch = newVal;
 
157
 
 
158
    return S_OK;
 
159
}
 
160
 
 
161
STDMETHODIMP nsXPCDispTestProperties::get_SCode(SCODE *pVal)
 
162
{
 
163
    *pVal = mSCode;
 
164
 
 
165
    return S_OK;
 
166
}
 
167
 
 
168
STDMETHODIMP nsXPCDispTestProperties::put_SCode(SCODE newVal)
 
169
{
 
170
    mSCode = newVal;
 
171
 
 
172
    return S_OK;
 
173
}
 
174
 
 
175
STDMETHODIMP nsXPCDispTestProperties::get_Boolean(BOOL *pVal)
 
176
{
 
177
    *pVal = mBOOL;
 
178
 
 
179
    return S_OK;
 
180
}
 
181
 
 
182
STDMETHODIMP nsXPCDispTestProperties::put_Boolean(BOOL newVal)
 
183
{
 
184
    mBOOL = newVal;
 
185
 
 
186
    return S_OK;
 
187
}
 
188
 
 
189
STDMETHODIMP nsXPCDispTestProperties::get_Variant(VARIANT *pVal)
 
190
{
 
191
    ::VariantCopy(pVal, &mVariant);
 
192
 
 
193
    return S_OK;
 
194
}
 
195
 
 
196
STDMETHODIMP nsXPCDispTestProperties::put_Variant(VARIANT newVal)
 
197
{
 
198
    mVariant = newVal;
 
199
 
 
200
    return S_OK;
 
201
}
 
202
 
 
203
STDMETHODIMP nsXPCDispTestProperties::get_COMPtr(IUnknown **pVal)
 
204
{
 
205
    mIUnknown.CopyTo(pVal);
 
206
 
 
207
    return S_OK;
 
208
}
 
209
 
 
210
STDMETHODIMP nsXPCDispTestProperties::put_COMPtr(IUnknown *newVal)
 
211
{
 
212
    mIUnknown = newVal;
 
213
 
 
214
    return S_OK;
 
215
}
 
216
 
 
217
STDMETHODIMP nsXPCDispTestProperties::get_Char(unsigned char *pVal)
 
218
{
 
219
    *pVal = mChar;
 
220
 
 
221
    return S_OK;
 
222
}
 
223
 
 
224
STDMETHODIMP nsXPCDispTestProperties::put_Char(unsigned char newVal)
 
225
{
 
226
    mChar = newVal;
 
227
 
 
228
    return S_OK;
 
229
}
 
230
 
 
231
STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedProperty(long aIndex, long *pVal)
 
232
{
 
233
    if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
 
234
        return E_FAIL;
 
235
 
 
236
        *pVal = mParameterizedProperty[aIndex];
 
237
 
 
238
        return S_OK;
 
239
}
 
240
 
 
241
STDMETHODIMP nsXPCDispTestProperties::put_ParameterizedProperty(long aIndex, long newVal)
 
242
{
 
243
    if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
 
244
        return E_FAIL;
 
245
 
 
246
        mParameterizedProperty[aIndex] = newVal;
 
247
 
 
248
        return S_OK;
 
249
}
 
250
 
 
251
STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedPropertyCount(long *pVal)
 
252
{
 
253
        *pVal = PARAMETERIZED_PROPERTY_COUNT;
 
254
 
 
255
        return S_OK;
 
256
}