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/. */
6 #include
"nsISupports.idl"
9 * nsICommandParams is used to pass parameters to commands executed
10 * via nsICommandManager, and to get command state.
16 class nsCommandParams
;
19 [scriptable
, builtinclass
, uuid(b1fdf3c4
-74e3
-4f7d
-a14d
-2b76bcf53482
)]
20 interface nsICommandParams
: nsISupports
23 * List of primitive types for parameter values.
25 const short eNoType
= 0; /* Only used for sanity checking */
26 const short eBooleanType
= 1;
27 const short eLongType
= 2;
28 const short eDoubleType
= 3;
29 const short eWStringType
= 4;
30 const short eISupportsType
= 5;
31 const short eStringType
= 6;
36 * Get the type of a specified parameter
38 short getValueType
(in string name
);
43 * Get the value of a specified parameter. Will return
44 * an error if the parameter does not exist, or if the value
45 * is of the wrong type (no coercion is performed for you).
47 * nsISupports values can contain any XPCOM interface,
48 * as documented for the command. It is permissible
49 * for it to contain nsICommandParams, but not *this*
50 * one (i.e. self-containing is not allowed).
52 boolean getBooleanValue
(in string name
);
53 long getLongValue
(in string name
);
54 double getDoubleValue
(in string name
);
55 AString getStringValue
(in string name
);
56 ACString getCStringValue
(in string name
);
57 nsISupports getISupportsValue
(in string name
);
62 * Set the value of a specified parameter (thus creating
65 * nsISupports values can contain any XPCOM interface,
66 * as documented for the command. It is permissible
67 * for it to contain nsICommandParams, but not *this*
68 * one (i.e. self-containing is not allowed).
70 void setBooleanValue
(in string name
, in boolean value
);
71 void setLongValue
(in string name
, in long value
);
72 void setDoubleValue
(in string name
, in double value
);
73 void setStringValue
(in string name
, in AString value
);
74 void setCStringValue
(in string name
, in ACString value
);
75 void setISupportsValue
(in string name
, in nsISupports value
);
80 * Remove the specified parameter from the list.
82 void removeValue
(in string name
);
86 * In order to avoid circular dependency issues, these methods are defined
87 * in nsCommandParams.h. Consumers need to #include that header.
89 inline nsCommandParams
* AsCommandParams
();
90 inline
const nsCommandParams
* AsCommandParams
() const;