elogger API
Overview Classes Cluster Class Index          Top Features

string.formatter.general

Class ST_SCIENTIFIC_FORMATTER


Direct ancestors

ST_FORMATTER

Creation

Features

Invariants

indexing

description

C-like formatters that receive a string and parameters
as input and return the formatted output.

usage

Inherit from ST_FORMATTING_ROUTINES and use its format routines.

library

Gobo Eiffel String Library

copyright

Copyright (c) 2004-2005, Object-Tools and others

license

Eiffel Forum License v2 (see forum.txt)

class ST_SCIENTIFIC_FORMATTER

inherit

ST_FORMATTER

create

make

-- Create new formatter with default escape character '$'.
-- (From ST_FORMATTER)

ensure

escape_character_set: escape_character = '$'

make_with_escape (c: CHARACTER)

-- Create new scientific formatter with c as escape character.
-- (From ST_FORMATTER)

ensure

escape_character_set: escape_character = c

feature -- Status report

valid_format_and_parameters (a_format: STRING; a_parameters: ARRAY[ANY]): BOOLEAN

-- Does a_format contain valid formatting specifications and
-- do a_parameters comply to these formatting specifications?
-- (From ST_FORMATTER)

require

a_format_not_void: a_format /= Void

ensure

no_void_parameter: Result implies (a_parameters = Void or else not ANY_ARRAY_.has (a_parameters, Void))

feature -- Formatting

format (a_format: STRING; a_parameters: ARRAY[ANY]): STRING

-- Copy of a_format where the formatting specifications
-- have been replaced by their corresponding formatted
-- parameters from a_parameters
--
-- (a_parameters must be an array of references and should
-- not contain expanded types. SE will core dump if you try
-- to do that. Furthermore, in SE 2.1 expanded types such as
-- INTEGER_32 do not conform to ANY anymore. So, instead of
-- expanded parameters such as INTEGER_32 we should pass a
-- 'DS_CELL [INTEGER_32]'.)
-- (From ST_FORMATTER)

require

a_format_not_void: a_format /= Void
valid_format_and_parameters: valid_format_and_parameters (a_format, a_parameters)

ensure

formatted_string_not_void: Result /= Void
same_type: ANY_.same_types (a_format, Result)

format_single (a_format: STRING; a_parameter: ANY): STRING

-- Copy of a_format where the single formatting specification
-- have been replaced by formatted version of a_parameter
--
-- (In SE 2.1 expanded types such as INTEGER_32 do not conform
-- to ANY anymore. So, instead of expanded parameters such
-- as INTEGER_32 we should pass a 'DS_CELL [INTEGER_32]'.)
-- (From ST_FORMATTER)

require

a_format_not_void: a_format /= Void
valid_format_and_parameters: valid_format_and_parameters (a_format, <<a_parameter>>)

ensure

formatted_string_not_void: Result /= Void
same_type: ANY_.same_types (a_format, Result)

format_to (a_format: STRING; a_parameters: ARRAY[ANY]; a_stream: KI_CHARACTER_OUTPUT_STREAM)

-- Append to a_stream the string a_format where the
-- formatting specifications have been replaced by their
-- corresponding formatted parameters from a_parameters.
--
-- (a_parameters must be an array of references and should
-- not contain expanded types. SE will core dump if you try
-- to do that. Furthermore, in SE 2.1 expanded types such as
-- INTEGER_32 do not conform to ANY anymore. So, instead of
-- expanded parameters such as INTEGER_32 we should pass a
-- 'DS_CELL [INTEGER_32]'.)
-- (From ST_FORMATTER)

require

a_format_not_void: a_format /= Void
valid_format_and_parameters: valid_format_and_parameters (a_format, a_parameters)
a_stream_not_void: a_stream /= Void
a_stream_open_write: a_stream.is_open_write

invariant

boolean_formatter_not_void: boolean_formatter /= Void
character_formatter_not_void: character_formatter /= Void
floating_point_formatter_not_void: floating_point_formatter /= Void
fixed_point_formatter_not_void: fixed_point_formatter /= Void
fixed_or_floating_point_formatter_not_void: fixed_or_floating_point_formatter /= Void
decimal_formatter_not_void: decimal_formatter /= Void
octal_formatter_not_void: octal_formatter /= Void
hexadecimal_formatter_not_void: hexadecimal_formatter /= Void
unsigned_decimal_formatter_not_void: unsigned_decimal_formatter /= Void
pointer_formatter_not_void: pointer_formatter /= Void
string_formatter_not_void: string_formatter /= Void

-- From ST_FORMATTER
string_output_stream_not_void: string_output_stream /= Void
single_parameter_not_void: single_parameter /= Void
single_parameter_count: single_parameter.count = 1
single_parameter_lower: single_parameter.lower = 1

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

Documentation generated by edoc