PackageItemFile¶
A File implementation that provides access to an item in an Amplitude package file.
Inherits the following classes: SparkyStudios::Audio::Amplitude::File
Public Functions¶
| Type | Name |
|---|---|
| virtual void | Close () override Closes the file an releases allocated resources. |
| virtual bool | Eof () override const Checks if the read cursor is at the end of the file. |
| AmSize | GetBasePosition () const Get the base position of this file item in the entire package file. |
| virtual AmOsString | GetPath () override const Gets the path to the file in the loaded FileSystem . |
| virtual AmVoidPtr | GetPtr () override const Gets the pointer to the internal file handle. |
| virtual bool | IsValid () override const Checks if the file is valid. |
| virtual AmSize | Length () override const Gets the size of the file in bytes. |
| PackageItemFile (const PackageFileItemDescription * item, std::shared_ptr< File > packageFile, AmSize headerSize) Constructs a new PackageItemFile instance. | |
| virtual AmSize | Position () override const Gets the current position of the read/write cursor. |
| virtual AmSize | Read (AmUInt8Buffer dst, AmSize bytes) override const Reads data from the file. |
| virtual void | Seek (AmInt64 offset, eFileSeekOrigin origin) override Seeks the read/write to the specified offset, starting at the given origin. |
| virtual AmSize | Write (AmConstUInt8Buffer src, AmSize bytes) override |
| ~PackageItemFile () override Destroys this instance. |
Public Functions inherited from SparkyStudios::Audio::Amplitude::File¶
See SparkyStudios::Audio::Amplitude::File
| Type | Name |
|---|---|
| virtual void | Close () = 0 Closes the file an releases allocated resources. |
| virtual bool | Eof () const = 0 Checks if the read cursor is at the end of the file. |
| virtual AmOsString | GetPath () const = 0 Gets the path to the file in the loaded FileSystem . |
| virtual AmVoidPtr | GetPtr () const = 0 Gets the pointer to the internal file handle. |
| virtual bool | IsValid () const = 0 Checks if the file is valid. |
| virtual AmSize | Length () const = 0 Gets the size of the file in bytes. |
| virtual AmSize | Position () const = 0 Gets the current position of the read/write cursor. |
| virtual AmSize | Read (AmUInt8Buffer dst, AmSize bytes) const = 0 Reads data from the file. |
| AmUInt16 | Read16 () const Reads two bytes from the file in an AmUInt16 . |
| AmUInt32 | Read32 () const Reads four bytes from the file in an AmUInt32 . |
| AmUInt64 | Read64 () const Reads eight bytes from the file in an AmUInt64 . |
| AmUInt8 | Read8 () const Reads a single byte from the file in an AmUInt8 . |
| AmString | ReadString () const Reads a string from the file. |
| void | Seek (AmSize offset) Seeks the read/write to the specified offset. |
| virtual void | Seek (AmInt64 offset, eFileSeekOrigin origin) = 0 Seeks the read/write to the specified offset, starting at the given origin. |
| virtual AmSize | Write (AmConstUInt8Buffer src, AmSize bytes) = 0 Writes data to the file. |
| AmSize | Write16 (AmUInt16 value) Writes two bytes to the file from an AmUInt16 . |
| AmSize | Write32 (AmUInt32 value) Writes four bytes to the file from an AmUInt32 . |
| AmSize | Write64 (AmUInt64 value) Writes eight bytes to the file from an AmUInt64 . |
| AmSize | Write8 (AmUInt8 value) Writes a single byte to the file from an AmUInt8 . |
| AmSize | WriteString (const AmString & value) Writes a string to the file. |
| virtual | ~File () = default Default destructor. |
Public Functions Documentation¶
Close
Closes the file an releases allocated resources.
Implements SparkyStudios::Audio::Amplitude::File::Close
Eof
Checks if the read cursor is at the end of the file.
Returns:
true if the read cursor is at the end of the file, false otherwise.
Implements SparkyStudios::Audio::Amplitude::File::Eof
GetBasePosition
Get the base position of this file item in the entire package file.
GetPath
Gets the path to the file in the loaded FileSystem .
Returns:
The path to the file.
GetPtr
Gets the pointer to the internal file handle.
Returns:
The internal file handle. This depends on the implementation.
IsValid
Checks if the file is valid.
The validity of a file is determined by the underlying implementation. But this should primarily mean that the file exists AND has been opened.
Returns:
true if the file is valid, false otherwise.
Length
Gets the size of the file in bytes.
Returns:
The size of the file in bytes.
PackageItemFile
Constructs a new PackageItemFile instance.
Amplitude::PackageItemFile::PackageItemFile (
const PackageFileItemDescription * item,
std::shared_ptr< File > packageFile,
AmSize headerSize
)
Parameters:
-
itemThe description of the package item. -
packageFileThe package file containing this item. -
headerSizeThe size of the package file header.
Position
Gets the current position of the read/write cursor.
Returns:
The actual position of the read/write cursor.
Read
Reads data from the file.
Parameters:
-
dstThe destination buffer of the read data. -
bytesThe number of bytes to read from the file. The destination buffer must be at least as large as the number of bytes to read.
Returns:
The number of bytes read from the file.
Implements SparkyStudios::Audio::Amplitude::File::Read
Seek
Seeks the read/write to the specified offset, starting at the given origin.
Parameters:
-
offsetThe offset in bytes from the beginning of the file. -
originThe origin from which to begin seeking.
Implements SparkyStudios::Audio::Amplitude::File::Seek
Write
Note:
Writing is disabled for packages item files.
Implements SparkyStudios::Audio::Amplitude::File::Write
The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/IO/PackageItemFile.h