1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3
* ***** BEGIN LICENSE BLOCK *****
4
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
16
* The Original Code is Mozilla Communicator client code, released
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.
25
* John Bandhauer <jband@netscape.com>
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.
39
* ***** END LICENSE BLOCK ***** */
41
#include "xpctest_private.h"
42
#include "xpctest_out.h"
43
#include "nsISupports.h"
45
#define NS_IXPCTESTOUT_IID \
46
{0x4105ae88, 0x5599, 0x11d3, \
47
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
49
class xpcTestOut : public nsIXPCTestOut {
57
PRInt16 shortProperty;
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;
70
PRBool PRBoolProperty;
71
PRInt32 PRInt32Property;
72
PRInt16 PRInt16Property;
73
PRInt64 PRInt64Property;
74
PRUint8 PRUint8Property;
75
PRUint16 PRUint16Property;
76
PRUint32 PRUint32Property;
77
PRUint64 PRUint64Property;
81
NS_IMPL_ISUPPORTS1(xpcTestOut, nsIXPCTestOut)
83
xpcTestOut :: xpcTestOut() {
87
NS_IMETHODIMP xpcTestOut :: GetLong(PRInt32 *l){
91
NS_IMETHODIMP xpcTestOut :: SetLong(PRInt32 l){
95
NS_IMETHODIMP xpcTestOut :: GetShort(PRInt16 *s){
99
NS_IMETHODIMP xpcTestOut :: SetShort(PRInt16 s){
103
NS_IMETHODIMP xpcTestOut :: SetChar(char c){
107
NS_IMETHODIMP xpcTestOut :: GetChar(char *c){
111
NS_IMETHODIMP xpcTestOut :: GetBoolean(PRBool *b){
112
*b = booleanProperty;
115
NS_IMETHODIMP xpcTestOut :: SetBoolean(PRBool b){
119
NS_IMETHODIMP xpcTestOut :: GetOctet(PRUint8 *o){
123
NS_IMETHODIMP xpcTestOut :: SetOctet(PRUint8 o){
127
NS_IMETHODIMP xpcTestOut :: GetLongLong(PRInt64 *ll){
128
*ll = longLongProperty;
131
NS_IMETHODIMP xpcTestOut :: SetLongLong(PRInt64 ll){
132
longLongProperty = ll;
135
NS_IMETHODIMP xpcTestOut :: GetUnsignedShort(PRUint16 *us){
136
*us = unsignedShortProperty;
139
NS_IMETHODIMP xpcTestOut :: SetUnsignedShort(PRUint16 us){
140
unsignedShortProperty = us;
143
NS_IMETHODIMP xpcTestOut :: GetUnsignedLong(PRUint32 *ul){
144
*ul = unsignedLongProperty;
147
NS_IMETHODIMP xpcTestOut :: SetUnsignedLong(PRUint32 ul){
148
unsignedLongProperty = ul;
151
NS_IMETHODIMP xpcTestOut :: GetFloat(float *f){
155
NS_IMETHODIMP xpcTestOut :: SetFloat(float f){
159
NS_IMETHODIMP xpcTestOut :: GetDouble(double *d){
163
NS_IMETHODIMP xpcTestOut :: SetDouble(double d){
167
NS_IMETHODIMP xpcTestOut :: GetWchar(PRUnichar *wc){
171
NS_IMETHODIMP xpcTestOut :: SetWchar(PRUnichar wc){
176
NS_IMETHODIMP xpcTestOut :: GetString(PRUnichar **ws){
177
**ws = *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;
187
NS_IMETHODIMP xpcTestOut :: SetString(const PRUnichar *ws){
188
//stringProperty = ws;
192
NS_IMETHODIMP xpcTestOut :: GetPRBool(PRBool *b){
196
NS_IMETHODIMP xpcTestOut :: SetPRBool(PRBool b){
200
NS_IMETHODIMP xpcTestOut :: GetPRInt32(PRInt32 *l){
201
*l = PRInt32Property;
204
NS_IMETHODIMP xpcTestOut :: SetPRInt32(PRInt32 l){
208
NS_IMETHODIMP xpcTestOut :: GetPRInt16(PRInt16 *l){
209
*l = PRInt16Property;
212
NS_IMETHODIMP xpcTestOut :: SetPRInt16(PRInt16 l){
216
NS_IMETHODIMP xpcTestOut :: GetPRInt64(PRInt64 *i){
217
*i = PRInt64Property;
220
NS_IMETHODIMP xpcTestOut :: SetPRInt64(PRInt64 i){
224
NS_IMETHODIMP xpcTestOut :: GetPRUint8(PRUint8 *i){
225
*i = PRUint8Property;
228
NS_IMETHODIMP xpcTestOut :: SetPRUint8(PRUint8 i){
232
NS_IMETHODIMP xpcTestOut :: GetPRUint16(PRUint16 *i){
233
*i = PRUint16Property;
236
NS_IMETHODIMP xpcTestOut :: SetPRUint16(PRUint16 i){
237
PRUint16Property = i;
240
NS_IMETHODIMP xpcTestOut :: GetPRUint32(PRUint32 *i){
241
*i = PRUint32Property;
244
NS_IMETHODIMP xpcTestOut :: SetPRUint32(PRUint32 i){
245
PRUint32Property = i;
248
NS_IMETHODIMP xpcTestOut :: GetPRUint64(PRUint64 *i){
249
*i = PRUint64Property;
252
NS_IMETHODIMP xpcTestOut :: SetPRUint64(PRUint64 i){
253
PRUint64Property = i;
257
NS_IMETHODIMP xpcTestOut :: GetVoidStar(void * *vs){
258
**vs = voidStarProperty;
261
NS_IMETHODIMP xpcTestOut :: SetVoidStar(void * vs){
262
voidStarProperty = vs;
265
NS_IMETHODIMP xpcTestOut :: GetCharStar(char * *cs){
268
NS_IMETHODIMP xpcTestOut :: SetCharStar(char * cs){
272
NS_IMETHODIMP xpcTestOut :: GetNsIDRef(nsID & *r){
275
NS_IMETHODIMP xpcTestOut :: SetNsIDRef(const nsID & r){
278
NS_IMETHODIMP xpcTestOut :: GetNsCIDRef(nsCID & *r){
281
NS_IMETHODIMP xpcTestOut :: SetNsCIDRef(const nsCID & r){
285
NS_IMETHODIMP xpcTestOut :: GetNsIDPtr(nsID * *p){
288
NS_IMETHODIMP xpcTestOut :: SetNsIDPtr(const nsID * p){
291
NS_IMETHODIMP xpcTestOut :: GetNsIIDPtr(nsIID * *p){
294
NS_IMETHODIMP xpcTestOut :: SetNsIIDPtr(const nsIID * p){
297
NS_IMETHODIMP xpcTestOut :: GetNsCIDPtr(nsCID * *p){
300
NS_IMETHODIMP xpcTestOut :: SetNsCIDPtr(const nsCID * p){
303
NS_IMETHODIMP xpcTestOut :: GetNsQIResult(void * *r){
306
NS_IMETHODIMP xpcTestOut :: SetNsQIResult(void * r){
309
NS_IMETHODIMP xpcTestOut :: GetVoid(void){
312
NS_IMETHODIMP xpcTestOut :: SetVoid(void){
317
xpctest::ConstructXPCTestOut(nsISupports *aOuter, REFNSIID aIID, void **aResult)
320
NS_ASSERTION(aOuter == nsnull, "no aggregation");
321
xpcTestOut *obj = new xpcTestOut();
325
rv = obj->QueryInterface(aIID, aResult);
326
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
332
rv = NS_ERROR_OUT_OF_MEMORY;