nsICommandParams.idl (2982B)
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 15 %{C++ 16 class nsCommandParams; 17 %} 18 19 [scriptable, builtinclass, uuid(b1fdf3c4-74e3-4f7d-a14d-2b76bcf53482)] 20 interface nsICommandParams : nsISupports 21 { 22 /* 23 * List of primitive types for parameter values. 24 */ 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; 32 33 /* 34 * getValueType 35 * 36 * Get the type of a specified parameter 37 */ 38 short getValueType(in string name); 39 40 /* 41 * get_Value 42 * 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). 46 * 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). 51 */ 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); 58 59 /* 60 * set_Value 61 * 62 * Set the value of a specified parameter (thus creating 63 * an entry for it). 64 * 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). 69 */ 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); 76 77 /* 78 * removeValue 79 * 80 * Remove the specified parameter from the list. 81 */ 82 void removeValue(in string name); 83 84 %{C++ 85 /** 86 * In order to avoid circular dependency issues, these methods are defined 87 * in nsCommandParams.h. Consumers need to #include that header. 88 */ 89 inline nsCommandParams* AsCommandParams(); 90 inline const nsCommandParams* AsCommandParams() const; 91 %} 92 };