Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | /* |
michael@0 | 9 | * nsICommandParams is used to pass parameters to commands executed |
michael@0 | 10 | * via nsICommandManager, and to get command state. |
michael@0 | 11 | * |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | [scriptable, uuid(83f892cf-7ed3-490e-967a-62640f3158e1)] |
michael@0 | 15 | interface nsICommandParams : nsISupports |
michael@0 | 16 | { |
michael@0 | 17 | |
michael@0 | 18 | /* |
michael@0 | 19 | * List of primitive types for parameter values. |
michael@0 | 20 | */ |
michael@0 | 21 | const short eNoType = 0; /* Only used for sanity checking */ |
michael@0 | 22 | const short eBooleanType = 1; |
michael@0 | 23 | const short eLongType = 2; |
michael@0 | 24 | const short eDoubleType = 3; |
michael@0 | 25 | const short eWStringType = 4; |
michael@0 | 26 | const short eISupportsType = 5; |
michael@0 | 27 | const short eStringType = 6; |
michael@0 | 28 | |
michael@0 | 29 | /* |
michael@0 | 30 | * getValueType |
michael@0 | 31 | * |
michael@0 | 32 | * Get the type of a specified parameter |
michael@0 | 33 | */ |
michael@0 | 34 | short getValueType(in string name); |
michael@0 | 35 | |
michael@0 | 36 | /* |
michael@0 | 37 | * get_Value |
michael@0 | 38 | * |
michael@0 | 39 | * Get the value of a specified parameter. Will return |
michael@0 | 40 | * an error if the parameter does not exist, or if the value |
michael@0 | 41 | * is of the wrong type (no coercion is performed for you). |
michael@0 | 42 | * |
michael@0 | 43 | * nsISupports values can contain any XPCOM interface, |
michael@0 | 44 | * as documented for the command. It is permissible |
michael@0 | 45 | * for it to contain nsICommandParams, but not *this* |
michael@0 | 46 | * one (i.e. self-containing is not allowed). |
michael@0 | 47 | */ |
michael@0 | 48 | boolean getBooleanValue(in string name); |
michael@0 | 49 | long getLongValue(in string name); |
michael@0 | 50 | double getDoubleValue(in string name); |
michael@0 | 51 | AString getStringValue(in string name); |
michael@0 | 52 | string getCStringValue(in string name); |
michael@0 | 53 | nsISupports getISupportsValue(in string name); |
michael@0 | 54 | |
michael@0 | 55 | /* |
michael@0 | 56 | * set_Value |
michael@0 | 57 | * |
michael@0 | 58 | * Set the value of a specified parameter (thus creating |
michael@0 | 59 | * an entry for it). |
michael@0 | 60 | * |
michael@0 | 61 | * nsISupports values can contain any XPCOM interface, |
michael@0 | 62 | * as documented for the command. It is permissible |
michael@0 | 63 | * for it to contain nsICommandParams, but not *this* |
michael@0 | 64 | * one (i.e. self-containing is not allowed). |
michael@0 | 65 | */ |
michael@0 | 66 | void setBooleanValue(in string name, in boolean value); |
michael@0 | 67 | void setLongValue(in string name, in long value); |
michael@0 | 68 | void setDoubleValue(in string name, in double value); |
michael@0 | 69 | void setStringValue(in string name, in AString value); |
michael@0 | 70 | void setCStringValue(in string name, in string value); |
michael@0 | 71 | void setISupportsValue(in string name, in nsISupports value); |
michael@0 | 72 | |
michael@0 | 73 | /* |
michael@0 | 74 | * removeValue |
michael@0 | 75 | * |
michael@0 | 76 | * Remove the specified parameter from the list. |
michael@0 | 77 | */ |
michael@0 | 78 | void removeValue(in string name); |
michael@0 | 79 | |
michael@0 | 80 | /* |
michael@0 | 81 | * Enumeration methods |
michael@0 | 82 | * |
michael@0 | 83 | * Use these to enumerate over the contents of a parameter |
michael@0 | 84 | * list. For each name that getNext() returns, use |
michael@0 | 85 | * getValueType() and then getMumbleValue to get its |
michael@0 | 86 | * value. |
michael@0 | 87 | */ |
michael@0 | 88 | boolean hasMoreElements(); |
michael@0 | 89 | void first(); |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | * GetNext() |
michael@0 | 93 | * |
michael@0 | 94 | * @return string pointer that will be allocated and is up |
michael@0 | 95 | * to the caller to free |
michael@0 | 96 | */ |
michael@0 | 97 | string getNext(); |
michael@0 | 98 | |
michael@0 | 99 | }; |
michael@0 | 100 | |
michael@0 | 101 | // {f7fa4581-238e-11d5-a73c-ab64fb68f2bc} |
michael@0 | 102 | %{C++ |
michael@0 | 103 | #define NS_COMMAND_PARAMS_CID { 0xf7fa4581, 0x238e, 0x11d5, { 0xa7, 0x3c, 0xab, 0x64, 0xfb, 0x68, 0xf2, 0xbc } } |
michael@0 | 104 | #define NS_COMMAND_PARAMS_CONTRACTID "@mozilla.org/embedcomp/command-params;1" |
michael@0 | 105 | %} |
michael@0 | 106 |