#include <filesystem.h>

Public Types | |
| enum | t_seek_mode { seek_from_beginning = 0, seek_from_current = 1, seek_from_eof = 2 } |
| Seeking mode constants. Note: these are purposedly defined to same values as standard C SEEK_* constants. More... | |
| typedef file | t_interface |
| typedef service_base | t_interface_parent |
Public Member Functions | |
| virtual t_filesize | get_size (abort_callback &p_abort)=0 |
| virtual t_filesize | get_position (abort_callback &p_abort)=0 |
| virtual void | resize (t_filesize p_size, abort_callback &p_abort)=0 |
| virtual void | seek (t_filesize p_position, abort_callback &p_abort)=0 |
| virtual void | seek_ex (t_sfilesize p_position, t_seek_mode p_mode, abort_callback &p_abort) |
| virtual bool | can_seek ()=0 |
| Returns whether the file is seekable or not. If can_seek() returns false, all seek() or seek_ex() calls will fail; reopen() is still usable on nonseekable streams. | |
| virtual bool | get_content_type (pfc::string_base &p_out)=0 |
| virtual bool | is_in_memory () |
| Hint, returns whether the file is already fully buffered into memory. | |
| virtual void | on_idle (abort_callback &p_abort) |
| virtual t_filetimestamp | get_timestamp (abort_callback &p_abort) |
| virtual void | reopen (abort_callback &p_abort)=0 |
| virtual bool | is_remote ()=0 |
| Indicates whether the file is a remote resource and non-sequential access may be slowed down by lag. This is typically returns to true on non-seekable sources but may also return true on seekable sources indicating that seeking is supported but will be relatively slow. | |
| t_filestats | get_stats (abort_callback &p_abort) |
| Retrieves file stats structure. Usese get_size() and get_timestamp(). | |
| bool | is_eof (abort_callback &p_abort) |
| Returns whether read/write cursor position is at the end of file. | |
| void | truncate (t_filesize p_position, abort_callback &p_abort) |
| Truncates file to specified size (while preserving read/write cursor position if possible); uses set_eof(). | |
| void | set_eof (abort_callback &p_abort) |
| Truncates the file at current read/write cursor position. | |
| t_filesize | get_size_ex (abort_callback &p_abort) |
| Helper; retrieves size of the file. If size is not available (get_size() returns filesize_invalid), throws exception_io_no_length. | |
| t_filesize | get_remaining (abort_callback &p_abort) |
| Helper; retrieves amount of bytes between read/write cursor position and end of file. Fails when length can't be determined. | |
| void | ensure_seekable () |
| Helper; throws exception_io_object_not_seekable if file is not seekable. | |
| void | ensure_local () |
| Helper; throws exception_io_object_is_remote if the file is remote. | |
| t_filesize | skip (t_filesize p_bytes, abort_callback &p_abort) |
Static Public Member Functions | |
| static t_filesize | g_transfer (stream_reader *src, stream_writer *dst, t_filesize bytes, abort_callback &p_abort) |
| static void | g_transfer_object (stream_reader *src, stream_writer *dst, t_filesize bytes, abort_callback &p_abort) |
| Helper; transfers specified number of bytes between streams. Throws exception if requested number of bytes could not be read (EOF). | |
| static void | g_transfer_file (const service_ptr_t< file > &p_from, const service_ptr_t< file > &p_to, abort_callback &p_abort) |
| Helper; transfers entire file content from one file to another, erasing previous content. | |
| static t_filesize | g_transfer (service_ptr_t< file > p_src, service_ptr_t< file > p_dst, t_filesize p_bytes, abort_callback &p_abort) |
| Helper; improved performance over g_transfer on streams (avoids disk fragmentation when transferring large blocks). | |
| static void | g_transfer_object (service_ptr_t< file > p_src, service_ptr_t< file > p_dst, t_filesize p_bytes, abort_callback &p_abort) |
| Helper; improved performance over g_transfer_file on streams (avoids disk fragmentation when transferring large blocks). | |
Static Public Attributes | |
| static const GUID | class_guid |
| typedef file foobar2000_io::file::t_interface |
Reimplemented in foobar2000_io::file_dynamicinfo.
Seeking mode constants. Note: these are purposedly defined to same values as standard C SEEK_* constants.
| virtual t_filesize foobar2000_io::file::get_size | ( | abort_callback & | p_abort | ) | [pure virtual] |
Retrieves size of the file.
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual t_filesize foobar2000_io::file::get_position | ( | abort_callback & | p_abort | ) | [pure virtual] |
Retrieves read/write cursor position in the file. In case of non-seekable stream, this should return number of bytes read so far since open/reopen call.
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual void foobar2000_io::file::resize | ( | t_filesize | p_size, | |
| abort_callback & | p_abort | |||
| ) | [pure virtual] |
Resizes file to specified size in bytes.
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual void foobar2000_io::file::seek | ( | t_filesize | p_position, | |
| abort_callback & | p_abort | |||
| ) | [pure virtual] |
Sets read/write cursor position to specific offset.
| p_position | position to seek to. | |
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual void foobar2000_io::file::seek_ex | ( | t_sfilesize | p_position, | |
| t_seek_mode | p_mode, | |||
| abort_callback & | p_abort | |||
| ) | [virtual] |
Sets read/write cursor position to specific offset; extended form allowing seeking relative to current position or to end of file.
| p_position | Position to seek to; interpretation of this value depends on p_mode parameter. | |
| p_mode | Seeking mode; see t_seek_mode enum values for further description. | |
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual bool foobar2000_io::file::can_seek | ( | ) | [pure virtual] |
Returns whether the file is seekable or not. If can_seek() returns false, all seek() or seek_ex() calls will fail; reopen() is still usable on nonseekable streams.
| virtual bool foobar2000_io::file::get_content_type | ( | pfc::string_base & | p_out | ) | [pure virtual] |
Retrieves mime type of the file.
| p_out | Receives content type string on success. |
| virtual bool foobar2000_io::file::is_in_memory | ( | ) | [inline, virtual] |
Hint, returns whether the file is already fully buffered into memory.
| virtual void foobar2000_io::file::on_idle | ( | abort_callback & | p_abort | ) | [inline, virtual] |
Optional, called by owner thread before sleeping.
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual t_filetimestamp foobar2000_io::file::get_timestamp | ( | abort_callback & | p_abort | ) | [inline, virtual] |
Retrieves last modification time of the file.
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual void foobar2000_io::file::reopen | ( | abort_callback & | p_abort | ) | [pure virtual] |
Resets non-seekable stream, or seeks to zero on seekable file.
| p_abort | abort_callback object signaling user aborting the operation. |
| virtual bool foobar2000_io::file::is_remote | ( | ) | [pure virtual] |
Indicates whether the file is a remote resource and non-sequential access may be slowed down by lag. This is typically returns to true on non-seekable sources but may also return true on seekable sources indicating that seeking is supported but will be relatively slow.
| t_filestats foobar2000_io::file::get_stats | ( | abort_callback & | p_abort | ) |
Retrieves file stats structure. Usese get_size() and get_timestamp().
| bool foobar2000_io::file::is_eof | ( | abort_callback & | p_abort | ) |
Returns whether read/write cursor position is at the end of file.
| void foobar2000_io::file::truncate | ( | t_filesize | p_position, | |
| abort_callback & | p_abort | |||
| ) |
| void foobar2000_io::file::set_eof | ( | abort_callback & | p_abort | ) | [inline] |
Truncates the file at current read/write cursor position.
| t_filesize foobar2000_io::file::get_size_ex | ( | abort_callback & | p_abort | ) |
Helper; retrieves size of the file. If size is not available (get_size() returns filesize_invalid), throws exception_io_no_length.
| t_filesize foobar2000_io::file::get_remaining | ( | abort_callback & | p_abort | ) |
Helper; retrieves amount of bytes between read/write cursor position and end of file. Fails when length can't be determined.
| void foobar2000_io::file::ensure_seekable | ( | ) |
Helper; throws exception_io_object_not_seekable if file is not seekable.
| void foobar2000_io::file::ensure_local | ( | ) |
Helper; throws exception_io_object_is_remote if the file is remote.
| static t_filesize foobar2000_io::file::g_transfer | ( | stream_reader * | src, | |
| stream_writer * | dst, | |||
| t_filesize | bytes, | |||
| abort_callback & | p_abort | |||
| ) | [static] |
Helper; transfers specified number of bytes between streams.
| static void foobar2000_io::file::g_transfer_object | ( | stream_reader * | src, | |
| stream_writer * | dst, | |||
| t_filesize | bytes, | |||
| abort_callback & | p_abort | |||
| ) | [static] |
Helper; transfers specified number of bytes between streams. Throws exception if requested number of bytes could not be read (EOF).
| static void foobar2000_io::file::g_transfer_file | ( | const service_ptr_t< file > & | p_from, | |
| const service_ptr_t< file > & | p_to, | |||
| abort_callback & | p_abort | |||
| ) | [static] |
| static t_filesize foobar2000_io::file::g_transfer | ( | service_ptr_t< file > | p_src, | |
| service_ptr_t< file > | p_dst, | |||
| t_filesize | p_bytes, | |||
| abort_callback & | p_abort | |||
| ) | [static] |
Helper; improved performance over g_transfer on streams (avoids disk fragmentation when transferring large blocks).
| static void foobar2000_io::file::g_transfer_object | ( | service_ptr_t< file > | p_src, | |
| service_ptr_t< file > | p_dst, | |||
| t_filesize | p_bytes, | |||
| abort_callback & | p_abort | |||
| ) | [static] |
Helper; improved performance over g_transfer_file on streams (avoids disk fragmentation when transferring large blocks).
| t_filesize foobar2000_io::file::skip | ( | t_filesize | p_bytes, | |
| abort_callback & | p_abort | |||
| ) | [virtual] |
Attempts to skip specified number of bytes in the stream.
| p_bytes | Number of bytes to skip. | |
| p_abort | abort_callback object signaling user aborting the operation. |
Reimplemented from foobar2000_io::stream_reader.
const GUID file::class_guid [static] |
Initial value:
{ 0xb2f9fc40, 0x3e55, 0x4b23, { 0xa2, 0xc9, 0x22, 0xba, 0xad, 0x87, 0x95, 0xb1 } }
Reimplemented in foobar2000_io::file_dynamicinfo.
1.5.5