1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Simon Fraser <sfraser@netscape.com>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 #include "nsISupports.idl"
40
41 /*
42 * nsICommandParams is used to pass parameters to commands executed
43 * via nsICommandManager, and to get command state.
44 *
45 */
46
47 [scriptable, uuid(83f892cf-7ed3-490e-967a-62640f3158e1)]
48 interface nsICommandParams : nsISupports
49 {
50
51 /*
52 * List of primitive types for parameter values.
53 */
54 const short eNoType = 0; /* Only used for sanity checking */
55 const short eBooleanType = 1;
56 const short eLongType = 2;
57 const short eDoubleType = 3;
58 const short eWStringType = 4;
59 const short eISupportsType = 5;
60 const short eStringType = 6;
61
62 /*
63 * getValueType
64 *
65 * Get the type of a specified parameter
66 */
67 short getValueType(in string name);
68
69 /*
70 * get_Value
71 *
72 * Get the value of a specified parameter. Will return
73 * an error if the parameter does not exist, or if the value
74 * is of the wrong type (no coercion is performed for you).
75 *
76 * nsISupports values can contain any XPCOM interface,
77 * as documented for the command. It is permissible
78 * for it to contain nsICommandParams, but not *this*
79 * one (i.e. self-containing is not allowed).
80 */
81 boolean getBooleanValue(in string name);
82 long getLongValue(in string name);
83 double getDoubleValue(in string name);
84 AString getStringValue(in string name);
85 string getCStringValue(in string name);
86 nsISupports getISupportsValue(in string name);
87
88 /*
89 * set_Value
90 *
91 * Set the value of a specified parameter (thus creating
92 * an entry for it).
93 *
94 * nsISupports values can contain any XPCOM interface,
95 * as documented for the command. It is permissible
96 * for it to contain nsICommandParams, but not *this*
97 * one (i.e. self-containing is not allowed).
98 */
99 void setBooleanValue(in string name, in boolean value);
100 void setLongValue(in string name, in long value);
101 void setDoubleValue(in string name, in double value);
102 void setStringValue(in string name, in AString value);
103 void setCStringValue(in string name, in string value);
104 void setISupportsValue(in string name, in nsISupports value);
105
106 /*
107 * removeValue
108 *
109 * Remove the specified parameter from the list.
110 */
111 void removeValue(in string name);
112
113 /*
114 * Enumeration methods
115 *
116 * Use these to enumerate over the contents of a parameter
117 * list. For each name that getNext() returns, use
118 * getValueType() and then getMumbleValue to get its
119 * value.
120 */
121 boolean hasMoreElements();
122 void first();
123
124 /**
125 * GetNext()
126 *
127 * @return string pointer that will be allocated and is up
128 * to the caller to free
129 */
130 string getNext();
131
132 };
133
134 // {f7fa4581-238e-11d5-a73c-ab64fb68f2bc}
135 %{C++
136 #define NS_COMMAND_PARAMS_CID { 0xf7fa4581, 0x238e, 0x11d5, { 0xa7, 0x3c, 0xab, 0x64, 0xfb, 0x68, 0xf2, 0xbc } }
137 #define NS_COMMAND_PARAMS_CONTRACTID "@mozilla.org/embedcomp/command-params;1"
138 %}