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