GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
DIRECTORY
+
Point of view
All features
ANY
DIRECTORY
RECYCLING_POOL
STRING_HANDLER
ABSTRACT_STRING
STRING_RECYCLING_POOL
FILE
All features
class DIRECTORY
Summary
top
Tools for file-system directory handling. High-level facade for class
BASIC_DIRECTORY
.
Direct parents
Inherit list:
FILE
,
TRAVERSABLE
Insert list:
DIRECTORY_NOTATION_HANDLER
Class invariant
top
path
/= Void
exists
implies
name_list
/= Void and then
collection_sorter
.is_sorted(
name_list
)
not
exists
implies
is_empty
name /= Void
path /= Void
Overview
top
Creation features
{
ANY
}
scan
(directory_path:
ABSTRACT_STRING
)
Scans some existing
directory_path
which is supposed to be a correctly spelled directory path.
scan_current_working_directory
Scans the current working directory.
Features
{
ANY
}
name
:
FIXED_STRING
The directory short name.
path
:
FIXED_STRING
The directory path in use (see
scan
).
is_directory
:
BOOLEAN
is_regular
:
BOOLEAN
as_directory
: DIRECTORY
as_regular
:
REGULAR_FILE
exists
:
BOOLEAN
has_file
(a_file_name:
ABSTRACT_STRING
):
BOOLEAN
file
(a_file_name:
ABSTRACT_STRING
):
FILE
file_at
(index:
INTEGER_32
):
FILE
Disk access:
{}
connect_directory
(directory_path:
ABSTRACT_STRING
):
FIXED_STRING
connect_current_directory
:
FIXED_STRING
scan
(directory_path:
ABSTRACT_STRING
)
Scans some existing
directory_path
which is supposed to be a correctly spelled directory path.
scan_current_working_directory
Scans the current working directory.
Access:
{
ANY
}
lower
:
INTEGER_32
Index of the first item.
upper
:
INTEGER_32
Index of the last item.
count
:
INTEGER_32
Number of items (files or directories) in Current.
is_empty
:
BOOLEAN
Is the hoard empty ?
See also
count
.
first
:
FIXED_STRING
The very
first
item.
last
:
FIXED_STRING
The
last
item.
item
(index:
INTEGER_32
):
FIXED_STRING
Return the name of entry (file or subdirectory) at
index
.
has
(entry_name:
ABSTRACT_STRING
):
BOOLEAN
Does Current contain the
entry_name
(file or subdirectory) ?
new_iterator
:
ITERATOR
[
FIXED_STRING
]
File access:
{
ANY
}
connect_to_file_stream
(file_stream:
FILE_STREAM
, filename:
STRING
)
Connect the
file
to the operating system file given by its
filename
.
{
FILE
}
set_file
(a_file_name:
ABSTRACT_STRING
, a_file:
FILE
)
file_set
(a_file_name:
ABSTRACT_STRING
):
BOOLEAN
{}
case_canonical_filename
(a_file_name:
ABSTRACT_STRING
):
FIXED_STRING
path_buffer
:
STRING
collection_sorter
:
COLLECTION_SORTER
[
FIXED_STRING
]
files
:
DICTIONARY
[
FILE
,
FIXED_STRING
]
name_list
:
FAST_ARRAY
[
FIXED_STRING
]
Actual list of entries (files or subdirectories).
create_file
(a_file_name:
FIXED_STRING
):
FILE
file_tools
:
FILE_TOOLS
{
ANY
}
parent
: DIRECTORY
{
DIRECTORY
}
set_parent
(a_parent: DIRECTORY)
{}
parent_memory
: DIRECTORY
basic_directory
:
BASIC_DIRECTORY
Provide low level access to directories.
{
ANY
}
enumerate
: ENUMERATE[E_]
Other features:
{
ANY
}
get_new_iterator
: ITERATOR[E_]
Agent-based features:
{
ANY
}
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
?
aggregate
(action:
FUNCTION
[
TUPLE
[TUPLE 2[E_, E_], E_]], initial: E_): E_
Aggregate all the elements starting from the initial value.
Printing:
{
ANY
}
out_in_tagged_out_memory
Append terse printable representation of current object in
tagged_out_memory
.
{
ANY
}
generation
:
INTEGER_32
{}
next_generation
Agent-based features:
{
ANY
}
do_all
(action:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]])
Apply
action
to every item of
Current
.
{}
_inline_agent1
(a:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]], e: E_)
Indexing:
{
ANY
}
valid_index
(i:
INTEGER_32
):
BOOLEAN
True when
i
is valid (i.e., inside actual bounds).
name
:
FIXED_STRING
writable attribute
{
ANY
}
top
The directory short name.
path
:
FIXED_STRING
writable attribute
{
ANY
}
top
The directory path in use (see
scan
).
is_directory
:
BOOLEAN
is True
constant attribute
{
ANY
}
top
is_regular
:
BOOLEAN
is False
constant attribute
{
ANY
}
top
as_directory
: DIRECTORY
effective function
{
ANY
}
top
require
is_directory
ensure
Result = Current
as_regular
:
REGULAR_FILE
effective function
{
ANY
}
top
require
is_regular
ensure
Result = Current
exists
:
BOOLEAN
writable attribute
{
ANY
}
top
has_file
(a_file_name:
ABSTRACT_STRING
):
BOOLEAN
effective function
{
ANY
}
top
file
(a_file_name:
ABSTRACT_STRING
):
FILE
effective function
{
ANY
}
top
require
has_file
(a_file_name)
file_at
(index:
INTEGER_32
):
FILE
effective function
{
ANY
}
top
require
valid_index
(index)
connect_directory
(directory_path:
ABSTRACT_STRING
):
FIXED_STRING
effective function
{}
top
connect_current_directory
:
FIXED_STRING
effective function
{}
top
scan
(directory_path:
ABSTRACT_STRING
)
effective procedure
{}
top
Scans some existing
directory_path
which is supposed to be a correctly spelled directory path.
See also
scan_current_working_directory
.
require
not directory_path.is_empty
scan_current_working_directory
effective procedure
{}
top
Scans the current working directory.
See also
scan
.
lower
:
INTEGER_32
is 1
constant attribute
{
ANY
}
top
Index of the first item.
upper
:
INTEGER_32
effective function
{
ANY
}
top
Index of the last item.
count
:
INTEGER_32
effective function
{
ANY
}
top
Number of items (files or directories) in Current.
ensure
Result >= 0
is_empty
:
BOOLEAN
effective function
{
ANY
}
top
Is the hoard empty ?
See also
count
.
ensure
definition:
Result = count = 0
first
:
FIXED_STRING
effective function
{
ANY
}
top
The very
first
item.
See also
last
,
item
.
require
not is_empty
ensure
definition:
Result = item(lower)
last
:
FIXED_STRING
effective function
{
ANY
}
top
The
last
item.
See also
first
,
item
.
require
not is_empty
ensure
definition:
Result = item(upper)
item
(index:
INTEGER_32
):
FIXED_STRING
effective function
{
ANY
}
top
Return the name of entry (file or subdirectory) at
index
.
require
valid_index(index)
ensure
has
(Result)
has
(entry_name:
ABSTRACT_STRING
):
BOOLEAN
effective function
{
ANY
}
top
Does Current contain the
entry_name
(file or subdirectory) ?
require
not entry_name.is_empty
new_iterator
:
ITERATOR
[
FIXED_STRING
]
effective function
{
ANY
}
top
ensure
Result /= Void
Result.generation = generation
connect_to_file_stream
(file_stream:
FILE_STREAM
, filename:
STRING
)
effective procedure
{
ANY
}
top
Connect the
file
to the operating system file given by its
filename
.
require
not file_stream.is_connected
set_file
(a_file_name:
ABSTRACT_STRING
, a_file:
FILE
)
effective procedure
{
FILE
}
top
require
not
file_set
(a_file_name)
ensure
file
(a_file_name) = a_file
file_set
(a_file_name:
ABSTRACT_STRING
):
BOOLEAN
effective function
{
FILE
}
top
case_canonical_filename
(a_file_name:
ABSTRACT_STRING
):
FIXED_STRING
effective function
{}
top
path_buffer
:
STRING
once function
{}
top
collection_sorter
:
COLLECTION_SORTER
[
FIXED_STRING
]
writable attribute
{}
top
files
:
DICTIONARY
[
FILE
,
FIXED_STRING
]
writable attribute
{}
top
name_list
:
FAST_ARRAY
[
FIXED_STRING
]
writable attribute
{}
top
Actual list of entries (files or subdirectories).
create_file
(a_file_name:
FIXED_STRING
):
FILE
effective function
{}
top
require
not
file_set
(a_file_name)
file_tools
:
FILE_TOOLS
writable attribute
{}
top
parent
: DIRECTORY
frozen
effective function
{
ANY
}
top
set_parent
(a_parent: DIRECTORY)
effective procedure
{
DIRECTORY
}
top
ensure
parent
= a_parent
parent_memory
: DIRECTORY
writable attribute
{}
top
basic_directory
:
BASIC_DIRECTORY
writable attribute
{}
top
Provide low level access to directories.
enumerate
: ENUMERATE[E_]
effective function
{
ANY
}
top
get_new_iterator
: ITERATOR[E_]
frozen
effective function
{
ANY
}
top
This feature is obsolete:
Use `new_iterator' instead. This historical SmartEiffel feature is badly named.
for_each
(action:
PROCEDURE
[
TUPLE
[TUPLE 1[E_]]])
effective procedure
{
ANY
}
top
Apply
action
to every item of
Current
.
See also
for_all
,
exists_that
,
aggregate
.
require
action /= Void
for_all
(test:
FUNCTION
[
TUPLE
[TUPLE 1[E_]]]):
BOOLEAN
effective function
{
ANY
}
top
Do all items satisfy
test
?
See also
for_each
,
exists_that
,
aggregate
.
require
test /= Void
aggregate
(action:
FUNCTION
[
TUPLE
[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
{
ANY
}
top
Aggregate all the elements starting from the initial value.
See also
for_each
,
for_all
,
exists_that
.
require
action /= Void
out_in_tagged_out_memory
effective procedure
{
ANY
}
top
Append terse printable representation of current object in
tagged_out_memory
.
require
locked:
tagged_out_locked
ensure
still_locked:
tagged_out_locked
not_cleared:
tagged_out_memory.count >= old tagged_out_memory.count
append_only:
old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
generation
:
INTEGER_32
writable attribute
{
ANY
}
top
next_generation
effective procedure
{}
top
ensure
generation
> old
generation
do_all
(action:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]])
frozen
effective procedure
{
ANY
}
top
Apply
action
to every item of
Current
.
This feature is obsolete:
Use `for_each` instead. This feature is not secure because it accepts a FUNCTION, the result of which is lost.
_inline_agent1
(a:
ROUTINE
[
TUPLE
[TUPLE 1[E_]]], e: E_)
frozen
effective procedure
{}
top
valid_index
(i:
INTEGER_32
):
BOOLEAN
effective function
{
ANY
}
top
True when
i
is valid (i.e., inside actual bounds).
See also
lower
,
upper
,
item
.
ensure
definition:
Result =
lower
<= i and i <=
upper