note
	description: "Internal file information"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2020-05-19 14:29:33 +0000 (Tue, 19 May 2020) $"
	revision: "$Revision: 104259 $"

class interface
	FILE_INFO

create 
	make

convert
	to_unix_file_info: {UNIX_FILE_INFO}

feature -- Access

	protection: INTEGER_32
			-- Protection mode of file (12 lower bits)
		require
			exists: exists

	type: INTEGER_32
			-- File type (4 bits, 12 lowest bits zeroed)
		require
			exists: exists

	inode: INTEGER_32
			-- Inode number
		require
			exists: exists

	size: INTEGER_32
			-- File size, in bytes
		require
			exists: exists

	user_id: INTEGER_32
			-- UID of the file owner
		require
			exists: exists

	group_id: INTEGER_32
			-- GID of the file
		require
			exists: exists

	date: INTEGER_32
			-- Last modification date
		require
			exists: exists

	access_date: INTEGER_32
			-- Date of last access
		require
			exists: exists

	change_date: INTEGER_32
			-- Date of last status change
		require
			exists: exists

	device: INTEGER_32
			-- Device number on which inode resides
		require
			exists: exists

	device_type: INTEGER_32
			-- Device type on which inode resides
		require
			exists: exists

	links: INTEGER_32
			-- Number of links
		require
			exists: exists

	owner_name: STRING_8
			-- Name of the file owner, if available from /etc/passwd.
			-- Otherwise, the UID
		require
			exists: exists

	group_name: STRING_8
			-- Name of the file group, if available from /etc/group.
			-- Otherwise, the GID
		require
			exists: exists

	file_entry: detachable PATH
			-- Associated entry for Current.
	
feature -- Status report

	exists: BOOLEAN
			-- Does current file exists?

	is_following_symlinks: BOOLEAN
			-- Does current follow symbolic links when retrieving properties?

	is_ready: BOOLEAN
			-- Is current ready to perform a query?

	is_plain: BOOLEAN
			-- Is file a plain file?
		require
			exists: exists

	is_device: BOOLEAN
			-- Is file a device?
		require
			exists: exists

	is_directory: BOOLEAN
			-- Is file a directory?
		require
			exists: exists

	is_symlink: BOOLEAN
			-- Is file a symbolic link?
		require
			exists: exists

	is_fifo: BOOLEAN
			-- Is file a named pipe?
		require
			exists: exists

	is_socket: BOOLEAN
			-- Is file a named socket?
		require
			exists: exists

	is_block: BOOLEAN
			-- Is file a device block special file?
		require
			exists: exists

	is_character: BOOLEAN
			-- Is file a character block special file?
		require
			exists: exists

	is_readable: BOOLEAN
			-- Is file readable by effective UID?
		require
			exists: exists

	is_writable: BOOLEAN
			-- Is file writable by effective UID?
		require
			exists: exists

	is_executable: BOOLEAN
			-- Is file executable by effective UID?
		require
			exists: exists

	is_setuid: BOOLEAN
			-- Is file setuid?
		require
			exists: exists

	is_setgid: BOOLEAN
			-- Is file setgid?
		require
			exists: exists

	is_sticky: BOOLEAN
			-- Is file sticky?
		require
			exists: exists

	is_owner: BOOLEAN
			-- Is file owned by effective UID?
		require
			exists: exists

	is_access_owner: BOOLEAN
			-- Is file owned by real UID?
		require
			exists: exists

	is_access_readable: BOOLEAN
			-- Is file readable by real UID?
		require
			is_ready: is_ready

	is_access_writable: BOOLEAN
			-- Is file writable by real UID?
		require
			is_ready: is_ready

	is_access_executable: BOOLEAN
			-- Is file executable by real UID?
		require
			is_ready: is_ready
	
feature -- Comparison

	is_equal (other: like Current): BOOLEAN
			-- Is other attached to an object considered
			-- equal to current object?
	
feature -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to other, so as to yield equal objects.
		ensure then
			not_shared_if_different: other /= Current implies buffered_file_info /= other.buffered_file_info
			equal_buffered_file_infos: buffered_file_info ~ other.buffered_file_info
	
feature -- Element change

	update (f_name: READABLE_STRING_GENERAL)
			-- Update information buffer: fill it in with information
			-- from the inode of f_name.
		require
			f_name_not_empty: not f_name.is_empty

	set_is_following_symlinks (v: BOOLEAN)
			-- Should update follow symlinks or not?
		ensure
			is_following_symlinks_set: is_following_symlinks = v
	
note
	copyright: "Copyright (c) 1984-2020, 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 FILE_INFO

Generated by ISE EiffelStudio