Back to index

lightning-sunbird  0.9+nobinonly
nsICommandParams.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Simon Fraser <sfraser@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 
00041 /*
00042  * nsICommandParams is used to pass parameters to commands executed
00043  * via nsICommandManager, and to get command state.
00044  *
00045  */
00046 
00047 [scriptable, uuid(83f892cf-7ed3-490e-967a-62640f3158e1)]
00048 interface nsICommandParams : nsISupports
00049 {
00050 
00051   /*
00052    * List of primitive types for parameter values.
00053    */
00054   const short eNoType                     = 0;      /* Only used for sanity checking */
00055   const short eBooleanType                = 1;
00056   const short eLongType                   = 2;
00057   const short eDoubleType                 = 3;
00058   const short eWStringType                = 4;
00059   const short eISupportsType              = 5;
00060   const short eStringType                 = 6;
00061 
00062   /*
00063    * getValueType
00064    * 
00065    * Get the type of a specified parameter
00066    */
00067   short       getValueType(in string name);
00068 
00069   /*
00070    * get_Value
00071    * 
00072    * Get the value of a specified parameter. Will return
00073    * an error if the parameter does not exist, or if the value
00074    * is of the wrong type (no coercion is performed for you).
00075    * 
00076    * nsISupports values can contain any XPCOM interface,
00077    * as documented for the command. It is permissible
00078    * for it to contain nsICommandParams, but not *this*
00079    * one (i.e. self-containing is not allowed).
00080    */
00081   boolean     getBooleanValue(in string name);
00082   long        getLongValue(in string name);
00083   double      getDoubleValue(in string name);
00084   AString     getStringValue(in string name);
00085   string      getCStringValue(in string name);
00086   nsISupports getISupportsValue(in string name);
00087   
00088   /*
00089    * set_Value
00090    * 
00091    * Set the value of a specified parameter (thus creating
00092    * an entry for it).
00093    * 
00094    * nsISupports values can contain any XPCOM interface,
00095    * as documented for the command. It is permissible
00096    * for it to contain nsICommandParams, but not *this*
00097    * one (i.e. self-containing is not allowed).
00098    */
00099   void        setBooleanValue(in string name, in boolean value);
00100   void        setLongValue(in string name, in long value);
00101   void        setDoubleValue(in string name, in double value);
00102   void        setStringValue(in string name, in AString value);
00103   void        setCStringValue(in string name, in string value);
00104   void        setISupportsValue(in string name, in nsISupports value);
00105   
00106   /*
00107    * removeValue
00108    * 
00109    * Remove the specified parameter from the list.
00110    */
00111   void        removeValue(in string name);
00112   
00113   /*
00114    * Enumeration methods
00115    * 
00116    * Use these to enumerate over the contents of a parameter
00117    * list. For each name that getNext() returns, use 
00118    * getValueType() and then getMumbleValue to get its
00119    * value.
00120    */
00121   boolean     hasMoreElements();
00122   void        first();
00123 
00130   string      getNext();
00131 
00132 };
00133 
00134 // {f7fa4581-238e-11d5-a73c-ab64fb68f2bc}
00135 %{C++
00136 #define NS_COMMAND_PARAMS_CID { 0xf7fa4581, 0x238e, 0x11d5, { 0xa7, 0x3c, 0xab, 0x64, 0xfb, 0x68, 0xf2, 0xbc } }
00137 #define NS_COMMAND_PARAMS_CONTRACTID "@mozilla.org/embedcomp/command-params;1"
00138 %}
00139