embedding/components/commandhandler/public/nsICommandParams.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/embedding/components/commandhandler/public/nsICommandParams.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,106 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +/*
    1.12 + * nsICommandParams is used to pass parameters to commands executed
    1.13 + * via nsICommandManager, and to get command state.
    1.14 + *
    1.15 + */
    1.16 +
    1.17 +[scriptable, uuid(83f892cf-7ed3-490e-967a-62640f3158e1)]
    1.18 +interface nsICommandParams : nsISupports
    1.19 +{
    1.20 +
    1.21 +  /*
    1.22 +   * List of primitive types for parameter values.
    1.23 +   */
    1.24 +  const short eNoType                     = 0;      /* Only used for sanity checking */
    1.25 +  const short eBooleanType                = 1;
    1.26 +  const short eLongType                   = 2;
    1.27 +  const short eDoubleType                 = 3;
    1.28 +  const short eWStringType                = 4;
    1.29 +  const short eISupportsType              = 5;
    1.30 +  const short eStringType                 = 6;
    1.31 +
    1.32 +  /*
    1.33 +   * getValueType
    1.34 +   * 
    1.35 +   * Get the type of a specified parameter
    1.36 +   */
    1.37 +  short       getValueType(in string name);
    1.38 +
    1.39 +  /*
    1.40 +   * get_Value
    1.41 +   * 
    1.42 +   * Get the value of a specified parameter. Will return
    1.43 +   * an error if the parameter does not exist, or if the value
    1.44 +   * is of the wrong type (no coercion is performed for you).
    1.45 +   * 
    1.46 +   * nsISupports values can contain any XPCOM interface,
    1.47 +   * as documented for the command. It is permissible
    1.48 +   * for it to contain nsICommandParams, but not *this*
    1.49 +   * one (i.e. self-containing is not allowed).
    1.50 +   */
    1.51 +  boolean     getBooleanValue(in string name);
    1.52 +  long        getLongValue(in string name);
    1.53 +  double      getDoubleValue(in string name);
    1.54 +  AString     getStringValue(in string name);
    1.55 +  string      getCStringValue(in string name);
    1.56 +  nsISupports getISupportsValue(in string name);
    1.57 +  
    1.58 +  /*
    1.59 +   * set_Value
    1.60 +   * 
    1.61 +   * Set the value of a specified parameter (thus creating
    1.62 +   * an entry for it).
    1.63 +   * 
    1.64 +   * nsISupports values can contain any XPCOM interface,
    1.65 +   * as documented for the command. It is permissible
    1.66 +   * for it to contain nsICommandParams, but not *this*
    1.67 +   * one (i.e. self-containing is not allowed).
    1.68 +   */
    1.69 +  void        setBooleanValue(in string name, in boolean value);
    1.70 +  void        setLongValue(in string name, in long value);
    1.71 +  void        setDoubleValue(in string name, in double value);
    1.72 +  void        setStringValue(in string name, in AString value);
    1.73 +  void        setCStringValue(in string name, in string value);
    1.74 +  void        setISupportsValue(in string name, in nsISupports value);
    1.75 +  
    1.76 +  /*
    1.77 +   * removeValue
    1.78 +   * 
    1.79 +   * Remove the specified parameter from the list.
    1.80 +   */
    1.81 +  void        removeValue(in string name);
    1.82 +  
    1.83 +  /*
    1.84 +   * Enumeration methods
    1.85 +   * 
    1.86 +   * Use these to enumerate over the contents of a parameter
    1.87 +   * list. For each name that getNext() returns, use 
    1.88 +   * getValueType() and then getMumbleValue to get its
    1.89 +   * value.
    1.90 +   */
    1.91 +  boolean     hasMoreElements();
    1.92 +  void        first();
    1.93 +
    1.94 +  /**
    1.95 +   * GetNext()
    1.96 +   * 
    1.97 +   * @return string pointer that will be allocated and is up 
    1.98 +   *         to the caller to free
    1.99 +   */
   1.100 +  string      getNext();
   1.101 +
   1.102 +};
   1.103 +
   1.104 +// {f7fa4581-238e-11d5-a73c-ab64fb68f2bc}
   1.105 +%{C++
   1.106 +#define NS_COMMAND_PARAMS_CID { 0xf7fa4581, 0x238e, 0x11d5, { 0xa7, 0x3c, 0xab, 0x64, 0xfb, 0x68, 0xf2, 0xbc } }
   1.107 +#define NS_COMMAND_PARAMS_CONTRACTID "@mozilla.org/embedcomp/command-params;1"
   1.108 +%}
   1.109 +

mercurial