Top
TEXT_FILE_READ_WRITE
TIME
class interface TEXT_FILE_WRITE
--
-- Basic output facilities to write a named file on the disk.
--
-- Note: most features are common with STD_OUTPUT so you can test your
-- program first on the screen and then, changing of instance
-- (STD_OUTPUT/TEXT_FILE_WRITE), doing the same on a file.
--
creation
make
-- The new created object is not connected. (See also connect_to and
-- connect_for_appending_to.)
ensure
not is_connected
connect_to (new_path: STRING)
-- Truncate file to zero length or create text file for writing.
-- The stream is positioned at the beginning of the file.
require
not is_connected;
not new_path.is_empty
connect_for_appending_to (new_path: STRING)
-- Open for writing. The file is created if it does not exist.
-- The stream is positioned at the end of the file.
require
not is_connected;
not new_path.is_empty
feature(s) from OUTPUT_STREAM
-- State of the stream:
is_connected: BOOLEAN
-- Is this file connected to some file of the operating system?
feature(s) from OUTPUT_STREAM
-- To write one character at a time:
put_character (c: CHARACTER)
require
is_connected
feature(s) from OUTPUT_STREAM put_string (s: STRING)
-- Output s to current output device.
require
is_connected;
s /= Void
put_unicode_string (unicode_string: UNICODE_STRING)
-- Output the UTF-8 encoding of the unicode_string.
require
unicode_string /= Void
feature(s) from OUTPUT_STREAM
-- To write a number:
put_integer (i: INTEGER_64)
-- Output i to current output device.
require
is_connected
put_integer_format (i: INTEGER_64; s: INTEGER)
-- Output i to current output device using at most s character.
require
is_connected
put_real (r: REAL)
-- Output r to current output device.
require
is_connected
put_real_format (r: REAL; f: INTEGER)
-- Output r with only f digit for the fractionnal part.
-- Examples:
-- put_real(3.519,2) print "3.51".
require
is_connected;
f >= 0
put_double (d: DOUBLE)
-- Output d to current output device.
require
is_connected
put_double_format (d: DOUBLE; f: INTEGER)
-- Output d with only f digit for the fractionnal part.
-- Examples:
-- put_double(3.519,2) print "3.51".
require
is_connected;
f >= 0
put_number (number: NUMBER)
-- Output the number.
require
number /= Void
feature(s) from OUTPUT_STREAM
-- Other features:
put_boolean (b: BOOLEAN)
-- Output b to current output device according
-- to the Eiffel format.
require
is_connected
put_pointer (p: POINTER)
-- Output a viewable version of p.
require
is_connected
put_new_line
-- Output a newline character.
require
is_connected
put_spaces (nb: INTEGER)
-- Output nb spaces character.
require
nb >= 0
append_file (file_name: STRING)
require
is_connected;
file_exists(file_name)
flush
-- forces a write of unwritten character (write my have been
-- delayed, flush writes buffered characters)
feature(s) from MEMORY
-- Garbage collector information and tuning:
collecting: BOOLEAN
-- Is garbage collection enabled?
collection_off
-- Disable garbage collection.
collection_on
-- Enable garbage collection.
full_collect
-- Force a full collection cycle if garbage collection is
-- enabled (i.e. collecting is true); do nothing otherwise.
collector_counter: INTEGER
-- The number of collections actually performed or -1 when the
-- system is not using the SmartEiffel garbage collector (i.e. when
-- the system is compiled using the -no_gc flag).
ensure
Result >= -1
feature(s) from MEMORY
-- SmartEiffel Garbage collector information and tuning:
small_eiffel_collector: BOOLEAN
-- Is the SmartEiffel garbage collector really used?
ensure
Result = (collector_counter >= 0)
low_memory_strategy: BOOLEAN
-- Is the low memory strategy in use? When this strategy is used,
-- the garbage collector try to use as few memory as possible.
require
small_eiffel_collector
set_low_memory_strategy
require
small_eiffel_collector
ensure
low_memory_strategy
high_memory_strategy: BOOLEAN
-- Is the high memory strategy in use? When this strategy is used,
-- the garbage collector assume that more memory can be allocated
-- if necessary.
require
small_eiffel_collector
set_high_memory_strategy
require
small_eiffel_collector
ensure
high_memory_strategy
default_memory_strategy: BOOLEAN
-- Is the default memory strategy in use? This is the default initial
-- mode for the garbage collector (somewhere between low_memory_strategy
-- and high_memory_strategy).
require
small_eiffel_collector
set_default_memory_strategy
require
small_eiffel_collector
ensure
default_memory_strategy
allocated_bytes: INTEGER
-- Total number of allocated bytes of memory in the heap.
require
collector_counter >= 0
feature(s) from MEMORY
-- Other features:
pointer_size: INTEGER
-- The size in number of bytes for a pointer.
feature(s) from FILE connect_to (new_path: STRING)
-- Truncate file to zero length or create text file for writing.
-- The stream is positioned at the beginning of the file.
require
not is_connected;
not new_path.is_empty
disconnect
-- Disconnect from any file.
require
is_connected
ensure
not is_connected
feature(s) from TEXT_FILE_WRITE path: STRING
-- Not Void when connected to the corresponding file
-- on the disk.
connect_for_appending_to (new_path: STRING)
-- Open for writing. The file is created if it does not exist.
-- The stream is positioned at the end of the file.
require
not is_connected;
not new_path.is_empty
end of TEXT_FILE_WRITE
All classes inherit from ANY, ANY inherits from
PLATFORM
and PLATFORM inherits from GENERAL.
Generated by short -html_deb on 31 March 2005.