1 ## Copyright (C) 2011 Carnë Draug <carandraug+dev@gmail.com>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {@var{parser} =} addParamValue (@var{parser}, @var{argname}, @var{default})
18 ## @deftypefnx {Function File} {@var{parser} =} @var{parser}.addParamValue (@var{argname}, @var{default})
19 ## @deftypefnx {Function File} {@var{parser} =} addParamValue (@var{parser}, @var{argname}, @var{default}, @var{validator})
20 ## @deftypefnx {Function File} {@var{parser} =} @var{parser}.addParamValue (@var{argname}, @var{default}, @var{validator})
21 ## Add new parameter to the object @var{parser} of the class inputParser to implement
22 ## a name/value pair type of API.
24 ## @var{argname} must be a string with the name of the new parameter.
26 ## @var{default} will be the value used when the parameter is not specified.
28 ## @var{validator} is an optional function handle to validate the given values
29 ## for the parameter with name @var{argname}. Alternatively, a function name
32 ## See @command{help inputParser} for examples.
34 ## @seealso{inputParser, @@inputParser/addOptional, @@inputParser/addSwitch,
35 ## @@inputParser/addParamValue, @@inputParser/addRequired, @@inputParser/parse}
38 function inPar = addParamValue (inPar, name, def, val)
40 ## check @inputParser/subsref for the actual code
42 inPar = subsref (inPar, substruct(
43 '.' , 'addParamValue',
47 inPar = subsref (inPar, substruct(
48 '.' , 'addParamValue',
49 '()', {name, def, val}