michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /* michael@0: * nsICommandParams is used to pass parameters to commands executed michael@0: * via nsICommandManager, and to get command state. michael@0: * michael@0: */ michael@0: michael@0: [scriptable, uuid(83f892cf-7ed3-490e-967a-62640f3158e1)] michael@0: interface nsICommandParams : nsISupports michael@0: { michael@0: michael@0: /* michael@0: * List of primitive types for parameter values. michael@0: */ michael@0: const short eNoType = 0; /* Only used for sanity checking */ michael@0: const short eBooleanType = 1; michael@0: const short eLongType = 2; michael@0: const short eDoubleType = 3; michael@0: const short eWStringType = 4; michael@0: const short eISupportsType = 5; michael@0: const short eStringType = 6; michael@0: michael@0: /* michael@0: * getValueType michael@0: * michael@0: * Get the type of a specified parameter michael@0: */ michael@0: short getValueType(in string name); michael@0: michael@0: /* michael@0: * get_Value michael@0: * michael@0: * Get the value of a specified parameter. Will return michael@0: * an error if the parameter does not exist, or if the value michael@0: * is of the wrong type (no coercion is performed for you). michael@0: * michael@0: * nsISupports values can contain any XPCOM interface, michael@0: * as documented for the command. It is permissible michael@0: * for it to contain nsICommandParams, but not *this* michael@0: * one (i.e. self-containing is not allowed). michael@0: */ michael@0: boolean getBooleanValue(in string name); michael@0: long getLongValue(in string name); michael@0: double getDoubleValue(in string name); michael@0: AString getStringValue(in string name); michael@0: string getCStringValue(in string name); michael@0: nsISupports getISupportsValue(in string name); michael@0: michael@0: /* michael@0: * set_Value michael@0: * michael@0: * Set the value of a specified parameter (thus creating michael@0: * an entry for it). michael@0: * michael@0: * nsISupports values can contain any XPCOM interface, michael@0: * as documented for the command. It is permissible michael@0: * for it to contain nsICommandParams, but not *this* michael@0: * one (i.e. self-containing is not allowed). michael@0: */ michael@0: void setBooleanValue(in string name, in boolean value); michael@0: void setLongValue(in string name, in long value); michael@0: void setDoubleValue(in string name, in double value); michael@0: void setStringValue(in string name, in AString value); michael@0: void setCStringValue(in string name, in string value); michael@0: void setISupportsValue(in string name, in nsISupports value); michael@0: michael@0: /* michael@0: * removeValue michael@0: * michael@0: * Remove the specified parameter from the list. michael@0: */ michael@0: void removeValue(in string name); michael@0: michael@0: /* michael@0: * Enumeration methods michael@0: * michael@0: * Use these to enumerate over the contents of a parameter michael@0: * list. For each name that getNext() returns, use michael@0: * getValueType() and then getMumbleValue to get its michael@0: * value. michael@0: */ michael@0: boolean hasMoreElements(); michael@0: void first(); michael@0: michael@0: /** michael@0: * GetNext() michael@0: * michael@0: * @return string pointer that will be allocated and is up michael@0: * to the caller to free michael@0: */ michael@0: string getNext(); michael@0: michael@0: }; michael@0: michael@0: // {f7fa4581-238e-11d5-a73c-ab64fb68f2bc} michael@0: %{C++ michael@0: #define NS_COMMAND_PARAMS_CID { 0xf7fa4581, 0x238e, 0x11d5, { 0xa7, 0x3c, 0xab, 0x64, 0xfb, 0x68, 0xf2, 0xbc } } michael@0: #define NS_COMMAND_PARAMS_CONTRACTID "@mozilla.org/embedcomp/command-params;1" michael@0: %} michael@0: