new tests for xpconnect.  r=jband.
This commit is contained in:
cbegle%netscape.com 1999-10-12 00:12:43 +00:00
Родитель 1029bbeb6a
Коммит 5c331f88b6
20 изменённых файлов: 2311 добавлений и 5 удалений

Просмотреть файл

@ -49,6 +49,14 @@ XPIDLSRCS = \
nsIJSContextStack.idl \
nsIJSRuntimeService.idl \
nsIXPCSecurityManager.idl \
xpctest_attributes.idl \
xpctest_in.idl \
xpctest_const.idl \
xpctest_out.idl \
xpctest_inout.idl \
xpctest_calljs.idl \
xpctest_multiple.idl \
xpctest_const.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -44,6 +44,14 @@ XPIDLSRCS = \
.\nsIJSContextStack.idl \
.\nsIJSRuntimeService.idl \
.\nsIXPCSecurityManager.idl \
.\xpctest_attributes.idl\
.\xpctest_in.idl\
.\xpctest_const.idl\
.\xpctest_out.idl\
.\xpctest_inout.idl\
.\xpctest_calljs.idl\
.\xpctest_multiple.idl\
.\xpctest_const.idl\
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,106 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
/**
* This describes an interface for objects withconst attributes of
* different types and uses expressions to generate const values.
* | ^ & >> << + - * / % and unary - +
* scoped literals
*/
#include "nsISupports.idl"
#include "nsrootidl.idl"
/**
* Only consts of type short and long are respected.
*/
[scriptable, uuid(83f57a56-4f55-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestConst : nsISupports {
const short shortConst = 254;
const long longConst = 1234567890;
const long long longLongConst= 12345678901234567890;
const unsigned short unsignedShortConst = 255;
const unsigned long unsignedLongConst = 123456789;
const unsigned long long unsignedLongLongConst = 123456789;
const long longExpressionConst = 500*500;
const PRUint8 prUint8Const = 255;
const PRUint16 prUint16Const = 65535;
const PRUint32 prUint32Const = 4294967295;
const PRUint64 prUint64Const = 18446744073709552000;
/*
// built-in types
const boolean booleanConstTrue = "TRUE";
const boolean booleanConstFalse = "FALSE";
//const octet octetConst = 255;
const float floatConst = 0.123456789;
const double doubleConst = -0.123456789;
const char charConst = 'Z';
const wchar wcharConst = 'B';
const string stringConst = "XPConnect const string";
const wstring wstringConst= "XPConnect const wstring";
*/
/*
// PRTypes
const PRBool prBoolConst = TRUE;
const PRUnichar prUnicharConst = 'X';
const PRInt16 prInt16Const = 255;
const PRInt32 prInt32Const = 65535;
const PRInt64 prInt64Const = 4294967295;
const PRTime prTimeConst = 18446744073709552000;
const nsrefcnt nsrefcntConst = 4294967295;
const nsresult nsresultConst = 4294967295;
*/
// natives
/*
[noscript] const native voidStar voidStarConst=
[noscript] const native voidRef voidRefConst =
[noscript] const native nsIDRef nsIDRefConst =
[noscript] const native nsIIDRef nsIIDRefConst=
[noscript] const native nsCIDRef nsCIDRefConst=
[noscript] const native nsIDPtr nsIDPtrConst =
[noscript] const native nsIIDPtr nsIIDPtrConst=
[noscript] const native nsCIDPtr nsCIDPtrConst=
[noscript] const native nsQIResult nsQIResultConst=
*/
};

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,71 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "nsISupports.idl"
[scriptable, uuid(5408fdcc-60a3-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestParentOne : nsISupports {
attribute string ParentOneAttribute;
string ParentOneMethod();
};
[scriptable, uuid(63137392-60a3-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestParentTwo : nsISupports {
attribute string ParentTwoAttribute;
string ParentTwoMethod();
};
[scriptable, uuid(66bed216-60a3-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestChild2 : nsISupports {
attribute string ChildAttribute;
string ChildMethod();
};
[scriptable, uuid(62353978-614e-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestChild3 : nsIXPCTestParentOne {
attribute string ChildAttribute;
string ChildMethod();
};
[scriptable, uuid(a6d22202-622b-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestChild4 : nsIsupports {
attribute string ChildAttribute;
string ChildMethod();
};
[scriptable, uuid(ba3eef4e-6250-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestChild5 : nsIXPCTestParentOne {
attribute string ChildAttribute;
string ChildMethod();
};

Просмотреть файл

@ -0,0 +1,136 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
/**
* Test the 'out' keyword.
*/
#include "nsISupports.idl"
[scriptable, uuid(4105ae88-5599-11d3-82ef-0060b0eb596f)]
interface nsIXPCTestOut : nsISupports {
void GetLong( out long l);
void SetLong( in long l );
void GetShort( out short s );
void SetShort( in short s );
void SetChar( in char c );
void GetChar( out char c);
void GetBoolean( out boolean b );
void SetBoolean( in boolean b );
void GetOctet( out octet o );
void SetOctet( in octet o );
void GetLongLong( in long long ll );
void SetLongLong( in long long ll );
void GetUnsignedShort( out unsigned short us );
void SetUnsignedShort( in unsigned short us );
void GetUnsignedLong( out unsigned long ul );
void SetUnsignedLong( in unsigned long ul );
void GetFloat( out float f );
void SetFloat( in float f );
void GetDouble( out double d );
void SetDouble( in double d );
void GetWchar( out wchar wc );
void SetWchar ( in wchar wc );
//void GetString( out wstring ws );
//void SetString( in wstring ws );
void GetPRBool( out PRBool b );
void SetPRBool (in PRBool b );
void GetPRInt32( out PRInt32 l );
void SetPRInt32( in PRInt32 l );
void GetPRInt16( out PRInt16 l );
void SetPRInt16( in PRInt16 l );
void GetPRInt64( out PRInt64 i );
void SetPRInt64( in PRInt64 i );
void GetPRUint8 ( out PRUint8 i );
void SetPRUint8( in PRUint8 i );
void GetPRUint16( out PRUint16 i );
void SetPRUint16( in PRUint16 i );
void GetPRUint32( out PRUint32 i );
void SetPRUint32( in PRUint32 i );
void GetPRUint64( out PRUint64 i );
void SetPRUint64( in PRUint64 i );
// native types must be marked noscript or they break the idl
// compiler
// [noscript] void GetVoidStar( out voidStar vs );
//[noscript] void SetVoidStar( in voidStar vs );
//[noscript] void GetCharStar( out charStar cs );
//[noscript] void SetCharStar( in charStar cs );
// [noscript] void GetVoidRef( out voidRef vf );
// [noscript] void SetVoidRef( in voidRef vf );
// [noscript] void GetNsIDRef( out nsIDRef r );
// [noscript] void SetNsIDRef( in nsIDRef r );
// [noscript] void GetNsCIDRef( out nsCIDRef r );
// [noscript] void SetNsCIDRef( in nsCIDRef r );
/*
[noscript] void GetNsIDPtr( out nsIDPtr p );
[noscript] void SetNsIDPtr( in nsIDPtr p );
[noscript] void GetNsIIDPtr( out nsIIDPtr p );
[noscript] void SetNsIIDPtr( in nsIIDPtr p );
[noscript] void GetNsCIDPtr( out nsCIDPtr p );
[noscript] void SetNsCIDPtr( in nsCIDPtr p );
[noscript] void GetNsQIResult( out nsQIResult r );
[noscript] void SetNsQIResult( in nsQIResult r );
void GetVoid();
void SetVoid();
*/
};

Просмотреть файл

@ -50,6 +50,13 @@ CPPSRCS = \
xpctest_overloaded.cpp \
xpctest_string.cpp \
xpctest_module.cpp \
xpctest_attributes.cpp \
xpctest_calljs.cpp \
xpctest_const.cpp \
xpctest_in.cpp \
xpctest_inout.cpp \
xpctest_multiple.cpp \
xpctest_out.cpp \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -46,9 +46,16 @@ OBJS= \
.\$(OBJDIR)\xpctest_echo.obj \
.\$(OBJDIR)\xpctest_child.obj \
.\$(OBJDIR)\xpctest_noisy.obj \
.\$(OBJDIR)\xpctest_overloaded.obj \
.\$(OBJDIR)\xpctest_overloaded.obj \
.\$(OBJDIR)\xpctest_string.obj \
.\$(OBJDIR)\xpctest_module.obj \
.\$(OBJDIR)\xpctest_attributes.obj \
.\$(OBJDIR)\xpctest_in.obj \
.\$(OBJDIR)\xpctest_const.obj \
.\$(OBJDIR)\xpctest_out.obj \
.\$(OBJDIR)\xpctest_inout.obj \
.\$(OBJDIR)\xpctest_calljs.obj \
.\$(OBJDIR)\xpctest_multiple.obj\
$(NULL)
LINCS=-I$(PUBLIC)\xpconnect -I$(PUBLIC)\xpcom -I$(PUBLIC)\js \

Просмотреть файл

@ -0,0 +1,304 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "xpctest_attributes.h"
#include "nsISupports.h"
#include "xpctest_private.h"
#define NS_IXPCTESTOBJECTREADONLY_IID \
{0x1364941e, 0x4462, 0x11d3, \
{ 0x82, 0xee, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
class xpcTestObjectReadOnly : public nsIXPCTestObjectReadOnly {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTOBJECTREADONLY
xpcTestObjectReadOnly();
private:
PRBool boolProperty;
PRInt16 shortProperty;
PRInt32 longProperty;
float floatProperty;
char charProperty;
char *stringID;
};
static NS_DEFINE_IID(kxpcTestObjectReadOnlyIID, NS_IXPCTESTOBJECTREADONLY_IID);
NS_IMPL_ISUPPORTS(xpcTestObjectReadOnly, kxpcTestObjectReadOnlyIID);
xpcTestObjectReadOnly :: xpcTestObjectReadOnly() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
boolProperty = true;
shortProperty = 32767;
longProperty = 9223372036854776000;
charProperty = 'X';
const char _id[] = "a68cc6a6-6552-11d3-82ef-0060b0eb596f";
stringID = (char*) nsAllocator::Clone(_id, sizeof(char)*(strlen(_id)+1));
};
NS_IMETHODIMP xpcTestObjectReadOnly :: GetID(char **_retval) {
*_retval= (char*) nsAllocator::Clone(stringID,
sizeof(char)*(strlen(stringID)+1));
return *_retval? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP xpcTestObjectReadOnly :: GetStrReadOnly(char * *aStrReadOnly){
char aString[] = "XPConnect Read-Only String";
if(!aStrReadOnly)
return NS_ERROR_NULL_POINTER;
*aStrReadOnly = (char*) nsAllocator::Clone(aStrReadOnly,
sizeof(char)*(strlen(aString)+1));
return *aStrReadOnly ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP xpcTestObjectReadOnly :: GetBoolReadOnly(PRBool *aBoolReadOnly) {
*aBoolReadOnly = boolProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadOnly :: GetShortReadOnly(PRInt16 *aShortReadOnly){
*aShortReadOnly = shortProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadOnly :: GetLongReadOnly(PRInt32 *aLongReadOnly){
*aLongReadOnly = longProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadOnly :: GetFloatReadOnly(float *aFloatReadOnly){
*aFloatReadOnly = floatProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadOnly :: GetCharReadOnly(char *aCharReadOnly){
*aCharReadOnly = charProperty;
return NS_OK;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestObjectReadOnly(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestObjectReadOnly *obj = new xpcTestObjectReadOnly();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/****************************************************************************/
/* starting interface: nsIXPCTestObjectReadWrite */
/* {3b9b1d38-491a-11d3-82ef-0060b0eb596f} */
/*
#define NS_IXPCTESTOBJECTREADWRITE_IID_STR "3b9b1d38-491a-11d3-82ef-0060b0eb596f"
*/
#define NS_IXPCTESTOBJECTREADWRITE_IID \
{0x3b9b1d38, 0x491a, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
class xpcTestObjectReadWrite : public nsIXPCTestObjectReadWrite {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTOBJECTREADWRITE
xpcTestObjectReadWrite();
private:
PRBool boolProperty;
PRInt16 shortProperty;
PRInt32 longProperty;
float floatProperty;
char charProperty;
const char *stringProperty;
};
static NS_DEFINE_IID(kxpcTestObjectReadWriteIID, NS_IXPCTESTOBJECTREADWRITE_IID);
NS_IMPL_ISUPPORTS(xpcTestObjectReadWrite, kxpcTestObjectReadWriteIID);
xpcTestObjectReadWrite :: xpcTestObjectReadWrite() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
boolProperty = true;
shortProperty = 32767;
longProperty = 9223372036854776;
charProperty = 'X';
const char s[] = "XPConnect Read-Writable String";
stringProperty = (char*) nsAllocator::Clone(s,
sizeof(char)*(strlen(s)+1));
};
NS_IMETHODIMP xpcTestObjectReadWrite :: GetStringProperty(char * *aStringProperty) {
if(!aStringProperty)
return NS_ERROR_NULL_POINTER;
*aStringProperty = (char*) nsAllocator::Clone(stringProperty,
sizeof(char)*(strlen(stringProperty)+1));
return *aStringProperty ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: SetStringProperty(const char * aStringProperty) {
stringProperty = aStringProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: GetBooleanProperty(PRBool *aBooleanProperty) {
*aBooleanProperty = boolProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: SetBooleanProperty(PRBool aBooleanProperty) {
boolProperty = aBooleanProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: GetShortProperty(PRInt16 *aShortProperty) {
*aShortProperty = shortProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: SetShortProperty(PRInt16 aShortProperty) {
shortProperty = aShortProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: GetLongProperty(PRInt32 *aLongProperty) {
*aLongProperty = longProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: SetLongProperty(PRInt32 aLongProperty) {
longProperty = aLongProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: GetFloatProperty(float *aFloatProperty) {
*aFloatProperty = floatProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: SetFloatProperty(float aFloatProperty) {
floatProperty = aFloatProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: GetCharProperty(char *aCharProperty) {
*aCharProperty = charProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestObjectReadWrite :: SetCharProperty(char aCharProperty) {
charProperty = aCharProperty;
return NS_OK;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestObjectReadWrite(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestObjectReadWrite *obj = new xpcTestObjectReadWrite();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/****************************************************************************/
/*
class xpcTestAttributes : public nsIXPCTestObjectReadWrite,
public nsIXPCTestObjectReadOnly
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTOBJECTREADONLY
NS_DECL_NSIXPCTESTOBJECTREADWRITE
NS_IMETHOD GetName(char * *aString);
NS_IMETHOD SetName(char * aString );
private:
char *name;
};
static NS_DEFINE_IID(kxpcTestAttributesIID, NS_IXPCTESTATTRIBUTES_IID);
NS_IMPL_ISUPPORTS2(xpcTestAttributes, nsIXPCTestObjectReadWrite, nsIXPCTestObjectReadOnly);
NS_IMETHODIMP xpcTestAttributes ::GetName(char * *aString) {
if(!aString)
return NS_ERROR_NULL_POINTER;
*aString = (char*) nsAllocator::Clone(name,
sizeof(char)*(strlen(name)+1));
return *aString ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP xpcTestAttributes ::SetName(char * aString) {
name = aString;
return NS_OK;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestAttributes(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestAttributes *obj = new xpcTestAttributes();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
*/

Просмотреть файл

@ -0,0 +1,132 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "xpctest_private.h"
#include "nsIXPCScriptable.h"
#include "xpctest_calljs.h"
#include "nsISupports.h"
class xpcTestCallJS : public nsIXPCTestCallJS, public nsIXPCScriptable {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTCALLJS
XPC_DECLARE_IXPCSCRIPTABLE
xpcTestCallJS();
virtual ~xpcTestCallJS();
private:
nsIXPCTestCallJS* jsobject;
};
//static NS_DEFINE_IID( kxpcTestCallJSIID, NS_IXPCTESTCALLJS_IID );
//NS_IMPL_ISUPPORTS(xpcTestCallJS, kxpcTestCallJSIID);
// these methods are here since we can't call NS_IMPL_ISUPPORTS
NS_IMPL_ADDREF(xpcTestCallJS)
NS_IMPL_RELEASE(xpcTestCallJS)
// this macro is a simple way to expose nsIXPCScriptable implementation
NS_IMPL_QUERY_INTERFACE_SCRIPTABLE(xpcTestCallJS, NS_GET_IID(nsIXPCTestCallJS), this)
XPC_IMPLEMENT_FORWARD_IXPCSCRIPTABLE(xpcTestCallJS);
xpcTestCallJS :: xpcTestCallJS() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
xpcTestCallJS :: ~xpcTestCallJS() {
};
NS_IMETHODIMP xpcTestCallJS :: SetJSObject( nsIXPCTestCallJS* o ) {
//if (jsobject)
// NS_RELEASE( jsobject );
jsobject = o;
if ( jsobject )
NS_ADDREF( jsobject );
return NS_OK;
};
NS_IMETHODIMP xpcTestCallJS :: CallMethodNoArgs(PRBool *_retval) {
*_retval = PR_TRUE;
return NS_OK;
};
NS_IMETHODIMP xpcTestCallJS :: Evaluate ( const char *s ) {
if (jsobject)
return jsobject->Evaluate(s);
return NS_OK;
};
NS_IMETHODIMP
xpcTestCallJS :: EvaluateAndReturnError(nsresult in, nsresult *_retval){
if (jsobject) {
jsobject->EvaluateAndReturnError(in, _retval);
} else {
*_retval = in;
}
return *_retval;
};
NS_IMETHODIMP xpcTestCallJS :: EvaluateAndEatErrors(const char *s) {
if ( jsobject )
jsobject->Evaluate(s);
return NS_OK;
};
NS_IMETHODIMP xpcTestCallJS :: UnscriptableMethod() {
return NS_OK;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestCallJS(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestCallJS *obj = new xpcTestCallJS();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "nsISupports.h"
#include "xpctest_const.h"
#include "xpctest_private.h"
class xpcTestConst : public nsIXPCTestConst {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTCONST
xpcTestConst();
};
static NS_DEFINE_IID( kxpcTestConstIID, NS_IXPCTESTCONST_IID );
NS_IMPL_ISUPPORTS(xpcTestConst, kxpcTestConstIID);
xpcTestConst :: xpcTestConst() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP
xpctest::ConstructXPCTestConst(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestConst *obj = new xpcTestConst();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};

Просмотреть файл

@ -0,0 +1,200 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "xpctest_private.h"
#include "xpctest_in.h"
#include "nsISupports.h"
#define NS_IXPCTESTIN_IID \
{0x318d6f6a, 0x5411, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
class xpcTestIn : public nsIXPCTestIn {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTIN
xpcTestIn();
};
static NS_DEFINE_IID( kxpcTestInIID, NS_IXPCTESTIN_IID );
NS_IMPL_ISUPPORTS(xpcTestIn, kxpcTestInIID);
xpcTestIn :: xpcTestIn() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP xpcTestIn :: EchoLong(PRInt32 l, PRInt32 *_retval) {
*_retval = l;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoShort(PRInt16 a, PRInt16 *_retval) {
*_retval = a;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoChar(char c, char *_retval) {
*_retval = c;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoBoolean(PRBool b, PRBool *_retval) {
*_retval = b;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoOctet(PRUint8 o, PRUint8 *_retval) {
*_retval = o;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoLongLong(PRInt64 ll, PRInt64 *_retval) {
*_retval = ll;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoUnsignedShort(PRUint16 us, PRUint16 *_retval) {
*_retval = us;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoUnsignedLong(PRUint32 ul, PRUint32 *_retval) {
*_retval = ul;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoFloat(float f, float *_retval) {
*_retval = f;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoDouble(double d, double *_retval) {
*_retval = d;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoWchar(PRUnichar wc, PRUnichar *_retval) {
*_retval = wc;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoString(const PRUnichar *ws, char **_retval) {
/* const char s[] = *ws;
**_retval= (char*) nsAllocator::Clone(s,
sizeof(char)*(strlen(s)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
*/
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRBool(PRBool b, PRBool *_retval) {
*_retval = b;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRInt32(PRInt32 l, PRInt32 *_retval) {
*_retval = l;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRInt16(PRInt16 l, PRInt16 *_retval) {
*_retval = l;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRInt64(PRInt64 i, PRInt64 *_retval) {
*_retval = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRUint8(PRUint8 i, PRUint8 *_retval){
*_retval = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRUint16(PRUint16 i, PRUint16 *_retval){
*_retval = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRUint32(PRUint32 i, PRUint32 *_retval){
*_retval = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRUint64(PRUint64 i, PRUint64 *_retval) {
*_retval = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoVoidStar(void * vs, void * *_retval) {
*_retval = vs;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoCharStar(char * cs, char * *_retval) {
**_retval = *cs;
return NS_OK;
};
NS_IMETHODIMP xpcTestIn :: EchoPRUint32_2(PRUint32 i, PRUint32 *_retval){
*_retval = i;
return NS_OK;
};
/*
NS_IMETHODIMP xpcTestIn :: EchoNsIDRef(const nsID & r, nsID & *_retval) {
&*_retval = r;
};
NS_IMETHODIMP xpcTestIn :: EchoNsCIDRef(const nsCID & r, nsCID & *_retval) {
&*_retval = r;
};
NS_IMETHODIMP xpcTestIn :: EchoNsIDPtr(const nsID * p, nsID * *_retval) {
**_retval = p;
};
NS_IMETHODIMP xpcTestIn :: EchoNsIIDPtr(const nsIID * p, nsIID * *_retval) {
*_retval = p;
};
NS_IMETHODIMP xpcTestIn :: EchoNsCIDPtr(const nsCID * p, nsCID * *_retval) {
*_retval = p;
};
NS_IMETHODIMP xpcTestIn :: EchoNsQIResult(void * r, void * *_retval) {
**_retval = r;
};
*/
NS_IMETHODIMP xpcTestIn :: EchoVoid(void) {
return NS_OK;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestIn(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestIn *obj = new xpcTestIn();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};

Просмотреть файл

@ -0,0 +1,167 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "nsISupports.h"
#include "xpctest_inout.h"
#include "xpctest_private.h"
class xpcTestInOut : nsIXPCTestInOut {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTINOUT
xpcTestInOut();
};
static NS_DEFINE_IID( kxpcTestInOutIID, NS_IXPCTESTINOUT_IID );
NS_IMPL_ISUPPORTS(xpcTestInOut, kxpcTestInOutIID);
xpcTestInOut :: xpcTestInOut() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP xpcTestInOut :: EchoLong(PRInt32 li, PRInt32 *lo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoShort(PRInt16 si, PRInt16 *so){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoChar(char ci, char *co){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoBoolean(PRBool bi, PRBool *bo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoOctet(PRUint8 oi, PRUint8 *oo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoLongLong(PRInt64 lli, PRInt64 *llo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoUnsignedShort(PRUint16 usi, PRUint16 *uso){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoUnsignedLong(PRUint32 uli, PRUint32 *ulo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoFloat(float fi, float *fo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoDouble(double di, double *dout){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoWchar(PRUnichar wci, PRUnichar *wco){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoString(const PRUnichar *wsi, PRUnichar **wso){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRBool(PRBool bi, PRBool *bo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRInt32(PRInt32 li, PRInt32 *lo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRInt16(PRInt16 li, PRInt16 *lo){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRInt64(PRInt64 ii, PRInt64 *io){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRUint8(PRUint8 ii, PRUint8 *io){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRUint16(PRUint16 ii, PRUint16 *io){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRUint32(PRUint32 ii, PRUint32 *io){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRUint32_2(PRUint32 ii, PRUint32 *io){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoPRUint64(PRUint64 ii, PRUint64 *io){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoVoidStar(void * vsi, void * *vso){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoCharStar(char * csi, char * *cso){
return NS_OK;
};
/*
NS_IMETHODIMP xpcTestInOut :: EchoNsIDRef(const nsID & ri, nsID & *ro){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoNsCIDRef(const nsCID & ri, nsCID & *ro){
return NS_OK;
};
*/
NS_IMETHODIMP xpcTestInOut :: EchoNsIDPtr(const nsID * pi, nsID * *po){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoNsIIDPtr(const nsIID * pi, nsIID * *po){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoNsCIDPtr(const nsCID * pi, nsCID * *po){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoNsQIResult(void * ri, void * *ro){
return NS_OK;
};
NS_IMETHODIMP xpcTestInOut :: EchoVoid(void) {
return NS_OK;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestInOut(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestInOut *obj = new xpcTestInOut();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};

Просмотреть файл

@ -71,6 +71,39 @@ NSGetFactory(nsISupports* aServMgr,
rv = factory->SetConstructor(xpctest::ConstructStringTest);
else if(aClass.Equals(xpctest::GetOverloadedCID()))
rv = factory->SetConstructor(xpctest::ConstructOverloaded);
else if(aClass.Equals(xpctest::GetXPCTestObjectReadOnlyCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestObjectReadOnly);
else if(aClass.Equals(xpctest::GetXPCTestObjectReadWriteCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestObjectReadWrite);
else if(aClass.Equals(xpctest::GetXPCTestInCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestIn);
else if(aClass.Equals(xpctest::GetXPCTestOutCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestOut);
else if(aClass.Equals(xpctest::GetXPCTestInOutCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestInOut);
else if(aClass.Equals(xpctest::GetXPCTestCallJSCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestCallJS);
else if(aClass.Equals(xpctest::GetXPCTestConstCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestConst);
#if (0)
else if(aClass.Equals(xpctest::GetXPCTestConstructWithArgsCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestConstructWithArgs);
else if(aClass.Equals(xpctest::GetXPCTestScriptableCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestScriptable);
#endif /* 0 */
else if(aClass.Equals(xpctest::GetXPCTestParentOneCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestParentOne);
else if(aClass.Equals(xpctest::GetXPCTestParentTwoCID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestParentTwo);
else if(aClass.Equals(xpctest::GetXPCTestChild2CID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestChild2);
else if(aClass.Equals(xpctest::GetXPCTestChild3CID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestChild3);
else if(aClass.Equals(xpctest::GetXPCTestChild4CID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestChild4);
else if(aClass.Equals(xpctest::GetXPCTestChild5CID()))
rv = factory->SetConstructor(xpctest::ConstructXPCTestChild5);
else if(aClass.Equals(xpctest::GetArrayTestCID()))
rv = factory->SetConstructor(xpctest::ConstructArrayTest);
else
@ -117,12 +150,65 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
rv = compMgr->RegisterComponent(xpctest::GetOverloadedCID(),
"nsOverloaded", "nsOverloaded", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestObjectReadOnlyCID(),
"xpcTestObjectReadOnly", "xpcTestObjectReadOnly", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetArrayTestCID(),
"nsArrayTest", "nsArrayTest", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestObjectReadWriteCID(),
"xpcTestObjectReadWrite", "xpcTestObjectReadWrite", aPath,
PR_TRUE, PR_TRUE);
return rv;
rv = compMgr->RegisterComponent(xpctest::GetXPCTestInCID(),
"xpcTestIn", "xpcTestIn", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestOutCID(),
"xpcTestOut", "xpcTestOut", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestInOutCID(),
"xpcTestOut", "xpcTestInOut", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestConstCID(),
"xpcTestConst", "xpcTestConst", aPath,
PR_TRUE, PR_TRUE);
#if 0
rv = compMgr->RegisterComponent(xpctest::GetXPCTestConstructWithArgsCID(),
"xpcTestConstructArgs", "xpcTestConstructArgs", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestScriptableCID(),
"xpcTestScriptable", "xpcTestScriptable", aPath,
PR_TRUE, PR_TRUE);
#endif /* 0 */
rv = compMgr->RegisterComponent(xpctest::GetXPCTestCallJSCID(),
"xpcTestCallJS", "xpcTestCallJS", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestParentOneCID(),
"xpcTestParentOne", "xpcTestParentOne", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestParentTwoCID(),
"xpcTestParentTwo", "xpcTestParentTwo", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestChild2CID(),
"xpcTestChild2", "xpcTestChild2", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestChild3CID(),
"xpcTestChild3", "xpcTestChild3", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestChild4CID(),
"xpcTestChild4", "xpcTestChild4", aPath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(xpctest::GetXPCTestChild5CID(),
"xpcTestChild5", "xpcTestChild5", aPath,
PR_TRUE, PR_TRUE);
return rv;
}
extern "C" PR_IMPLEMENT(nsresult)
@ -138,8 +224,24 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
rv = compMgr->UnregisterComponent(xpctest::GetNoisyCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetStringTestCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetOverloadedCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestObjectReadWriteCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestObjectReadOnlyCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestInCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestOutCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestInOutCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestConstCID(), aPath);
/*
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestConstructWithArgsCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestScriptableCID(), aPath);
*/
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestCallJSCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestParentOneCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestParentTwoCID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestChild2CID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestChild3CID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestChild4CID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetXPCTestChild5CID(), aPath);
rv = compMgr->UnregisterComponent(xpctest::GetArrayTestCID(), aPath);
return rv;
}

Просмотреть файл

@ -0,0 +1,555 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "xpctest_multiple.h"
#include "nsISupports.h"
#include "xpctest_private.h"
class xpcTestParentOne : public nsIXPCTestParentOne {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTPARENTONE
xpcTestParentOne();
private:
const char *name;
};
static NS_DEFINE_IID(kxpcTestParentOneIID, NS_IXPCTESTPARENTONE_IID);
NS_IMPL_ISUPPORTS(xpcTestParentOne, kxpcTestParentOneIID);
xpcTestParentOne :: xpcTestParentOne()
{
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP xpcTestParentOne :: GetParentOneAttribute(char * *_retval)
{
char aString[] = "xpcTestParentOne attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP xpcTestParentOne :: SetParentOneAttribute(const char * aParentOneAttribute)
{
name = aParentOneAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestParentOne :: ParentOneMethod(char * *_retval)
{
char aString[] = "xpcTestParentOne method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestParentOne(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestParentOne *obj = new xpcTestParentOne();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/*****************************************************************************/
class xpcTestParentTwo : public nsIXPCTestParentTwo {
public:
NS_DECL_NSIXPCTESTPARENTTWO
NS_DECL_ISUPPORTS
xpcTestParentTwo();
private:
const char *name;
};
static NS_DEFINE_IID(kxpcTestParentTwoIID, NS_IXPCTESTPARENTTWO_IID);
NS_IMPL_ISUPPORTS(xpcTestParentTwo, kxpcTestParentTwoIID);
xpcTestParentTwo :: xpcTestParentTwo()
{
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP
xpcTestParentTwo :: GetParentTwoAttribute(char * *_retval)
{
char aString[] = "xpcTestParentTwo attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestParentTwo :: SetParentTwoAttribute(const char * aParentTwoAttribute)
{
name = aParentTwoAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestParentTwo :: ParentTwoMethod(char **_retval)
{
char aString[] = "xpcTestParentTwo method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestParentTwo(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestParentTwo *obj = new xpcTestParentTwo();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/*****************************************************************************/
/**
* nsIXPCTestChild2 inherits from nsISupports
*/
class xpcTestChild2 : public nsIXPCTestChild2, nsIXPCTestParentOne, nsIXPCTestParentTwo {
public:
NS_DECL_NSIXPCTESTCHILD2
NS_DECL_NSIXPCTESTPARENTONE
NS_DECL_NSIXPCTESTPARENTTWO
NS_DECL_ISUPPORTS
xpcTestChild2();
private:
const char *name;
};
NS_IMPL_ISUPPORTS3(xpcTestChild2,nsIXPCTestChild2,nsIXPCTestParentOne,nsIXPCTestParentTwo);
xpcTestChild2 :: xpcTestChild2()
{
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP
xpcTestChild2:: GetChildAttribute(char * *_retval)
{
char aString[] = "xpcTestChild2 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild2:: SetChildAttribute(const char * aChildAttribute)
{
name = aChildAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild2 ::ChildMethod(char **_retval)
{
char aString[] = "xpcTestChild2 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild2 :: GetParentOneAttribute(char * *_retval)
{
char aString[] = "xpcTestChild2 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild2:: SetParentOneAttribute(const char * aParentOneAttribute)
{
name = aParentOneAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild2 :: ParentOneMethod(char * *_retval)
{
char aString[] = "xpcTestChild2 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild2 :: GetParentTwoAttribute(char * *_retval)
{
char aString[] = "xpcTestChild2 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild2 :: SetParentTwoAttribute(const char * aParentTwoAttribute)
{
name = aParentTwoAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild2 :: ParentTwoMethod(char **_retval) {
char aString[] = "xpcTestChild2 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestChild2(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestChild2 *obj = new xpcTestChild2();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/*****************************************************************************/
/**
* xpcTestChild3 inherits from nsIXPCTestChild3, which inherits from
* nsIXPCTestParentOne
*/
class xpcTestChild3 : public nsIXPCTestChild3 {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTCHILD3
NS_DECL_NSIXPCTESTPARENTONE
xpcTestChild3();
private:
const char *name;
};
NS_IMPL_ISUPPORTS2(xpcTestChild3,nsIXPCTestChild3,nsIXPCTestParentOne);
xpcTestChild3 :: xpcTestChild3()
{
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP
xpcTestChild3:: GetChildAttribute(char * *_retval)
{
char aString[] = "xpcTestChild3 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild3 :: SetChildAttribute(const char * aChildAttribute)
{
name = aChildAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild3 ::ChildMethod(char **_retval)
{
const char aString[] = "xpcTestChild3 method";
*_retval = (char*) nsAllocator::Clone((const char *)aString,
sizeof(char)*(strlen((const char *)aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild3 :: GetParentOneAttribute(char * *_retval)
{
const char aString[] = "xpcTestChild3 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild3:: SetParentOneAttribute(const char * aParentOneAttribute)
{
name = aParentOneAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild3 :: ParentOneMethod(char * *_retval)
{
char aString[] = "xpcTestChild3 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestChild3(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestChild3 *obj = new xpcTestChild3();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/*****************************************************************************/
/**
* xpcTestChild4 - class which inherits from nsIXPCTestChild4 (which inherits
* directly from nsISupports) and two classes.
*/
class xpcTestChild4 : public nsIXPCTestChild4, xpcTestParentOne, xpcTestParentTwo {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTCHILD4
xpcTestChild4();
private:
const char *name;
};
NS_IMPL_ISUPPORTS3(xpcTestChild4,nsIXPCTestChild4,nsIXPCTestParentOne,nsIXPCTestParentTwo);
xpcTestChild4 :: xpcTestChild4()
{
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP
xpcTestChild4:: GetChildAttribute(char * *_retval)
{
char aString[] = "xpcTestChild4 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild4:: SetChildAttribute(const char * aChildAttribute)
{
name = aChildAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild4 ::ChildMethod(char **_retval)
{
char aString[] = "xpcTestChild4 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestChild4(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestChild4 *obj = new xpcTestChild4();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};
/*****************************************************************************/
/**
* xpcTestChild5 - class which inherits from nsIXPCTestChild5 (which inherits
* from nsIXPCTestParentOne) and the class xpcTestParentTwo
*/
class xpcTestChild5 : public nsIXPCTestChild5, xpcTestParentTwo {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTCHILD5
NS_DECL_NSIXPCTESTPARENTONE
xpcTestChild5();
private:
const char *name;
};
NS_IMPL_ISUPPORTS3(xpcTestChild5,nsIXPCTestChild5,nsIXPCTestParentOne,nsIXPCTestParentTwo);
xpcTestChild5 :: xpcTestChild5()
{
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP
xpcTestChild5:: GetChildAttribute(char * *_retval)
{
char aString[] = "xpcTestChild5 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild5:: SetChildAttribute(const char * aChildAttribute)
{
name = aChildAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild5 ::ChildMethod(char **_retval)
{
char aString[] = "xpcTestChild5 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild5 :: GetParentOneAttribute(char * *_retval)
{
char aString[] = "xpcTestChild5 attribute";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpcTestChild5:: SetParentOneAttribute(const char * aParentOneAttribute)
{
name = aParentOneAttribute;
return NS_OK;
};
NS_IMETHODIMP
xpcTestChild5 :: ParentOneMethod(char * *_retval)
{
char aString[] = "xpcTestChild5 method";
*_retval = (char*) nsAllocator::Clone(aString,
sizeof(char)*(strlen(aString)+1));
return **_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
};
NS_IMETHODIMP
xpctest::ConstructXPCTestChild5(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestChild5 *obj = new xpcTestChild5();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};

Просмотреть файл

@ -0,0 +1,331 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
#include "xpctest_private.h"
#include "xpctest_out.h"
#include "nsISupports.h"
#define NS_IXPCTESTOUT_IID \
{0x4105ae88, 0x5599, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
class xpcTestOut : public nsIXPCTestOut {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXPCTESTOUT
xpcTestOut();
private:
PRInt32 longProperty;
PRInt16 shortProperty;
char charProperty;
float floatProperty;
double doubleProperty;
PRUnichar * stringProperty;
PRBool booleanProperty;
PRUint8 octetProperty;
PRUint16 unsignedShortProperty;
PRUint32 unsignedLongProperty;
PRInt64 longLongProperty;
PRUnichar wcharProperty;
// PRUnichar *wsStringProperty;
PRBool PRBoolProperty;
PRInt32 PRInt32Property;
PRInt16 PRInt16Property;
PRInt64 PRInt64Property;
PRUint8 PRUint8Property;
PRUint16 PRUint16Property;
PRUint32 PRUint32Property;
PRUint64 PRUint64Property;
};
static NS_DEFINE_IID( kxpcTestOutIID, NS_IXPCTESTOUT_IID );
NS_IMPL_ISUPPORTS(xpcTestOut, kxpcTestOutIID);
xpcTestOut :: xpcTestOut() {
NS_INIT_REFCNT();
NS_ADDREF_THIS();
};
NS_IMETHODIMP xpcTestOut :: GetLong(PRInt32 *l){
*l = longProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetLong(PRInt32 l){
longProperty = l;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetShort(PRInt16 *s){
*s = shortProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetShort(PRInt16 s){
shortProperty = s;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetChar(char c){
charProperty = c;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetChar(char *c){
*c = charProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetBoolean(PRBool *b){
*b = booleanProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetBoolean(PRBool b){
booleanProperty = b;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetOctet(PRUint8 *o){
*o = octetProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetOctet(PRUint8 o){
octetProperty = o;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetLongLong(PRInt64 ll){
ll = longProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetLongLong(PRInt64 ll){
longProperty = ll;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetUnsignedShort(PRUint16 *us){
*us = unsignedShortProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetUnsignedShort(PRUint16 us){
unsignedShortProperty = us;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetUnsignedLong(PRUint32 *ul){
*ul = unsignedLongProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetUnsignedLong(PRUint32 ul){
unsignedLongProperty = ul;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetFloat(float *f){
*f = floatProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetFloat(float f){
floatProperty = f;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetDouble(double *d){
*d = doubleProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetDouble(double d){
doubleProperty = d;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetWchar(PRUnichar *wc){
*wc = wcharProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetWchar(PRUnichar wc){
wcharProperty = wc;
return NS_OK;
};
/*
NS_IMETHODIMP xpcTestOut :: GetString(PRUnichar **ws){
**ws = *stringProperty;
if(!stringProperty)
return NS_ERROR_NULL_POINTER;
*ws = (PRUnichar *) nsAllocator::Clone(stringProperty,
sizeof(char) *(strlen(stringProperty)+1));
return **ws? NS_OK : NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetString(const PRUnichar *ws){
//stringProperty = ws;
return NS_OK;
};
*/
NS_IMETHODIMP xpcTestOut :: GetPRBool(PRBool *b){
*b = PRBoolProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRBool(PRBool b){
PRBoolProperty = b;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRInt32(PRInt32 *l){
*l = PRInt32Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRInt32(PRInt32 l){
PRInt32Property = l;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRInt16(PRInt16 *l){
*l = PRInt16Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRInt16(PRInt16 l){
PRInt16Property = l;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRInt64(PRInt64 *i){
*i = PRInt64Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRInt64(PRInt64 i){
PRInt64Property = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRUint8(PRUint8 *i){
*i = PRUint8Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRUint8(PRUint8 i){
PRUint8Property = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRUint16(PRUint16 *i){
*i = PRUint16Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRUint16(PRUint16 i){
PRUint16Property = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRUint32(PRUint32 *i){
*i = PRUint32Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRUint32(PRUint32 i){
PRUint32Property = i;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetPRUint64(PRUint64 *i){
*i = PRUint64Property;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetPRUint64(PRUint64 i){
PRUint64Property = i;
return NS_OK;
};
/*
NS_IMETHODIMP xpcTestOut :: GetVoidStar(void * *vs){
**vs = voidStarProperty;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetVoidStar(void * vs){
voidStarProperty = vs;
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetCharStar(char * *cs){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetCharStar(char * cs){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetNsIDRef(nsID & *r){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetNsIDRef(const nsID & r){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetNsCIDRef(nsCID & *r){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetNsCIDRef(const nsCID & r){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetNsIDPtr(nsID * *p){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetNsIDPtr(const nsID * p){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetNsIIDPtr(nsIID * *p){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetNsIIDPtr(const nsIID * p){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetNsCIDPtr(nsCID * *p){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetNsCIDPtr(const nsCID * p){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetNsQIResult(void * *r){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetNsQIResult(void * r){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: GetVoid(void){
return NS_OK;
};
NS_IMETHODIMP xpcTestOut :: SetVoid(void){
return NS_OK;
};
*/
NS_IMETHODIMP
xpctest::ConstructXPCTestOut(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
xpcTestOut *obj = new xpcTestOut();
if(obj)
{
rv = obj->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(obj);
}
else
{
*aResult = nsnull;
rv = NS_ERROR_OUT_OF_MEMORY;
}
return rv;
};

Просмотреть файл

@ -76,12 +76,67 @@
{ 0xdc5fde90, 0x439d, 0x11d3, \
{ 0x98, 0x8c, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } }
#define NS_XPCTESTOBJECTREADONLY_CID \
{0x1364941e, 0x4462, 0x11d3, \
{ 0x82, 0xee, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTOBJECTREADWRITE_CID \
{0x3b9b1d38, 0x491a, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTIN_CID \
{0x318d6f6a, 0x5411, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTOUT_CID \
{0x4105ae88, 0x5599, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTCONST_CID \
{0x83f57a56, 0x4f55, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTCALLJS_CID \
{0x38ba7d98, 0x5a54, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTSCRIPTABLE_CID \
{0x9ede3336, 0x5fee, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTPARENTONE_CID \
{0x5408fdcc, 0x60a3, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTPARENTTWO_CID \
{0x63137392, 0x60a3, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTCHILD2_CID \
{0x66bed216, 0x60a3, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTCHILD3_CID \
{0x62353978, 0x614e, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTCHILD4_CID \
{0xa6d22202, 0x622b, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#define NS_XPCTESTCHILD5_CID \
{0xba3eef4e, 0x6250, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#if 0
#define NS_XPCTESTCONSTRUCTWITHARGS_CID \
{0xbd39c75c, 0x6a05, 0x11d3, \
{ 0x82, 0xef, 0x00, 0x60, 0xb0, 0xeb, 0x59, 0x6f }}
#endif /* 0 */
// {5B9AF380-6569-11d3-989E-006008962422}
#define NS_ARRAY_CID \
{ 0x5b9af380, 0x6569, 0x11d3, \
{ 0x98, 0x9e, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } };
// 'namespace' class
class xpctest
{
@ -101,6 +156,51 @@ public:
static const nsID& GetOverloadedCID() {static nsID cid = NS_OVERLOADED_CID; return cid;}
static NS_METHOD ConstructOverloaded(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestObjectReadOnlyCID() {static nsID cid = NS_XPCTESTOBJECTREADONLY_CID; return cid;}
static NS_METHOD ConstructXPCTestObjectReadOnly(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestObjectReadWriteCID() {static nsID cid = NS_XPCTESTOBJECTREADWRITE_CID; return cid;}
static NS_METHOD ConstructXPCTestObjectReadWrite(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestInCID() { static nsID cid = NS_XPCTESTIN_CID; return cid; }
static NS_METHOD ConstructXPCTestIn(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestOutCID() { static nsID cid = NS_XPCTESTOUT_CID; return cid; }
static NS_METHOD ConstructXPCTestOut(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestInOutCID() { static nsID cid = NS_XPCTESTOUT_CID; return cid; }
static NS_METHOD ConstructXPCTestInOut(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestConstCID() { static nsID cid = NS_XPCTESTCONST_CID; return cid; }
static NS_METHOD ConstructXPCTestConst(nsISupports *aOuter, REFNSIID aIID, void **aResult);
#if 0
static const nsID& GetXPCTestConstructWithArgsCID() { static nsID cid = NS_XPCTESTCONSTRUCTWITHARGS_CID; return cid; }
static NS_METHOD ConstructXPCTestConstructWithArgs(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestScriptableCID() { static nsID cid = NS_XPCTESTSCRIPTABLE_CID; return cid; }
static NS_METHOD ConstructXPCTestScriptable(nsISupports *aOuter, REFNSIID aIID, void **aResult);
#endif /* 0 */
static const nsID& GetXPCTestCallJSCID() { static nsID cid = NS_XPCTESTCALLJS_CID; return cid; }
static NS_METHOD ConstructXPCTestCallJS(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestParentOneCID() { static nsID cid = NS_XPCTESTPARENTONE_CID; return cid; }
static NS_METHOD ConstructXPCTestParentOne(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestParentTwoCID() { static nsID cid = NS_XPCTESTPARENTTWO_CID; return cid; }
static NS_METHOD ConstructXPCTestParentTwo(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestChild2CID() { static nsID cid = NS_XPCTESTCHILD2_CID; return cid; }
static NS_METHOD ConstructXPCTestChild2(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestChild3CID() { static nsID cid = NS_XPCTESTCHILD3_CID; return cid; }
static NS_METHOD ConstructXPCTestChild3(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestChild4CID() { static nsID cid = NS_XPCTESTCHILD4_CID; return cid; }
static NS_METHOD ConstructXPCTestChild4(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetXPCTestChild5CID() { static nsID cid = NS_XPCTESTCHILD5_CID; return cid; }
static NS_METHOD ConstructXPCTestChild5(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static const nsID& GetArrayTestCID() {static nsID cid = NS_ARRAY_CID; return cid;}
static NS_METHOD ConstructArrayTest(nsISupports *aOuter, REFNSIID aIID, void **aResult);