note
	description: "Abstract convertor for string to number conversion"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2012-05-24 04:13:10 +0000 (Thu, 24 May 2012) $"
	revision: "$Revision: 91981 $"

deferred class interface
	STRING_TO_NUMERIC_CONVERTOR

feature -- Status reporting

	trailing_separators_acceptable: BOOLEAN
			-- Are trailing separators acceptable?

	leading_separators_acceptable: BOOLEAN
			-- Are leading separators acceptable?

	leading_separators: STRING_8
			-- Leading separators

	trailing_separators: STRING_8
			-- Trailing separators

	separators_valid (separators: STRING_8): BOOLEAN
			-- Are separators valid?
		require
			separators_not_void: separators /= Void

	conversion_type_valid (type: INTEGER_32): BOOLEAN
			-- Is type to which string will be converted valid?
			-- See NUMERIC_INFORMATION for more information.

	overflowed: BOOLEAN
			-- Is number overflowed (too large)?

	underflowed: BOOLEAN
			-- Is number underflowed (too small)?

	parse_successful: BOOLEAN
			-- Is parse so far successful?

	conversion_type: INTEGER_32
			-- Type to which a string will be converted
			-- See NUMERIC_INFORMATION for more information.
	
feature -- Reset

	reset (type: INTEGER_32)
			-- Reset this convertor to start a new parse session
			-- and get ready for parsing integer of type.
			-- Always call this feature before every new parse session.
			-- See NUMERIC_INFORMATION for more information about type.			
		require
			type_valid: conversion_type_valid (type)
		ensure
			last_state_set: last_state = 0
			sign_set: sign = 0
			conversion_type_set: conversion_type = type
			not_overflowed: not overflowed
			not_underflowed: not underflowed
			parse_successful: parse_successful
	
feature -- Status setting

	set_trailing_separators_acceptable (b: BOOLEAN)
			-- Set trailing_separators_acceptable to b.
		ensure
			trailing_separators_acceptable_set: trailing_separators_acceptable = b

	set_leading_separators_acceptable (b: BOOLEAN)
			-- Set leading_separators_acceptable to b.
		ensure
			leading_separators_acceptable_set: leading_separators_acceptable = b

	set_leading_separators (separators: STRING_8)
			-- Set leading_separators with separators.
		require
			separators_not_void: separators /= Void
			separators_valid: separators_valid (separators)
		ensure
			leading_separators_set: leading_separators ~ separators

	set_trailing_separators (separators: STRING_8)
			-- Set trailing_separators with separators.
		require
			separators_not_void: separators /= Void
			separators_valid: separators_valid (separators)
		ensure
			trailing_separators_set: trailing_separators ~ separators
	
feature -- Parse

	parse_string_with_type (s: READABLE_STRING_GENERAL; type: INTEGER_32)
			-- reset convertor to start a new parse session and
			-- parse s to see if it is a number of type.
			-- Make result available in overflowed, underflowed and parse_successful.
			-- See NUMERIC_INFORMATION for more information about type.
		require
			s_not_void: s /= Void
			type_valid: conversion_type_valid (type)

	parse_character (c: CHARACTER_8)
			-- Parse c in current parse session.
			-- Make result available in overflowed, underflowed and parse_successful.			
	
invariant
	leading_separators_not_void: leading_separators /= Void
	trailing_separators_not_void: trailing_separators /= Void

note
	copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class STRING_TO_NUMERIC_CONVERTOR

Generated by ISE EiffelStudio