    indexing
    	description: "File name abstraction"
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
    	revision: "$Revision: 56675 $"

    class interface
    	FILE_NAME

    create
    	make
    			-- Create path name object.
    			-- (from PATH_NAME)

    	make_from_string (p: STRING_8)
    			-- Create path name object and initialize it with the
    			-- path name `p'
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			path_not_void: p /= Void
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    	make_temporary_name
    			-- Create a temporary filename.

    create {FILE_NAME}
    	string_make (n: INTEGER_32)
    			-- Allocate space for at least `n' characters.
    			-- (from STRING_8)
    		require -- from STRING_8
    			non_negative_size: n >= 0
    		ensure -- from STRING_8
    			empty_string: count = 0
    			area_allocated: capacity >= n

    feature -- Initialization

    	make
    			-- Create path name object.
    			-- (from PATH_NAME)

    	make_from_string (p: STRING_8)
    			-- Create path name object and initialize it with the
    			-- path name `p'
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			path_not_void: p /= Void
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    feature {ANY} -- Access

    	string: STRING_8
    			-- New STRING having same character sequence as `Current'.
    			-- (from STRING_8)
    		ensure -- from STRING_8
    			string_not_void: Result /= Void
    			string_type: Result.same_type ("")
    			first_item: count > 0 implies Result.item (1) = item (1)
    			recurse: count > 1 implies Result.substring (2, count).is_equal (substring (2, count).string)

    feature -- Comparison

    	is_equal (other: like Current): BOOLEAN
    			-- Is the path name equal to `other'?
    			-- (from PATH_NAME)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			symmetric: Result implies other.is_equal (Current)
    			consistent: standard_is_equal (other) implies Result
    		ensure then -- from COMPARABLE
    			trichotomy: Result = (not (Current < other) and not (other < Current))

    feature -- Status report

    	is_directory_name_valid (dir_name: STRING_8): BOOLEAN
    			-- Is `dir_name' a valid subdirectory part for the operating system?
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			exists: dir_name /= Void

    	is_extension_valid (ext: STRING_8): BOOLEAN
    			-- Is `ext' a valid extension for the operating system?

    	is_file_name_valid (f_name: STRING_8): BOOLEAN
    			-- Is `f_name' a valid file name part for the operating system?

    	is_valid: BOOLEAN
    			-- Is the file name valid for the operating system?

    	is_volume_name_valid (vol_name: STRING_8): BOOLEAN
    			-- Is `vol_name' a valid volume name for the operating system?
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			exists: vol_name /= Void

    feature {ANY} -- Status report

    	is_empty: BOOLEAN
    			-- Is structure empty?
    			-- (from FINITE)
    		require -- from  CONTAINER
    			True
    		require -- from  STRING_GENERAL
    			True

    	prunable: BOOLEAN
    			-- May items be removed? (Answer: yes.)
    			-- (from STRING_8)

    feature -- Status setting

    	add_extension (ext: STRING_8)
    			-- Append the extension `ext' to the file name
    		require
    			string_exists: ext /= Void
    			non_empty_extension: not ext.is_empty
    			valid_extension: is_extension_valid (ext)

    	extend (directory_name: STRING_8)
    			-- Append the subdirectory `directory_name' to the path name.
    			-- Was declared in PATH_NAME as synonym of set_subdirectory.
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			string_exists: directory_name /= Void
    			valid_directory_name: is_directory_name_valid (directory_name)
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    	extend_from_array (directories: ARRAY [STRING_8])
    			-- Append the subdirectories from `directories' to the path name.
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			array_exists: directories /= Void and then not (directories.is_empty)
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    	set_directory (directory_name: STRING_8)
    			-- Set the absolute directory part of the path name to `directory_name'.
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			string_exists: directory_name /= Void
    			valid_directory_name: is_directory_name_valid (directory_name)
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    	set_file_name (file_name: STRING_8)
    			-- Set the value of the file name part.
    		require
    			string_exists: file_name /= Void
    			valid_file_name: is_file_name_valid (file_name)
    		ensure
    			valid_file_name: is_valid

    	set_subdirectory (directory_name: STRING_8)
    			-- Append the subdirectory `directory_name' to the path name.
    			-- Was declared in PATH_NAME as synonym of extend.
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			string_exists: directory_name /= Void
    			valid_directory_name: is_directory_name_valid (directory_name)
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    	set_volume (volume_name: STRING_8)
    			-- Set the volume part of the path name to `volume_name'.
    			-- (from PATH_NAME)
    		require -- from PATH_NAME
    			string_exists: volume_name /= Void
    			valid_volume_name: is_volume_name_valid (volume_name)
    			empty_path_name: is_empty
    		ensure -- from PATH_NAME
    			valid_file_name: is_valid

    feature {ANY} -- Removal

    	wipe_out
    			-- Remove all characters.
    			-- (from STRING_8)
    		require -- from COLLECTION
    			prunable: prunable
    		ensure -- from COLLECTION
    			wiped_out: is_empty
    		ensure then -- from STRING_8
    			is_empty: count = 0
    			empty_capacity: capacity = 0

    feature {ANY} -- Conversion

    	frozen to_c: ANY
    			-- A reference to a C form of current string.
    			-- Useful only for interfacing with C software.
    			-- (from STRING_8)
    		require -- from STRING_8
    			not_is_dotnet: not {PLATFORM}.is_dotnet

    feature {ANY} -- Duplication

    	frozen twin: like Current
    			-- New object equal to `Current'
    			-- twin calls copy; to change copying/twining semantics, redefine copy.
    			-- (from ANY)
    		ensure -- from ANY
    			twin_not_void: Result /= Void
    			is_equal: Result.is_equal (Current)

    feature {ANY} -- Output

    	out: STRING_8
    			-- Printable representation
    			-- (from STRING_8)
    		require -- from  ANY
    			True
    		ensure then -- from STRING_8
    			out_not_void: Result /= Void
    			same_items: same_type ("") implies Result.same_string (Current)

    invariant
    		-- from STRING_8
    	extendible: extendible
    	compare_character: not object_comparison
    	index_set_has_same_count: index_set.count = count
    	area_not_void: area /= Void

    		-- from COMPARABLE
    	irreflexive_comparison: not (Current < Current)

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

    		-- from INDEXABLE
    	index_set_not_void: index_set /= Void

    		-- from RESIZABLE
    	increase_by_at_least_one: minimal_increase >= 1

    		-- from BOUNDED
    	valid_count: count <= capacity
    	full_definition: full = (count = capacity)

    		-- from FINITE
    	empty_definition: is_empty = (count = 0)
    	non_negative_count: count >= 0

    indexing
    	library: "EiffelBase: Library of reusable components for Eiffel."
    	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
    	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
    	source: "[
    		Eiffel Software
    		356 Storke Road, 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 FILE_NAME