Back to index

lightning-sunbird  0.9+nobinonly
xpctest_in.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is Mozilla Communicator client code, released
00017  * March 31, 1998.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 1998
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   John Bandhauer <jband@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #include "xpctest_private.h"
00042 #include "xpctest_in.h"
00043 #include "nsISupports.h"
00044 #define NS_IXPCTESTIN_IID \
00045   {0x318d6f6a, 0x5411, 0x11d3, \
00046     { 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
00047 
00048 
00049 class xpcTestIn : public nsIXPCTestIn {
00050 public:
00051   NS_DECL_ISUPPORTS
00052   NS_DECL_NSIXPCTESTIN
00053 
00054   xpcTestIn();
00055 };
00056 
00057 NS_IMPL_ISUPPORTS1(xpcTestIn, nsIXPCTestIn)
00058 
00059 xpcTestIn :: xpcTestIn() {
00060     NS_ADDREF_THIS();
00061 }
00062 
00063 NS_IMETHODIMP xpcTestIn :: EchoLong(PRInt32 l, PRInt32 *_retval) {
00064     *_retval = l;
00065     return NS_OK;
00066 }
00067 NS_IMETHODIMP xpcTestIn :: EchoShort(PRInt16 a, PRInt16 *_retval) {
00068     *_retval = a;
00069     return NS_OK;
00070 }
00071 NS_IMETHODIMP xpcTestIn :: EchoChar(char c, char *_retval) {
00072     *_retval = c;
00073     return NS_OK;
00074 }
00075 NS_IMETHODIMP xpcTestIn :: EchoBoolean(PRBool b, PRBool *_retval) {
00076     *_retval = b;
00077     return NS_OK;
00078 }
00079 NS_IMETHODIMP xpcTestIn :: EchoOctet(PRUint8 o, PRUint8 *_retval) {
00080     *_retval = o;
00081     return NS_OK;
00082 }
00083 NS_IMETHODIMP xpcTestIn :: EchoLongLong(PRInt64 ll, PRInt64 *_retval) {
00084     *_retval = ll;
00085     return NS_OK;
00086 }
00087 NS_IMETHODIMP xpcTestIn :: EchoUnsignedShort(PRUint16 us, PRUint16 *_retval) {
00088     *_retval = us;
00089     return NS_OK;
00090 }
00091 NS_IMETHODIMP xpcTestIn :: EchoUnsignedLong(PRUint32 ul, PRUint32 *_retval) {
00092     *_retval = ul;
00093     return NS_OK;
00094 }
00095 NS_IMETHODIMP xpcTestIn :: EchoFloat(float f, float *_retval) {
00096     *_retval = f;
00097     return NS_OK;
00098 }
00099 NS_IMETHODIMP xpcTestIn :: EchoDouble(double d, double *_retval) {
00100     *_retval = d;
00101     return NS_OK;
00102 }
00103 NS_IMETHODIMP xpcTestIn :: EchoWchar(PRUnichar wc, PRUnichar *_retval) {
00104     *_retval = wc;
00105     return NS_OK;
00106 }
00107 NS_IMETHODIMP xpcTestIn :: EchoString(const PRUnichar *ws, char **_retval) {
00108 /*  const char s[] = *ws;
00109     **_retval= (char*) nsMemory::Clone(s, 
00110                                     sizeof(char)*(strlen(s)+1));
00111     return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
00112 */
00113     return NS_OK;
00114 }
00115 NS_IMETHODIMP xpcTestIn :: EchoPRBool(PRBool b, PRBool *_retval) {
00116     *_retval = b;
00117     return NS_OK;
00118 }
00119 NS_IMETHODIMP xpcTestIn :: EchoPRInt32(PRInt32 l, PRInt32 *_retval) {
00120     *_retval = l;
00121     return NS_OK;
00122 }
00123 NS_IMETHODIMP xpcTestIn :: EchoPRInt16(PRInt16 l, PRInt16 *_retval) {
00124     *_retval = l;
00125     return NS_OK;
00126 }
00127 NS_IMETHODIMP xpcTestIn :: EchoPRInt64(PRInt64 i, PRInt64 *_retval) {
00128     *_retval = i;
00129     return NS_OK;
00130 }
00131 NS_IMETHODIMP xpcTestIn :: EchoPRUint8(PRUint8 i, PRUint8 *_retval){
00132     *_retval = i;
00133     return NS_OK;
00134 }
00135 NS_IMETHODIMP xpcTestIn :: EchoPRUint16(PRUint16 i, PRUint16 *_retval){
00136     *_retval = i;
00137     return NS_OK;
00138 }
00139 NS_IMETHODIMP xpcTestIn :: EchoPRUint32(PRUint32 i, PRUint32 *_retval){
00140     *_retval = i;
00141     return NS_OK;
00142 }
00143 NS_IMETHODIMP xpcTestIn :: EchoPRUint64(PRUint64 i, PRUint64 *_retval) {
00144     *_retval = i;
00145     return NS_OK;
00146 }
00147 NS_IMETHODIMP xpcTestIn :: EchoVoidPtr(void * vs, void * *_retval) {
00148     *_retval = vs;
00149     return NS_OK;
00150 } 
00151 
00152 NS_IMETHODIMP xpcTestIn :: EchoCharPtr(char * cs, char * *_retval) {
00153     **_retval = *cs;
00154     return NS_OK;
00155 }
00156 
00157 NS_IMETHODIMP xpcTestIn :: EchoPRUint32_2(PRUint32 i, PRUint32 *_retval){
00158     *_retval = i;
00159     return NS_OK;
00160 }
00161  /*
00162 NS_IMETHODIMP xpcTestIn :: EchoNsIDRef(const nsID & r, nsID & *_retval) {
00163     &*_retval = r;
00164 }
00165 NS_IMETHODIMP xpcTestIn :: EchoNsCIDRef(const nsCID & r, nsCID & *_retval) {
00166     &*_retval = r;
00167 }
00168 NS_IMETHODIMP xpcTestIn :: EchoNsIDPtr(const nsID * p, nsID * *_retval) {
00169     **_retval = p;
00170 }
00171 NS_IMETHODIMP xpcTestIn :: EchoNsIIDPtr(const nsIID * p, nsIID * *_retval) {
00172     *_retval = p;
00173 }
00174 NS_IMETHODIMP xpcTestIn :: EchoNsCIDPtr(const nsCID * p, nsCID * *_retval) {
00175     *_retval = p;
00176 }
00177 NS_IMETHODIMP xpcTestIn :: EchoNsQIResult(void * r, void * *_retval) {
00178     **_retval = r;
00179 }
00180 */
00181 NS_IMETHODIMP xpcTestIn :: EchoVoid(void) {
00182     return NS_OK;
00183 }
00184 
00185 NS_IMETHODIMP
00186 xpctest::ConstructXPCTestIn(nsISupports *aOuter, REFNSIID aIID, void **aResult)
00187 {
00188     nsresult rv;
00189     NS_ASSERTION(aOuter == nsnull, "no aggregation");
00190     xpcTestIn *obj = new xpcTestIn();
00191 
00192     if(obj)
00193     {
00194         rv = obj->QueryInterface(aIID, aResult);
00195         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
00196         NS_RELEASE(obj);
00197     }
00198     else
00199     {
00200         *aResult = nsnull;
00201         rv = NS_ERROR_OUT_OF_MEMORY;
00202     }
00203     return rv;
00204 }