company logo

BaseContext :: setParameter - Set parameters for action

The function allows passing parameters to an action called by executeAction() . Since parameters could be passed directly, this is the only way passing parameters to an action. Parameters are reset automatically, when the action had terminated. In case of calling context functions recursively, i.e. when another context action is called from within an action, parameters become invalid. Hence, parameters should be read at the beginning of a context action, always.

From within the context function called parameters can be accessed using the parameter( iNumber ) function.

Parameters must not contain unit separators (0x1f), which is considered as parameter separator.

When the context handle does not refer to a valid context instance the function throws an exception.

Implementation overview

Implementation details

  1. Set parameters from parm list
    BaseContext  :: setParameter ( odaba::StringList &sParmList )

    In order to pass a list of parameter values, a StringList ( sParmList ) with parameters can be passed. The strings from the string-list are set as parameter values for parameter 0 ... n.

    • sParmList - Parameter list

      Parameters passed in a string list. In some cases, parameters containing spaces have to be quoted.

  2. to list
  3. Pass user separated parameter string
    BaseContext  :: setParameter ( odaba::String &sParameter, odaba::String &sSeparator )

    The function provides a simplified way of setting parameter values for a context function, since it is not necessary to create a string list.

    The parameter string passed in sParameter contains a list of parameters separated by a separator value passed in sSeparator . Only the first character from sSeparator is interpreted as separator character and should no be part of any parameter value in the string.

      context.setParameter("Miller,Paul",",");

      context.executeAction("Remove"); // remove Paul Miller

      output(context.result());

    • sParameter - Parameter value

      Parameter values allow passing one or more parameters in a parameter string. Usually, parameters are separated by spaces. Parameters containing spaces have to be quoted using double quotes.

    • sSeparator - Separator character

      The separator character defines the type of character separated position parameters.

  4. to list
  5. Pass default parameter string
    BaseContext  :: setParameter ( odaba::String &sParameter )

    The function provides a simplified way of setting parameter values for a context function, since it is not necessary to create a string list.

    The parameter string passed in sParameter contains a list of parameters separated by default separators.

    • sParameter - Parameter value

      Parameter values allow passing one or more parameters in a parameter string. Usually, parameters are separated by spaces. Parameters containing spaces have to be quoted using double quotes.

  6. to list