GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
CLARG_WITH_ARGS
+
Point of view
CLARG_PARSER
ANY
INTERNALS_HANDLER
TYPED_INTERNALS
COMMAND_LINE_ARGUMENTS
COMMAND_LINE_ARGUMENT
CLARG_PARSER
All features
deferred class CLARG_WITH_ARGS [E_]
Summary
top
Direct parents
Inherit list:
COMMAND_LINE_TYPED_ARGUMENT
,
TRAVERSABLE
Insert list:
CLARG_PARSER
Known children
Inherit list:
CLARG_CUSTOMS
,
CLARG_INTEGERS
,
CLARG_STRINGS
Class invariant
top
short /= Void implies short.count = 1
is_optional or else is_positional or else is_mandatory
Overview
top
Exported features
items
: TRAVERSABLE[E_]
The argument value, if
is_set
is_repeatable
:
BOOLEAN
True if the argument is repeatable; False if unique.
is_set
:
BOOLEAN
True if the option is present and correct.
TRAVERSABLE
:
count
:
INTEGER_32
Number of available items in the hoard.
is_empty
:
BOOLEAN
Is the hoard empty ?
See also
count
.
lower
:
INTEGER_32
Minimum index.
upper
:
INTEGER_32
Maximum index.
item
(i:
INTEGER_32
): E_
Item at the corresponding index
i
.
first
: E_
The very
first
item.
last
: E_
The
last
item.
new_iterator
: ITERATOR[E_]
enumerate
: ENUMERATE[E_]
Other features:
get_new_iterator
: ITERATOR[E_]
Agent-based features:
for_each
(action:
PROCEDURE
[
TUPLE
[TUPLE 1[E_]]])
Apply
action
to every item of
Current
.
for_all
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
Do all items satisfy
test
?
exists
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
Does at least one item satisfy
test
?
aggregate
(action:
FUNCTION
[
TUPLE
[TUPLE 2[E_, E_], E_]], initial: E_): E_
Aggregate all the elements starting from the initial value.
Printing:
out_in_tagged_out_memory
Append terse printable representation of current object in
tagged_out_memory
.
generation
:
INTEGER_32
Agent-based features:
do_all
(action:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]])
Apply
action
to every item of
Current
.
Indexing:
valid_index
(i:
INTEGER_32
):
BOOLEAN
True when
i
is valid (i.e., inside actual bounds).
as_mandatory
: CLARG_WITH_ARGS [E_]
Make the option mandatory (default for positionals)
prefix "+"
: CLARG_WITH_ARGS [E_]
Make the option mandatory (default for positionals)
as_optional
: CLARG_WITH_ARGS [E_]
Make the option optional (default for options)
prefix "-"
: CLARG_WITH_ARGS [E_]
Make the option optional (default for options)
is_mandatory
:
BOOLEAN
True if the argument must be set at least once.
is_optional
:
BOOLEAN
True if the argument may not be set.
is_positional
:
BOOLEAN
True if the argument is not introduced by a flag.
can_be_mandatory
:
BOOLEAN
True if the argument can be
set_mandatory
(True).
can_be_optional
:
BOOLEAN
True if the argument can be
set_mandatory
(False).
short
:
FIXED_STRING
The short (one-letter) option flag introducing the argument, Void for positionals
long
:
FIXED_STRING
The long option flag introducing the argument, Void for positionals
usage
:
FIXED_STRING
The option usage
force_index
(a_index:
INTEGER_32
)
Force a positional parameter to be valid only at the given index
infix "or"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments disjunction.
infix "or else"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments disjunction.
infix "and"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments conjunction.
infix "and then"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments conjunction.
prefix "not"
:
COMMAND_LINE_ARGUMENT
(tentative; don't use it, the semantics is not well defined)
name
:
FIXED_STRING
index
:
INTEGER_32
set_data_
(context:
COMMAND_LINE_CONTEXT
, data:
STRING
)
is_valid_data
(data:
STRING
):
BOOLEAN
argument_count
:
INTEGER_32
Number of arguments given to command that started system execution (command name does not count).
argument
(i:
INTEGER_32
):
STRING
i
th argument of command that started system execution Gives the command name if
i
is 0.
command_name
:
STRING
items
: TRAVERSABLE[E_]
effective function
top
The argument value, if
is_set
is_repeatable
:
BOOLEAN
is True
constant attribute
top
True if the argument is repeatable; False if unique.
is_set
:
BOOLEAN
effective function
top
True if the option is present and correct.
count
:
INTEGER_32
effective function
top
Number of available items in the hoard.
See also
is_empty
ensure
Result >= 0
is_empty
:
BOOLEAN
effective function
top
Is the hoard empty ?
See also
count
.
ensure
definition:
Result = count = 0
lower
:
INTEGER_32
effective function
top
Minimum index.
See also
upper
,
valid_index
,
item
.
upper
:
INTEGER_32
effective function
top
Maximum index.
See also
lower
,
valid_index
,
item
.
item
(i:
INTEGER_32
): E_
effective function
top
Item at the corresponding index
i
.
See also
lower
,
upper
,
valid_index
.
require
valid_index(i)
first
: E_
effective function
top
The very
first
item.
See also
last
,
item
.
require
not is_empty
ensure
definition:
Result = item(lower)
last
: E_
effective function
top
The
last
item.
See also
first
,
item
.
require
not is_empty
ensure
definition:
Result = item(upper)
new_iterator
: ITERATOR[E_]
effective function
top
ensure
Result /= Void
Result.generation = generation
enumerate
: ENUMERATE[E_]
effective function
top
get_new_iterator
: ITERATOR[E_]
frozen
effective function
top
This feature is obsolete:
Please use new_iterator instead. This SmartEiffel historic feature is badly named.
for_each
(action:
PROCEDURE
[
TUPLE
[TUPLE 1[E_]]])
effective procedure
top
Apply
action
to every item of
Current
.
See also
for_all
,
exists
,
aggregate
.
require
action /= Void
for_all
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
effective function
top
Do all items satisfy
test
?
See also
for_each
,
exists
,
aggregate
.
require
test /= Void
exists
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
effective function
top
Does at least one item satisfy
test
?
See also
for_each
,
for_all
,
aggregate
.
require
test /= Void
aggregate
(action:
FUNCTION
[
TUPLE
[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
top
Aggregate all the elements starting from the initial value.
See also
for_each
,
for_all
,
exists
.
require
action /= Void
out_in_tagged_out_memory
effective procedure
top
Append terse printable representation of current object in
tagged_out_memory
.
generation
:
INTEGER_32
writable attribute
top
do_all
(action:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]])
frozen
effective procedure
top
Apply
action
to every item of
Current
.
This feature is obsolete:
This feature is not secure because it accepts a FUNCTION, the result of which is lost. Plese use `for_each` instead.
valid_index
(i:
INTEGER_32
):
BOOLEAN
effective function
top
True when
i
is valid (i.e., inside actual bounds).
See also
lower
,
upper
,
item
.
ensure
definition:
Result =
lower
<= i and i <=
upper
as_mandatory
: CLARG_WITH_ARGS [E_]
effective function
top
Make the option mandatory (default for positionals)
require
can_be_mandatory
ensure
Result.
is_mandatory
prefix "+"
: CLARG_WITH_ARGS [E_]
effective function
top
Make the option mandatory (default for positionals)
require
can_be_mandatory
ensure
Result.
is_mandatory
as_optional
: CLARG_WITH_ARGS [E_]
effective function
top
Make the option optional (default for options)
require
can_be_optional
ensure
not Result.
is_mandatory
prefix "-"
: CLARG_WITH_ARGS [E_]
effective function
top
Make the option optional (default for options)
require
can_be_optional
ensure
not Result.
is_mandatory
is_mandatory
:
BOOLEAN
deferred function
top
True if the argument must be set at least once.
ensure
Result implies
can_be_mandatory
is_optional
:
BOOLEAN
deferred function
top
True if the argument may not be set.
ensure
Result implies not
is_positional
is_mandatory
implies not Result
Result implies
can_be_optional
is_positional
:
BOOLEAN
deferred function
top
True if the argument is not introduced by a flag.
Such an argument is mandatory and may have an explicit position on the command line (see
force_index
).
ensure
Result implies not
is_optional
Result implies
is_mandatory
can_be_mandatory
:
BOOLEAN
deferred function
top
True if the argument can be
set_mandatory
(True).
can_be_optional
:
BOOLEAN
deferred function
top
True if the argument can be
set_mandatory
(False).
short
:
FIXED_STRING
deferred function
top
The short (one-letter) option flag introducing the argument, Void for positionals
ensure
is_positional
implies Result = Void
Result /= Void implies Result.count = 1
long
:
FIXED_STRING
deferred function
top
The long option flag introducing the argument, Void for positionals
ensure
is_positional
implies Result = Void
Result /= Void implies not Result.is_empty
usage
:
FIXED_STRING
deferred function
top
The option usage
force_index
(a_index:
INTEGER_32
)
deferred procedure
top
Force a positional parameter to be valid only at the given index
require
a_index > 0
is_positional
not
is_repeatable
infix "or"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
top
Arguments disjunction.
Useful to implement mutually exclusive sets of arguments.
require
other /= Void
ensure
Result /= Void
infix "or else"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
top
Arguments disjunction.
Useful to implement mutually exclusive sets of arguments.
require
other /= Void
ensure
Result /= Void
infix "and"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
top
Arguments conjunction.
All the arguments are checked, in any order.
require
other /= Void
ensure
Result /= Void
infix "and then"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
top
Arguments conjunction.
All the arguments are checked, in any order.
require
other /= Void
ensure
Result /= Void
prefix "not"
:
COMMAND_LINE_ARGUMENT
effective function
top
(tentative; don't use it, the semantics is not well defined)
ensure
Result /= Void
name
:
FIXED_STRING
writable attribute
top
index
:
INTEGER_32
writable attribute
top
set_data_
(context:
COMMAND_LINE_CONTEXT
, data:
STRING
)
effective procedure
top
require
is_valid_data
(data)
is_valid_data
(data:
STRING
):
BOOLEAN
deferred function
top
argument_count
:
INTEGER_32
effective function
top
Number of arguments given to command that started system execution (command name does not count).
ensure
Result >= 0
argument
(i:
INTEGER_32
):
STRING
effective function
top
i
th argument of command that started system execution Gives the command name if
i
is 0.
require
i >= 0
i <=
argument_count
ensure
Result /= Void
command_name
:
STRING
effective function
top