xpctest_params.idl 5.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. /**
  5. * Test pararameter passing and argument conversion.
  6. *
  7. * Each test method returns the value in 'b', and copies 'a' into 'b'. This lets
  8. * us test return values, in params, and inout params (out params should be
  9. * covered by the intersection of return values and inout).
  10. */
  11. #include "nsISupports.idl"
  12. interface nsIXPCTestInterfaceA;
  13. interface nsIXPCTestInterfaceB;
  14. [scriptable, uuid(812145c7-9fcc-425e-a878-36ad1b7730b7)]
  15. interface nsIXPCTestParams : nsISupports {
  16. // These types correspond to the ones in typelib.py
  17. boolean testBoolean(in boolean a, inout boolean b);
  18. octet testOctet(in octet a, inout octet b);
  19. short testShort(in short a, inout short b);
  20. long testLong(in long a, inout long b);
  21. long long testLongLong(in long long a, inout long long b);
  22. unsigned short testUnsignedShort(in unsigned short a, inout unsigned short b);
  23. unsigned long testUnsignedLong(in unsigned long a, inout unsigned long b);
  24. unsigned long long testUnsignedLongLong(in unsigned long long a, inout unsigned long long b);
  25. float testFloat(in float a, inout float b);
  26. double testDouble(in double a, inout float b);
  27. char testChar(in char a, inout char b);
  28. string testString(in string a, inout string b);
  29. wchar testWchar(in wchar a, inout wchar b);
  30. wstring testWstring(in wstring a, inout wstring b);
  31. DOMString testDOMString(in DOMString a, inout DOMString b);
  32. AString testAString(in AString a, inout AString b);
  33. AUTF8String testAUTF8String(in AUTF8String a, inout AUTF8String b);
  34. ACString testACString(in ACString a, inout ACString b);
  35. jsval testJsval(in jsval a, inout jsval b);
  36. //
  37. // Dependent parameters use the same types as above, but are handled much differently.
  38. //
  39. // Test arrays.
  40. void testShortArray(in unsigned long aLength, [array, size_is(aLength)] in short a,
  41. inout unsigned long bLength, [array, size_is(bLength)] inout short b,
  42. out unsigned long rvLength, [retval, array, size_is(rvLength)] out short rv);
  43. void testDoubleArray(in unsigned long aLength, [array, size_is(aLength)] in double a,
  44. inout unsigned long bLength, [array, size_is(bLength)] inout double b,
  45. out unsigned long rvLength, [retval, array, size_is(rvLength)] out double rv);
  46. void testStringArray(in unsigned long aLength, [array, size_is(aLength)] in string a,
  47. inout unsigned long bLength, [array, size_is(bLength)] inout string b,
  48. out unsigned long rvLength, [retval, array, size_is(rvLength)] out string rv);
  49. void testWstringArray(in unsigned long aLength, [array, size_is(aLength)] in wstring a,
  50. inout unsigned long bLength, [array, size_is(bLength)] inout wstring b,
  51. out unsigned long rvLength, [retval, array, size_is(rvLength)] out wstring rv);
  52. void testInterfaceArray(in unsigned long aLength, [array, size_is(aLength)] in nsIXPCTestInterfaceA a,
  53. inout unsigned long bLength, [array, size_is(bLength)] inout nsIXPCTestInterfaceA b,
  54. out unsigned long rvLength, [retval, array, size_is(rvLength)] out nsIXPCTestInterfaceA rv);
  55. // Test sized strings.
  56. void testSizedString(in unsigned long aLength, [size_is(aLength)] in string a,
  57. inout unsigned long bLength, [size_is(bLength)] inout string b,
  58. out unsigned long rvLength, [retval, size_is(rvLength)] out string rv);
  59. void testSizedWstring(in unsigned long aLength, [size_is(aLength)] in wstring a,
  60. inout unsigned long bLength, [size_is(bLength)] inout wstring b,
  61. out unsigned long rvLength, [retval, size_is(rvLength)] out wstring rv);
  62. // Test iid_is.
  63. void testInterfaceIs(in nsIIDPtr aIID, [iid_is(aIID)] in nsQIResult a,
  64. inout nsIIDPtr bIID, [iid_is(bIID)] inout nsQIResult b,
  65. out nsIIDPtr rvIID, [retval, iid_is(rvIID)] out nsQIResult rv);
  66. // Test arrays of iid_is. According to khuey we don't use it for anything
  67. // in mozilla-central, but calendar stuff depends on it.
  68. void testInterfaceIsArray(in unsigned long aLength, in nsIIDPtr aIID,
  69. [array, size_is(aLength), iid_is(aIID)] in nsQIResult a,
  70. inout unsigned long bLength, inout nsIIDPtr bIID,
  71. [array, size_is(bLength), iid_is(bIID)] inout nsQIResult b,
  72. out unsigned long rvLength, out nsIIDPtr rvIID,
  73. [retval, array, size_is(rvLength), iid_is(rvIID)] out nsQIResult rv);
  74. // Test for out dipper parameters
  75. void testOutAString(out AString o);
  76. // Test for optional array size_is.
  77. ACString testStringArrayOptionalSize([array, size_is(aLength)] in string a, [optional] in unsigned long aLength);
  78. };