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

« back to all changes in this revision

Viewing changes to mozilla/js/src/xpconnect/tests/components/xpctest_out.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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
2
 *
 
3
 * ***** BEGIN LICENSE BLOCK *****
 
4
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
5
 *
 
6
 * The contents of this file are subject to the Mozilla Public License Version
 
7
 * 1.1 (the "License"); you may not use this file except in compliance with
 
8
 * the License. You may obtain a copy of the License at
 
9
 * http://www.mozilla.org/MPL/
 
10
 *
 
11
 * Software distributed under the License is distributed on an "AS IS" basis,
 
12
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
13
 * for the specific language governing rights and limitations under the
 
14
 * License.
 
15
 *
 
16
 * The Original Code is Mozilla Communicator client code, released
 
17
 * March 31, 1998.
 
18
 *
 
19
 * The Initial Developer of the Original Code is
 
20
 * Netscape Communications Corporation.
 
21
 * Portions created by the Initial Developer are Copyright (C) 1998
 
22
 * the Initial Developer. All Rights Reserved.
 
23
 *
 
24
 * Contributor(s):
 
25
 *   John Bandhauer <jband@netscape.com>
 
26
 *
 
27
 * Alternatively, the contents of this file may be used under the terms of
 
28
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 
29
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
30
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
31
 * of those above. If you wish to allow use of your version of this file only
 
32
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
33
 * use your version of this file under the terms of the MPL, indicate your
 
34
 * decision by deleting the provisions above and replace them with the notice
 
35
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
36
 * the provisions above, a recipient may use your version of this file under
 
37
 * the terms of any one of the MPL, the GPL or the LGPL.
 
38
 *
 
39
 * ***** END LICENSE BLOCK ***** */
 
40
 
 
41
#include "xpctest_private.h"
 
42
#include "xpctest_out.h"
 
43
#include "nsISupports.h"
 
44
 
 
45
#define NS_IXPCTESTOUT_IID \
 
46
  {0x4105ae88, 0x5599, 0x11d3, \
 
47
    { 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
 
48
 
 
49
class xpcTestOut : public nsIXPCTestOut {
 
50
public:
 
51
NS_DECL_ISUPPORTS
 
52
NS_DECL_NSIXPCTESTOUT
 
53
xpcTestOut();
 
54
 
 
55
private:
 
56
    PRInt32   longProperty;
 
57
    PRInt16  shortProperty;
 
58
    char   charProperty;
 
59
    float  floatProperty;
 
60
    double doubleProperty;
 
61
    PRUnichar * stringProperty;
 
62
    PRBool booleanProperty;
 
63
    PRUint8 octetProperty;
 
64
    PRUint16 unsignedShortProperty;
 
65
    PRUint32 unsignedLongProperty;
 
66
    PRInt64 longLongProperty;
 
67
    PRUnichar wcharProperty;
 
68
//      PRUnichar *wsStringProperty;
 
69
 
 
70
    PRBool PRBoolProperty;
 
71
    PRInt32 PRInt32Property;
 
72
    PRInt16 PRInt16Property;
 
73
    PRInt64 PRInt64Property;
 
74
    PRUint8 PRUint8Property;
 
75
    PRUint16 PRUint16Property;
 
76
    PRUint32 PRUint32Property;
 
77
    PRUint64 PRUint64Property;
 
78
};
 
79
 
 
80
 
 
81
NS_IMPL_ISUPPORTS1(xpcTestOut, nsIXPCTestOut)
 
82
 
 
83
xpcTestOut :: xpcTestOut() {
 
84
    NS_ADDREF_THIS();
 
85
}
 
86
 
 
87
NS_IMETHODIMP xpcTestOut :: GetLong(PRInt32 *l){
 
88
    *l = longProperty;
 
89
    return NS_OK;
 
90
}
 
91
NS_IMETHODIMP xpcTestOut :: SetLong(PRInt32 l){
 
92
    longProperty = l;
 
93
    return NS_OK;
 
94
}
 
95
NS_IMETHODIMP xpcTestOut :: GetShort(PRInt16 *s){
 
96
    *s  = shortProperty;
 
97
    return NS_OK;
 
98
}
 
99
NS_IMETHODIMP xpcTestOut :: SetShort(PRInt16 s){
 
100
    shortProperty = s;
 
101
    return NS_OK;
 
102
}
 
103
NS_IMETHODIMP xpcTestOut :: SetChar(char c){
 
104
    charProperty = c;
 
105
    return NS_OK;
 
106
}
 
107
NS_IMETHODIMP xpcTestOut :: GetChar(char *c){
 
108
    *c = charProperty;
 
109
    return NS_OK;
 
110
}
 
111
NS_IMETHODIMP xpcTestOut :: GetBoolean(PRBool *b){
 
112
    *b = booleanProperty;
 
113
    return NS_OK;
 
114
}
 
115
NS_IMETHODIMP xpcTestOut :: SetBoolean(PRBool b){
 
116
    booleanProperty = b;
 
117
    return NS_OK;
 
118
}
 
119
NS_IMETHODIMP xpcTestOut :: GetOctet(PRUint8 *o){
 
120
    *o = octetProperty;
 
121
    return NS_OK;
 
122
}
 
123
NS_IMETHODIMP xpcTestOut :: SetOctet(PRUint8 o){
 
124
    octetProperty = o;
 
125
    return NS_OK;
 
126
}
 
127
NS_IMETHODIMP xpcTestOut :: GetLongLong(PRInt64 *ll){
 
128
    *ll = longLongProperty;
 
129
    return NS_OK;
 
130
}
 
131
NS_IMETHODIMP xpcTestOut :: SetLongLong(PRInt64 ll){
 
132
    longLongProperty = ll;
 
133
    return NS_OK;
 
134
}
 
135
NS_IMETHODIMP xpcTestOut :: GetUnsignedShort(PRUint16 *us){
 
136
    *us = unsignedShortProperty;
 
137
    return NS_OK;
 
138
}
 
139
NS_IMETHODIMP xpcTestOut :: SetUnsignedShort(PRUint16 us){
 
140
    unsignedShortProperty = us;
 
141
    return NS_OK;
 
142
}
 
143
NS_IMETHODIMP xpcTestOut :: GetUnsignedLong(PRUint32 *ul){
 
144
    *ul = unsignedLongProperty;
 
145
    return NS_OK;
 
146
}
 
147
NS_IMETHODIMP xpcTestOut :: SetUnsignedLong(PRUint32 ul){
 
148
    unsignedLongProperty = ul;
 
149
    return NS_OK;
 
150
}
 
151
NS_IMETHODIMP xpcTestOut :: GetFloat(float *f){
 
152
    *f = floatProperty;
 
153
    return NS_OK;
 
154
}
 
155
NS_IMETHODIMP xpcTestOut :: SetFloat(float f){
 
156
    floatProperty = f;
 
157
    return NS_OK;
 
158
}
 
159
NS_IMETHODIMP xpcTestOut :: GetDouble(double *d){
 
160
    *d = doubleProperty;
 
161
    return NS_OK;
 
162
}
 
163
NS_IMETHODIMP xpcTestOut :: SetDouble(double d){
 
164
    doubleProperty = d;
 
165
    return NS_OK;
 
166
}
 
167
NS_IMETHODIMP xpcTestOut :: GetWchar(PRUnichar *wc){
 
168
    *wc = wcharProperty;
 
169
    return NS_OK;
 
170
}
 
171
NS_IMETHODIMP xpcTestOut :: SetWchar(PRUnichar wc){
 
172
    wcharProperty = wc;
 
173
    return NS_OK;
 
174
}
 
175
/*
 
176
NS_IMETHODIMP xpcTestOut :: GetString(PRUnichar **ws){
 
177
    **ws = *stringProperty;
 
178
 
 
179
    if(!stringProperty)
 
180
        return NS_ERROR_NULL_POINTER;
 
181
    *ws = (PRUnichar *) nsMemory::Clone(stringProperty, 
 
182
                    sizeof(char) *(strlen(stringProperty)+1));
 
183
    return **ws? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 
184
 
 
185
    return NS_OK;
 
186
}
 
187
NS_IMETHODIMP xpcTestOut :: SetString(const PRUnichar *ws){
 
188
    //stringProperty = ws;
 
189
    return NS_OK;
 
190
}
 
191
*/
 
192
NS_IMETHODIMP xpcTestOut :: GetPRBool(PRBool *b){
 
193
    *b = PRBoolProperty;
 
194
    return NS_OK;
 
195
}
 
196
NS_IMETHODIMP xpcTestOut :: SetPRBool(PRBool b){
 
197
    PRBoolProperty = b;
 
198
    return NS_OK;
 
199
}
 
200
NS_IMETHODIMP xpcTestOut :: GetPRInt32(PRInt32 *l){
 
201
    *l = PRInt32Property;
 
202
    return NS_OK;
 
203
}
 
204
NS_IMETHODIMP xpcTestOut :: SetPRInt32(PRInt32 l){
 
205
    PRInt32Property = l;
 
206
    return NS_OK;
 
207
}
 
208
NS_IMETHODIMP xpcTestOut :: GetPRInt16(PRInt16 *l){
 
209
    *l = PRInt16Property;
 
210
    return NS_OK;
 
211
}
 
212
NS_IMETHODIMP xpcTestOut :: SetPRInt16(PRInt16 l){
 
213
    PRInt16Property = l;
 
214
    return NS_OK;
 
215
}
 
216
NS_IMETHODIMP xpcTestOut :: GetPRInt64(PRInt64 *i){
 
217
    *i = PRInt64Property;
 
218
    return NS_OK;
 
219
}
 
220
NS_IMETHODIMP xpcTestOut :: SetPRInt64(PRInt64 i){
 
221
    PRInt64Property = i;
 
222
    return NS_OK;
 
223
}
 
224
NS_IMETHODIMP xpcTestOut :: GetPRUint8(PRUint8 *i){
 
225
    *i = PRUint8Property;
 
226
    return NS_OK;
 
227
}
 
228
NS_IMETHODIMP xpcTestOut :: SetPRUint8(PRUint8 i){
 
229
    PRUint8Property = i;
 
230
    return NS_OK;
 
231
}
 
232
NS_IMETHODIMP xpcTestOut :: GetPRUint16(PRUint16 *i){
 
233
    *i = PRUint16Property;
 
234
    return NS_OK;
 
235
}
 
236
NS_IMETHODIMP xpcTestOut :: SetPRUint16(PRUint16 i){
 
237
    PRUint16Property = i;
 
238
    return NS_OK;
 
239
}
 
240
NS_IMETHODIMP xpcTestOut :: GetPRUint32(PRUint32 *i){
 
241
    *i = PRUint32Property;
 
242
    return NS_OK;
 
243
}
 
244
NS_IMETHODIMP xpcTestOut :: SetPRUint32(PRUint32 i){
 
245
    PRUint32Property = i;
 
246
    return NS_OK;
 
247
}
 
248
NS_IMETHODIMP xpcTestOut :: GetPRUint64(PRUint64 *i){
 
249
    *i = PRUint64Property;
 
250
    return NS_OK;
 
251
}
 
252
NS_IMETHODIMP xpcTestOut :: SetPRUint64(PRUint64 i){
 
253
    PRUint64Property = i;
 
254
    return NS_OK;
 
255
}
 
256
/*
 
257
NS_IMETHODIMP xpcTestOut :: GetVoidStar(void * *vs){
 
258
    **vs = voidStarProperty;
 
259
    return NS_OK;
 
260
}
 
261
NS_IMETHODIMP xpcTestOut :: SetVoidStar(void * vs){
 
262
    voidStarProperty = vs;
 
263
    return NS_OK;
 
264
}
 
265
NS_IMETHODIMP xpcTestOut :: GetCharStar(char * *cs){
 
266
    return NS_OK;
 
267
}
 
268
NS_IMETHODIMP xpcTestOut :: SetCharStar(char * cs){
 
269
    return NS_OK;
 
270
}
 
271
 
 
272
NS_IMETHODIMP xpcTestOut :: GetNsIDRef(nsID & *r){
 
273
    return NS_OK;
 
274
}
 
275
NS_IMETHODIMP xpcTestOut :: SetNsIDRef(const nsID & r){
 
276
    return NS_OK;
 
277
}
 
278
NS_IMETHODIMP xpcTestOut :: GetNsCIDRef(nsCID & *r){
 
279
    return NS_OK;
 
280
}
 
281
NS_IMETHODIMP xpcTestOut :: SetNsCIDRef(const nsCID & r){
 
282
    return NS_OK;
 
283
}
 
284
 
 
285
NS_IMETHODIMP xpcTestOut :: GetNsIDPtr(nsID * *p){
 
286
    return NS_OK;
 
287
}
 
288
NS_IMETHODIMP xpcTestOut :: SetNsIDPtr(const nsID * p){
 
289
    return NS_OK;
 
290
}
 
291
NS_IMETHODIMP xpcTestOut :: GetNsIIDPtr(nsIID * *p){
 
292
    return NS_OK;
 
293
}
 
294
NS_IMETHODIMP xpcTestOut :: SetNsIIDPtr(const nsIID * p){
 
295
    return NS_OK;
 
296
}
 
297
NS_IMETHODIMP xpcTestOut :: GetNsCIDPtr(nsCID * *p){
 
298
    return NS_OK;
 
299
}
 
300
NS_IMETHODIMP xpcTestOut :: SetNsCIDPtr(const nsCID * p){
 
301
    return NS_OK;
 
302
}
 
303
NS_IMETHODIMP xpcTestOut :: GetNsQIResult(void * *r){
 
304
    return NS_OK;
 
305
}
 
306
NS_IMETHODIMP xpcTestOut :: SetNsQIResult(void * r){
 
307
    return NS_OK;
 
308
}
 
309
NS_IMETHODIMP xpcTestOut :: GetVoid(void){
 
310
    return NS_OK;
 
311
}
 
312
NS_IMETHODIMP xpcTestOut :: SetVoid(void){
 
313
    return NS_OK;
 
314
}
 
315
*/
 
316
NS_IMETHODIMP
 
317
xpctest::ConstructXPCTestOut(nsISupports *aOuter, REFNSIID aIID, void **aResult)
 
318
{
 
319
    nsresult rv;
 
320
    NS_ASSERTION(aOuter == nsnull, "no aggregation");
 
321
    xpcTestOut *obj = new xpcTestOut();
 
322
 
 
323
    if(obj)
 
324
    {
 
325
        rv = obj->QueryInterface(aIID, aResult);
 
326
        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
 
327
        NS_RELEASE(obj);
 
328
    }
 
329
    else
 
330
    {
 
331
        *aResult = nsnull;
 
332
        rv = NS_ERROR_OUT_OF_MEMORY;
 
333
    }
 
334
    return rv;
 
335
}