indexing
description: "Formatter for integral numbers"
status: "See notice at end of class"
names: format_integer
date: "$Date$"
revision: "$Revision$"
class interface
FORMAT_INTEGER
create
make (w: INTEGER)
require
reasonable_field: w >= 1
ensure
blank_fill: fill_character = ' '
show_sign_negative: show_sign_negative
no_separator: no_separator
width_set: width = w
right_justified: right_justified
leading_sign: leading_sign
feature
make (w: INTEGER)
require
reasonable_field: w >= 1
ensure
blank_fill: fill_character = ' '
show_sign_negative: show_sign_negative
no_separator: no_separator
width_set: width = w
right_justified: right_justified
leading_sign: leading_sign
feature
bracketted_negative: BOOLEAN
fill_character: CHARACTER
justification: INTEGER
separator: CHARACTER
sign_format: INTEGER
sign_string: STRING
trailing_sign: BOOLEAN
width: INTEGER
feature
centered: BOOLEAN
ensure
Result = (justification = center_justification)
ignore_sign: BOOLEAN
ensure
Result = (sign_format = ignore_sign_value)
leading_sign: BOOLEAN
ensure
Result = not trailing_sign
left_justified: BOOLEAN
ensure
Result = (justification = left_justification)
no_separator: BOOLEAN
ensure
Result = (separator = '%U')
not_justified: BOOLEAN
ensure
Result = (justification = no_justification)
right_justified: BOOLEAN
ensure
Result = (justification = right_justification)
show_sign: BOOLEAN
ensure
Result = (sign_format = show_sign_value)
show_sign_negative: BOOLEAN
ensure
Result = (sign_format = sign_negative_value)
show_sign_positive: BOOLEAN
ensure
Result = (sign_format = sign_positive_value)
feature
asterisk_fill
ensure
fill_character = '*'
blank_fill
ensure
fill_character = ' '
bracket_negative
ensure
bracketted_negative
center_justify
ensure
centered
comma_separate
ensure
separator = ','
dollar_fill
ensure
fill_character = '$'
dot_separate
ensure
separator = '.'
left_justify
ensure
left_justified
no_justify
ensure
not_justified
remove_separator
ensure
separator = '%U'
right_justify
ensure
right_justified
set_fill (c: CHARACTER)
c
ensure
fill_character = c
set_separator (c: CHARACTER)
c
ensure
separator = c
set_sign (s: STRING)
require
s /= void
s.count >= 3
s.count \\ 3 = 0
ensure
sign_string.is_equal (s)
set_width (w: INTEGER)
w
require
wide_enough: w >= 1
ensure
width = w
sign_cr_dr
ensure
sign_string.is_equal ("CR DR")
sign_dr_cr
ensure
sign_string.is_equal ("DR CR")
sign_floating_dollar
ensure
sign_string.is_equal ("$$$")
sign_floating_dollar_signed
ensure
sign_string.is_equal ("-$ $+$")
sign_ignore
ensure
ignore_sign
sign_leading
ensure
leading_sign
sign_negative_only
ensure
show_sign_negative
sign_normal
ensure
sign_string.is_equal ("- +")
sign_positive_only
ensure
show_sign_positive
sign_show
ensure
show_sign
sign_trailing
ensure
trailing_sign
unbracket_negative
ensure
not bracketted_negative
underscore_separate
ensure
separator = '_'
zero_fill
ensure
fill_character = '0'
feature
formatted (i: INTEGER): STRING
ensure
exists: Result /= void
correct_length: not_justified or Result.count >= width
invariant
sign_string_constraint: sign_string /= void
wide_enough: width >= 1
no_justification <= justification and justification <= right_justification
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
indexing
library: "[
EiffelBase: Library of reusable components for Eiffel.
]"
status: "[
Copyright 1986-2001 Interactive Software Engineering (ISE).
For ISE customers the original versions are an ISE product
covered by the ISE Eiffel license and support agreements.
]"
license: "[
EiffelBase may now be used by anyone as FREE SOFTWARE to
develop any product, public-domain or commercial, without
payment to ISE, under the terms of the ISE Free Eiffel Library
License (IFELL) at http://eiffel.com/products/base/license.html.
]"
source: "[
Interactive Software Engineering Inc.
ISE Building
360 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Electronic mail <info@eiffel.com>
Customer support http://support.eiffel.com
]"
info: "[
For latest info see award-winning pages: http://eiffel.com
]"
end -- FORMAT_INTEGER