note
	description: "A package file."
	author: "Louis Marchand"
	date: "Thu, 02 Apr 2015 03:58:25 +0000"
	revision: "2.0"

class interface
	CPF_PACKAGE_FILE

create 
	make,
	make_thread_safe,
	make_open,
	make_open_tread_safe

feature -- Access

	is_valid: BOOLEAN
			-- Is Current a valid package file

	open
			-- Open the package file
			-- A package file is always read-only

	select_sub_file (a_index: INTEGER_32)
			-- In Current, go to the sub-file identified by a_index
		require
			cpf_file_is_valid: is_valid

	current_sub_file_index: INTEGER_32
			-- Retreive the index of the sub-file that the cursor is presently in.
		require
			cpf_file_is_valid: is_valid

	is_position_in_selected_sub_file: BOOLEAN
			-- True if the present position in Current is in the sub-file that is selected
		require
			cpf_file_is_valid: is_valid

	current_sub_file_position: INTEGER_32
			-- Return the current stream offset (position) in the file.
		require
			cpf_file_is_valid: is_valid
			file_index_is_in_file: is_position_in_selected_sub_file

	go_in_current_sub_file (a_offset: INTEGER_32)
			-- Place the stream offset at offset position after the begining of the file.
			-- The offset value must be posifive.
		require
			cpf_file_is_valid: is_valid
			file_seek_from_begining_offset_positive: a_offset >= 0 and then a_offset <= current_sub_file_last_position
		ensure
				position = a_offset

	move_in_current_sub_file (a_offset: INTEGER_32)
			-- Place the stream offset at offset position after (or before if offset is negative) the index.
		require
			cpf_file_is_valid: is_valid
			file_seek_from_index_is_in_file: is_position_in_selected_sub_file
			file_seek_from_index__is_valid: (a_offset >= 0 and then a_offset <= current_sub_file_last_position - position) or else (a_offset < 0 and then a_offset.abs <= position)

	recede_in_current_sub_file (a_offset: INTEGER_32)
			-- Place the stream offset at offset position before the end of the file.
			-- The offset value must be negative.
		require
			custom_file_seek_from_end_offset_negative: a_offset <= 0
			cpf_file_is_valid: is_valid

	current_sub_file_first_position: INTEGER_32
			-- The position in Current that the present sub-file start

	current_sub_file_last_position: INTEGER_32
			-- The position in Current that the present sub-file end
		require
			cpf_file_is_valid: is_valid

	current_sub_file_count: INTEGER_32
			-- The number of byte of the present sub-file

	file_index: INTEGER_32
			-- The index identifier of the presently selected sub-file
	
feature -- CPF informations

	sub_files_infos: LIST [TUPLE [pos: INTEGER_32; length: INTEGER_32]]
			-- Position and length of every sub files in the package file

	sub_files_count: INTEGER_32
			-- The number of sub-file inside Current
		require
			cpf_file_is_valid: is_valid

	prunable: BOOLEAN
			-- Is there an item to be removed?
	
invariant
	file_stream_ptr_not_null: not file_pointer.is_default_pointer

end -- class CPF_PACKAGE_FILE

Generated by ISE EiffelStudio