indexing
	description: "File name abstraction"
	status: "See notice at end of class"
	date: "$Date$"
	revision: "$Revision$"

class interface
	FILE_NAME

create 

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

	make_from_string (p: STRING)
			-- Create path name object and initialize it with the
			-- path name p
			-- (from PATH_NAME)
		ensure -- from PATH_NAME
			valid_file_name: is_valid

	make_temporary_name
			-- Create a temporary filename.

feature -- Initialization

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

	make_from_string (p: STRING)
			-- Create path name object and initialize it with the
			-- path name p
			-- (from PATH_NAME)
		ensure -- from PATH_NAME
			valid_file_name: is_valid
	
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): 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): BOOLEAN
			-- Is ext a valid extension for the operating system?

	is_file_name_valid (f_name: STRING): 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): BOOLEAN
			-- Is vol_name a valid volume name for the operating system?
			-- (from PATH_NAME)
		require -- from PATH_NAME
			exists: vol_name /= void
	
feature  -- Status report

	is_empty: BOOLEAN
			-- Is structure empty?
			-- (from FINITE)
	
feature -- Status setting

	add_extension (ext: STRING)
			-- 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)
			-- 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])
			-- 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)
			-- 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)
			-- 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)
			-- 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)
			-- 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  -- Removal

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

	frozen to_c: ANY
			-- A reference to a C form of current string.
			-- Useful only for interfacing with C software.
			-- (from STRING)
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
		-- from STRING
	extendible: extendible
	compare_character: not object_comparison
	index_set_has_same_count: index_set.count = count
		-- 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
		-- from COMPARABLE
	irreflexive_comparison: not (Current < 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 -- class FILE_NAME