indexing
	cluster: "file_system_objects"
	namespace: "candidate"
	description: "List of properties from real file system object."
	original_author: "Justin Finnerty"
	original_date: "July 005"
	current_date: "$Date: 2005/09/05 02:35:01 $"
	current_author: "$Author: finnerty $"
	revision: "$Revision: 2.2 $"
   -- $Log: fso_properties.ge,v $
   -- Revision 2.2  2005/09/05 02:35:01  finnerty
   -- Updated to conform to cursors/containers in the GOBO library and
   -- test programs compile with SE and VE.
   --
   -- Revision 2.1  2005/09/02 08:08:06  finnerty
   -- Renamed *.e to *.ge for gepp
   --
   -- Revision 2.0  2005/08/26 23:30:22  finnerty
   -- == alpha version ==
   --
   -- Revision 1.5  2005/08/12 06:55:40  finnerty
   -- Turned into concrete type. Now different file-systems are handled by a factory for generating FSO_PROPERTIES. This makes this type 'storable'
   --
   -- Revision 1.4  2005/08/10 02:19:43  finnerty
   -- Add 'is_other' to support possible non-detection of file type in descendents.
   --
   -- Revision 1.3  2005/08/09 13:47:09  finnerty
   -- Changes for alpha test. Abstract base of OS dependent FSO_PROPERTIES heirarchy.
   --
   -- Revision 1.2  2005/08/08 12:02:39  finnerty
   -- Made concrete version of FSO_PROPERTIES for UNiX.
   --
   -- Revision 1.1  2005/08/07 02:16:53  finnerty
   -- Base type for properties of real file system objects. Contains ownership, modification time, file type etc.
   --

class FSO_PROPERTIES
	-- List of properties from real file system object.

#ifdef SE
insert
#else
inherit
#endif
   FSO_FILE_TYPE

creation {ANY}
	make

feature {ANY}
	-- Properties
	exists: BOOLEAN
			-- Is there a corresponding file?

	size: INTEGER
			-- Get the size (in bytes) of a file or symlink.

	is_other: BOOLEAN is
			-- Could we not determine the file type?
		do Result := type = Other end
			
	is_block_device: BOOLEAN is
			-- Is the file system object a block device?
		do Result := type = Block end

	is_character_device: BOOLEAN is
			-- Is the file system object a character device?
		do Result := type = Character end

	is_directory: BOOLEAN is
			-- Is the file system object a directory?
		do Result := type = Directory end
	
	is_file: BOOLEAN is
			-- Is the file system object related a regular file?
		do Result := type = File end
	
	is_pipe: BOOLEAN is
			-- Is the file system object a pipe/fifo?
		do Result := type = Pipe end

	is_socket: BOOLEAN is
			-- Is the file system object a socket?
		do Result := type = Socket end
	
	is_symlink: BOOLEAN is
			-- Is the file system object a symlink (may be "dangling")
		do Result := type = Symlink end

	time_access:DT_DATE_TIME
			-- Time of last call by execve(2), mknod(2), pipe(2),
			-- utime(2) or read(2).

	time_change:DT_DATE_TIME
			-- Time set by last write or changed inode information (i.e.,
			-- owner, group, link count, mode, etc.).

	time_modification:DT_DATE_TIME
			-- Time of last file modifications, e.g. by mknod(2),
			-- truncate(2), utime(2) and write(2) (of more than zero
			-- bytes).  For a directory; last creation or deletion of
			-- files.

#ifdef SE
	type: INTEGER_8
#else
	type: INTEGER
#endif
         -- File type (one of `Block'...`Other')

feature {NONE}
#ifdef SE
	make(a_exists: BOOLEAN; a_type: INTEGER_8; a_size: INTEGER; a_access, a_change, a_mod: DT_DATE_TIME) is
#else
	make(a_exists: BOOLEAN; a_type: INTEGER; a_size: INTEGER; a_access, a_change, a_mod: DT_DATE_TIME) is
#endif
			-- Reset all variables
		require
			Valid_type: a_type = Block xor a_type = Character xor a_type = Directory xor a_type = File xor a_type = Pipe xor a_type = Socket xor a_type = Symlink xor a_type = Other
		do
			exists := a_exists
			type := a_type
			size := a_size
			!!time_access.make_from_date_time (a_access.date, a_access.time)
			!!time_change.make_from_date_time (a_change.date, a_change.time)
			!!time_modification.make_from_date_time (a_mod.date, a_mod.time)
		end 
invariant
	exists implies (is_other xor is_block_device xor is_character_device xor is_directory xor is_file xor is_pipe xor is_socket xor is_symlink)
	
end -- class FSO_PROPERTIES
