Back to index

lightning-sunbird  0.9+nobinonly
py_test_component.idl
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Python XPCOM language bindings.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * ActiveState Tool Corp.
00018  * Portions created by the Initial Developer are Copyright (C) 2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Mark Hammond <MarkH@ActiveState.com> (original author)
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 // NOTE: This is a TEST interface, not a DEMO interface :-)
00039 // We try to get as many data-types etc exposed, meaning this
00040 // doesnt really make a good demo of a "simple component"
00041 #include "nsISupports.idl"
00042 #include "nsIVariant.idl"
00043 
00044 [scriptable, uuid(1ECAED4F-E4D5-4ee7-ABF0-7D72AE1441D7)]
00045 interface nsIPythonTestInterface : nsISupports
00046 {
00047     // Some constants for us to test - one for every type supported by xpidl
00048     const short                 One = 1;
00049     const long                  Two = 2;
00050     const long                  MinusOne = -1;
00051     const long                  BigLong = 0x7FFFFFFF;
00052     const long                  BiggerLong = 0xFFFFFFFF;
00053     const unsigned long         BigULong = 0xFFFFFFFF;
00054 
00055     // Declare every type supported as an attribute.
00056     attribute boolean                   boolean_value; // PRBool
00057     attribute octet                     octet_value; // PRUint8
00058     attribute short                     short_value; // PRInt16
00059     attribute unsigned short            ushort_value; //  PRUint16 
00060     attribute long                      long_value; // PRInt32 
00061     attribute unsigned long             ulong_value; // PRUint32 
00062     attribute long long                 long_long_value; // PRInt64 
00063     attribute unsigned long long        ulong_long_value; // PRUint64
00064     attribute float                     float_value; // float
00065     attribute double                    double_value; // double
00066     attribute char                      char_value; // char
00067     attribute wchar                     wchar_value; // PRUnichar 
00068     attribute string                    string_value; // char *
00069     attribute wstring                   wstring_value; // PRUnichar* 
00070     attribute AString                   astring_value; // nsAString & 
00071     attribute ACString                  acstring_value; // nsACString & 
00072     attribute AUTF8String               utf8string_value; // nsAUTF8String & 
00073     attribute nsIIDRef                  iid_value; // an IID
00074     attribute nsIPythonTestInterface    interface_value; // A specific interface
00075     attribute nsISupports               isupports_value; // A generic interface
00076 
00077     // Declare every type supported as a method with an "in", "in/out" and "out" params
00078     boolean                  do_boolean(in boolean p1, inout boolean p2, out boolean p3);
00079     octet                    do_octet(in octet p1, inout octet p2, out octet p3);
00080     short                    do_short(in short p1, inout short p2, out short p3);
00081     unsigned short           do_unsigned_short(in unsigned short p1, inout unsigned short p2, out unsigned short p3);
00082     long                     do_long(in long p1, inout long p2, out long p3);
00083     unsigned long            do_unsigned_long(in unsigned long p1, inout unsigned long p2, out unsigned long p3);
00084     long long                do_long_long(in long long p1, inout long long p2, out long long p3);
00085     unsigned long long       do_unsigned_long_long(in unsigned long long p1, inout unsigned long long p2, out unsigned long long p3);
00086     float                    do_float(in float p1, inout float p2, out float p3);
00087     double                   do_double(in double p1, inout double p2, out double p3);
00088     char                     do_char(in char p1, inout char p2, out char p3);
00089     wchar                    do_wchar(in wchar p1, inout wchar p2, out wchar p3);
00090     string                   do_string(in string p1, inout string p2, out string p3);
00091     wstring                  do_wstring(in wstring p1, inout wstring p2, out wstring p3);
00092     nsIIDRef                 do_nsIIDRef(in nsIIDRef p1, inout nsIIDRef p2, out nsIIDRef p3);
00093     nsIPythonTestInterface   do_nsIPythonTestInterface(in nsIPythonTestInterface p1, inout nsIPythonTestInterface p2, out nsIPythonTestInterface p3);
00094     nsISupports              do_nsISupports(in nsISupports p1, inout nsISupports p2, out nsISupports p3);
00095     void                     do_nsISupportsIs(in nsIIDRef iid, [iid_is(iid),retval] out nsQIResult result);
00096 // Do I really need these??
00097 //    void                     do_nsISupportsIs2(inout nsIIDRef iid, [iid_is(iid)] inout nsQIResult result);
00098 //    void                     do_nsISupportsIs3(out nsIIDRef iid, [iid_is(iid)] inout nsQIResult result);
00099 //    void                     do_nsISupportsIs4(out nsIIDRef iid, [iid_is(iid)] out nsQIResult result);
00100 };
00101 
00102 // Another interface - we use another interface purely for testing purposes -
00103 // We ensure that the entire interface hierarcy is available correctly.
00104 [scriptable, uuid(B38D1538-FE92-42c3-831F-285242EDEEA4)]
00105 interface nsIPythonTestInterfaceExtra : nsIPythonTestInterface
00106 {
00107     // These were copied from the XPCOM test 'xpctest.idl'
00108     // (and a few extras added)
00109     void MultiplyEachItemInIntegerArray(
00110                            in PRInt32 val, 
00111                            in PRUint32 count, 
00112                            [array, size_is(count)] inout PRInt32 valueArray);
00113     void MultiplyEachItemInIntegerArrayAndAppend(
00114                            in PRInt32 val, 
00115                            inout PRUint32 count, 
00116                            [array, size_is(count)] inout PRInt32 valueArray);
00117 
00118     // Note that this method shares a single "size_is" between 2 params!
00119     void CompareStringArrays([array, size_is(count)] in string arr1,
00120                  [array, size_is(count)] in string arr2,
00121                  in unsigned long count,
00122                  [retval] out short result);
00123 
00124     void DoubleStringArray(inout PRUint32 count, 
00125                            [array, size_is(count)] inout string valueArray);
00126     void ReverseStringArray(in PRUint32 count, 
00127                             [array, size_is(count)] inout string valueArray);
00128 
00129     // One count, one inout array.
00130     void DoubleString(inout PRUint32 count, 
00131                       [size_is(count)] inout string str);
00132     // One in count and in array, plus out count and out array
00133     void DoubleString2(in PRUint32 in_count, [size_is(in_count)] in string in_str,
00134                        out PRUint32 out_count, [size_is(out_count)] out string out_str);
00135     // As per DoubleString2, but out string also marked retval
00136     void DoubleString3(in PRUint32 in_count, [size_is(in_count)] in string in_str,
00137                        out PRUint32 out_count, [size_is(out_count), retval] out string out_str);
00138     // One in array, one out array, one share inout count.
00139     void DoubleString4([size_is(count)] in string in_str, inout PRUint32 count, [size_is(count)] out string out_str);
00140     // UpString defines the count as only "in" - meaning the result must be the same size
00141     void UpString(in PRUint32 count, 
00142                       [size_is(count)] inout string str);
00143     // UpString2 defines count as only "in", and a string as only "out"
00144     void UpString2(in PRUint32 count, 
00145                       [size_is(count)] in string in_str,
00146                       [size_is(count)]out string out_str);
00147     void CopyUTF8String(in AUTF8String in_str, out AUTF8String out_str);
00148     void CopyUTF8String2(in AUTF8String in_str, out AUTF8String out_str);
00149     // Test we can get an "out" array with an "in" size (and the size is not used anywhere as a size for an in!)
00150     void GetFixedString(in PRUint32 count, [size_is(count)]out string out_str);
00151 
00152     void DoubleWideString(inout PRUint32 count, 
00153                       [size_is(count)] inout wstring str);
00154     void DoubleWideString2(in PRUint32 in_count, [size_is(in_count)] in wstring in_str,
00155                        out PRUint32 out_count, [size_is(out_count)] out wstring out_str);
00156     void DoubleWideString3(in PRUint32 in_count, [size_is(in_count)] in wstring in_str,
00157                        out PRUint32 out_count, [size_is(out_count), retval] out wstring out_str);
00158     void DoubleWideString4([size_is(count)] in wstring in_str, inout PRUint32 count, [size_is(count)] out wstring out_str);
00159     // UpWideString defines the count as only "in" - meaning the result must be the same size
00160     void UpWideString(in PRUint32 count, 
00161                       [size_is(count)] inout wstring str);
00162     // UpWideString2 defines count as only "in", and a string as only "out"
00163     void UpWideString2(in PRUint32 count, 
00164                       [size_is(count)] in wstring in_str,
00165                       [size_is(count)]out wstring out_str);
00166     // Test we can get an "out" array with an "in" size (and the size is not used anywhere as a size for an in!)
00167     void GetFixedWideString(in PRUint32 count, [size_is(count)]out string out_str);
00168 
00169     void GetStrings(out PRUint32 count,
00170                     [retval, array, size_is(count)] out string str);
00171 
00172     void UpOctetArray(inout PRUint32 count,
00173                     [array, size_is(count)] inout PRUint8 data);
00174 
00175     void UpOctetArray2(inout PRUint32 count,
00176                     [array, size_is(count)] inout PRUint8 data);
00177 
00178     // Arrays of interfaces
00179     void CheckInterfaceArray(in PRUint32 count,
00180                              [array, size_is(count)] in nsISupports data,
00181                              [retval] out PRBool all_non_null);
00182     void CopyInterfaceArray(in PRUint32 count,
00183                              [array, size_is(count)] in nsISupports data,
00184                              [array, size_is(out_count)] out nsISupports out_data,
00185                             out PRUint32 out_count);
00186     void GetInterfaceArray(out PRUint32 count,
00187                              [array, size_is(count)] out nsISupports data);
00188     void ExtendInterfaceArray(inout PRUint32 count,
00189                              [array, size_is(count)] inout nsISupports data);
00190 
00191     // Arrays of IIDs
00192     void CheckIIDArray(in PRUint32 count,
00193                              [array, size_is(count)] in nsIIDRef data,
00194                              [retval] out PRBool all_mine);
00195     void GetIIDArray(out PRUint32 count,
00196                              [array, size_is(count)] out nsIIDRef data);
00197     void ExtendIIDArray(inout PRUint32 count,
00198                              [array, size_is(count)] inout nsIIDRef data);
00199 
00200     // More specific tests.
00201     // Test our count param can be shared as an "in" param.
00202     void SumArrays(in PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]in PRInt32 array2, [retval]out PRInt32 result);
00203     // Test our count param can be shared as an "out" param.
00204     void GetArrays(out PRUint32 count, [array, size_is(count)]out PRInt32 array1, [array, size_is(count)]out PRInt32 array2);
00205     // Test we can get an "out" array with an "in" size (and the size is not used anywhere as a size for an in!)
00206     void GetFixedArray(in PRUint32 count, [array, size_is(count)]out PRInt32 array1);
00207     // Test our "in" count param can be shared as one "in", plus one  "out" param.
00208     void CopyArray(in PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]out PRInt32 array2);
00209     // Test our "in-out" count param can be shared as one "in", plus one  "out" param.
00210     void CopyAndDoubleArray(inout PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]out PRInt32 array2);
00211     // Test our "in-out" count param can be shared as one "in", plus one  "in-out" param.
00212     void AppendArray(inout PRUint32 count, [array, size_is(count)]in PRInt32 array1, [array, size_is(count)]inout PRInt32 array2);
00213     void AppendVariant(in nsIVariant variant, inout nsIVariant result);
00214     nsIVariant CopyVariant(in nsIVariant variant);
00215 };
00216 
00217 // DOM String support is a "recent" (01/2001) addition to XPCOM.  These test 
00218 // have their own interface for no real good reason ;-)
00219 [scriptable, uuid(657ae651-a973-4818-8c06-f4b948b3d758)]
00220 interface nsIPythonTestInterfaceDOMStrings : nsIPythonTestInterfaceExtra
00221 {
00222     DOMString GetDOMStringResult(in PRInt32 length);
00223     void GetDOMStringOut(in PRInt32 length, [retval] out DOMString s);
00224     PRUint32 GetDOMStringLength(in DOMString s);
00225     PRUint32 GetDOMStringRefLength(in DOMStringRef s);
00226     PRUint32 GetDOMStringPtrLength(in DOMStringPtr s);
00227     void ConcatDOMStrings(in DOMString s1, in DOMString s2, out DOMString ret);
00228     attribute DOMString domstring_value;
00229     readonly attribute DOMString domstring_value_ro;
00230 };