RetroZilla/extensions/python/xpcom/test/test_component/py_test_component.idl
2015-10-20 23:03:22 -04:00

231 lines
14 KiB
Plaintext

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Python XPCOM language bindings.
*
* The Initial Developer of the Original Code is
* ActiveState Tool Corp.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Hammond <MarkH@ActiveState.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: This is a TEST interface, not a DEMO interface :-)
// We try to get as many data-types etc exposed, meaning this
// doesnt really make a good demo of a "simple component"
#include "nsISupports.idl"
#include "nsIVariant.idl"
[scriptable, uuid(1ECAED4F-E4D5-4ee7-ABF0-7D72AE1441D7)]
interface nsIPythonTestInterface : nsISupports
{
// Some constants for us to test - one for every type supported by xpidl
const short One = 1;
const long Two = 2;
const long MinusOne = -1;
const long BigLong = 0x7FFFFFFF;
const long BiggerLong = 0xFFFFFFFF;
const unsigned long BigULong = 0xFFFFFFFF;
// Declare every type supported as an attribute.
attribute boolean boolean_value; // PRBool
attribute octet octet_value; // PRUint8
attribute short short_value; // PRInt16
attribute unsigned short ushort_value; // PRUint16
attribute long long_value; // PRInt32
attribute unsigned long ulong_value; // PRUint32
attribute long long long_long_value; // PRInt64
attribute unsigned long long ulong_long_value; // PRUint64
attribute float float_value; // float
attribute double double_value; // double
attribute char char_value; // char
attribute wchar wchar_value; // PRUnichar
attribute string string_value; // char *
attribute wstring wstring_value; // PRUnichar*
attribute AString astring_value; // nsAString &
attribute ACString acstring_value; // nsACString &
attribute AUTF8String utf8string_value; // nsAUTF8String &
attribute nsIIDRef iid_value; // an IID
attribute nsIPythonTestInterface interface_value; // A specific interface
attribute nsISupports isupports_value; // A generic interface
// Declare every type supported as a method with an "in", "in/out" and "out" params
boolean do_boolean(in boolean p1, inout boolean p2, out boolean p3);
octet do_octet(in octet p1, inout octet p2, out octet p3);
short do_short(in short p1, inout short p2, out short p3);
unsigned short do_unsigned_short(in unsigned short p1, inout unsigned short p2, out unsigned short p3);
long do_long(in long p1, inout long p2, out long p3);
unsigned long do_unsigned_long(in unsigned long p1, inout unsigned long p2, out unsigned long p3);
long long do_long_long(in long long p1, inout long long p2, out long long p3);
unsigned long long do_unsigned_long_long(in unsigned long long p1, inout unsigned long long p2, out unsigned long long p3);
float do_float(in float p1, inout float p2, out float p3);
double do_double(in double p1, inout double p2, out double p3);
char do_char(in char p1, inout char p2, out char p3);
wchar do_wchar(in wchar p1, inout wchar p2, out wchar p3);
string do_string(in string p1, inout string p2, out string p3);
wstring do_wstring(in wstring p1, inout wstring p2, out wstring p3);
nsIIDRef do_nsIIDRef(in nsIIDRef p1, inout nsIIDRef p2, out nsIIDRef p3);
nsIPythonTestInterface do_nsIPythonTestInterface(in nsIPythonTestInterface p1, inout nsIPythonTestInterface p2, out nsIPythonTestInterface p3);
nsISupports do_nsISupports(in nsISupports p1, inout nsISupports p2, out nsISupports p3);
void do_nsISupportsIs(in nsIIDRef iid, [iid_is(iid),retval] out nsQIResult result);
// Do I really need these??
// void do_nsISupportsIs2(inout nsIIDRef iid, [iid_is(iid)] inout nsQIResult result);
// void do_nsISupportsIs3(out nsIIDRef iid, [iid_is(iid)] inout nsQIResult result);
// void do_nsISupportsIs4(out nsIIDRef iid, [iid_is(iid)] out nsQIResult result);
};
// Another interface - we use another interface purely for testing purposes -
// We ensure that the entire interface hierarcy is available correctly.
[scriptable, uuid(B38D1538-FE92-42c3-831F-285242EDEEA4)]
interface nsIPythonTestInterfaceExtra : nsIPythonTestInterface
{
// These were copied from the XPCOM test 'xpctest.idl'
// (and a few extras added)
void MultiplyEachItemInIntegerArray(
in PRInt32 val,
in PRUint32 count,
[array, size_is(count)] inout PRInt32 valueArray);
void MultiplyEachItemInIntegerArrayAndAppend(
in PRInt32 val,
inout PRUint32 count,
[array, size_is(count)] inout PRInt32 valueArray);
// Note that this method shares a single "size_is" between 2 params!
void CompareStringArrays([array, size_is(count)] in string arr1,
[array, size_is(count)] in string arr2,
in unsigned long count,
[retval] out short result);
void DoubleStringArray(inout PRUint32 count,
[array, size_is(count)] inout string valueArray);
void ReverseStringArray(in PRUint32 count,
[array, size_is(count)] inout string valueArray);
// One count, one inout array.
void DoubleString(inout PRUint32 count,
[size_is(count)] inout string str);
// One in count and in array, plus out count and out array
void DoubleString2(in PRUint32 in_count, [size_is(in_count)] in string in_str,
out PRUint32 out_count, [size_is(out_count)] out string out_str);
// As per DoubleString2, but out string also marked retval
void DoubleString3(in PRUint32 in_count, [size_is(in_count)] in string in_str,
out PRUint32 out_count, [size_is(out_count), retval] out string out_str);
// One in array, one out array, one share inout count.
void DoubleString4([size_is(count)] in string in_str, inout PRUint32 count, [size_is(count)] out string out_str);
// UpString defines the count as only "in" - meaning the result must be the same size
void UpString(in PRUint32 count,
[size_is(count)] inout string str);
// UpString2 defines count as only "in", and a string as only "out"
void UpString2(in PRUint32 count,
[size_is(count)] in string in_str,
[size_is(count)]out string out_str);
void CopyUTF8String(in AUTF8String in_str, out AUTF8String out_str);
void CopyUTF8String2(in AUTF8String in_str, out AUTF8String out_str);
// Test we can get an "out" array with an "in" size (and the size is not used anywhere as a size for an in!)
void GetFixedString(in PRUint32 count, [size_is(count)]out string out_str);
void DoubleWideString(inout PRUint32 count,
[size_is(count)] inout wstring str);
void DoubleWideString2(in PRUint32 in_count, [size_is(in_count)] in wstring in_str,
out PRUint32 out_count, [size_is(out_count)] out wstring out_str);
void DoubleWideString3(in PRUint32 in_count, [size_is(in_count)] in wstring in_str,
out PRUint32 out_count, [size_is(out_count), retval] out wstring out_str);
void DoubleWideString4([size_is(count)] in wstring in_str, inout PRUint32 count, [size_is(count)] out wstring out_str);
// UpWideString defines the count as only "in" - meaning the result must be the same size
void UpWideString(in PRUint32 count,
[size_is(count)] inout wstring str);
// UpWideString2 defines count as only "in", and a string as only "out"
void UpWideString2(in PRUint32 count,
[size_is(count)] in wstring in_str,
[size_is(count)]out wstring out_str);
// Test we can get an "out" array with an "in" size (and the size is not used anywhere as a size for an in!)
void GetFixedWideString(in PRUint32 count, [size_is(count)]out string out_str);
void GetStrings(out PRUint32 count,
[retval, array, size_is(count)] out string str);
void UpOctetArray(inout PRUint32 count,
[array, size_is(count)] inout PRUint8 data);
void UpOctetArray2(inout PRUint32 count,
[array, size_is(count)] inout PRUint8 data);
// Arrays of interfaces
void CheckInterfaceArray(in PRUint32 count,
[array, size_is(count)] in nsISupports data,
[retval] out PRBool all_non_null);
void CopyInterfaceArray(in PRUint32 count,
[array, size_is(count)] in nsISupports data,
[array, size_is(out_count)] out nsISupports out_data,
out PRUint32 out_count);
void GetInterfaceArray(out PRUint32 count,
[array, size_is(count)] out nsISupports data);
void ExtendInterfaceArray(inout PRUint32 count,
[array, size_is(count)] inout nsISupports data);
// Arrays of IIDs
void CheckIIDArray(in PRUint32 count,
[array, size_is(count)] in nsIIDRef data,
[retval] out PRBool all_mine);
void GetIIDArray(out PRUint32 count,
[array, size_is(count)] out nsIIDRef data);
void ExtendIIDArray(inout PRUint32 count,
[array, size_is(count)] inout nsIIDRef data);
// More specific tests.
// Test our count param can be shared as an "in" param.
void SumArrays(in PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]in PRInt32 array2, [retval]out PRInt32 result);
// Test our count param can be shared as an "out" param.
void GetArrays(out PRUint32 count, [array, size_is(count)]out PRInt32 array1, [array, size_is(count)]out PRInt32 array2);
// Test we can get an "out" array with an "in" size (and the size is not used anywhere as a size for an in!)
void GetFixedArray(in PRUint32 count, [array, size_is(count)]out PRInt32 array1);
// Test our "in" count param can be shared as one "in", plus one "out" param.
void CopyArray(in PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]out PRInt32 array2);
// Test our "in-out" count param can be shared as one "in", plus one "out" param.
void CopyAndDoubleArray(inout PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]out PRInt32 array2);
// Test our "in-out" count param can be shared as one "in", plus one "in-out" param.
void AppendArray(inout PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]inout PRInt32 array2);
void AppendVariant(in nsIVariant variant, inout nsIVariant result);
nsIVariant CopyVariant(in nsIVariant variant);
};
// DOM String support is a "recent" (01/2001) addition to XPCOM. These test
// have their own interface for no real good reason ;-)
[scriptable, uuid(657ae651-a973-4818-8c06-f4b948b3d758)]
interface nsIPythonTestInterfaceDOMStrings : nsIPythonTestInterfaceExtra
{
DOMString GetDOMStringResult(in PRInt32 length);
void GetDOMStringOut(in PRInt32 length, [retval] out DOMString s);
PRUint32 GetDOMStringLength(in DOMString s);
PRUint32 GetDOMStringRefLength(in DOMStringRef s);
PRUint32 GetDOMStringPtrLength(in DOMStringPtr s);
void ConcatDOMStrings(in DOMString s1, in DOMString s2, out DOMString ret);
attribute DOMString domstring_value;
readonly attribute DOMString domstring_value_ro;
};