note
	description: "Parser facility for dates and times"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2017-03-29 12:26:46 +0000 (Wed, 29 Mar 2017) $"
	revision: "$Revision: 100065 $"

class interface
	DATE_TIME_PARSER

create 
	make

feature -- Access

	source_string: detachable STRING_8
			-- String to be parsed

	year: INTEGER_32
			-- Year part of source_string
		require
			value_parsed: parsed

	month: INTEGER_32
			-- Month part of source_string
		require
			value_parsed: parsed

	day: INTEGER_32
			-- Day part of source_string
		require
			value_parsed: parsed

	hour: INTEGER_32
			-- Hour part of source_string
		require
			value_parsed: parsed

	minute: INTEGER_32
			-- Minute part of source_string
		require
			value_parsed: parsed

	fine_second: REAL_64
			-- Seconds part of source_string
		require
			value_parsed: parsed

	day_text: detachable STRING_8
			-- Text representation of day
		require
			value_parsed: parsed
	
feature -- Status report

	parsed: BOOLEAN
			-- Has source_string been parsed?

	is_set_up: BOOLEAN
			-- Has parser been set up completely?

	is_date: BOOLEAN
			-- Does source_string contain a DATE?
		require
			string_parsed: parsed

	is_time: BOOLEAN
			-- Does source_string contain a TIME?
		require
			string_parsed: parsed

	is_date_time: BOOLEAN
			-- Does source_string contain a DATE_TIME?
		require
			string_parsed: parsed

	is_value_valid: BOOLEAN
			-- Is parsed value valid?
	
feature -- Status setting

	set_source_string (s: STRING_8)
			-- Assign s to source_string.
		require
			non_empty_string: s /= Void and then not s.is_empty
		ensure
			source_set: source_string = s
			not_parsed: not parsed

	set_day_array (d: ARRAY [STRING_8])
			-- Set day array to d.
		require
			not_void: d /= Void
		ensure
			days_set: days = d

	set_month_array (m: ARRAY [STRING_8])
			-- Set month array to m.
		require
			not_void: m /= Void
		ensure
			months_set: months = m

	set_base_century (c: INTEGER_32)
			-- Set base century to c.
		require
			base_century_valid: c /= 0 and (c \\ 100 = 0)
		ensure
			base_century_set: base_century = c
	
feature -- Basic operations

	parse
			-- Parse source_string.
		require
			setup_complete: is_set_up
		ensure
			string_parsed: parsed
	
invariant
	valid_value_definition: is_value_valid = (parsed and then (is_date or is_time or is_date_time))
	valid_value_implies_parsing: is_value_valid implies parsed

note
	copyright: "Copyright (c) 1984-2017, 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 DATE_TIME_PARSER

Generated by ISE EiffelStudio