Loading...
Searching...
No Matches
ArFilesystemAsset Class Reference

ArAsset implementation for asset represented by a file on a filesystem. More...

#include <filesystemAsset.h>

+ Inheritance diagram for ArFilesystemAsset:

Public Member Functions

AR_API ArFilesystemAsset (FILE *file)
 Constructs an ArFilesystemAsset for the given file.
 
AR_API ~ArFilesystemAsset ()
 Closes the file owned by this object.
 
virtual AR_API size_t GetSize () const override
 Returns the size of the file held by this object.
 
virtual AR_API std::shared_ptr< const char > GetBuffer () const override
 Creates a read-only memory map for the file held by this object and returns a pointer to the start of the mapped contents.
 
virtual AR_API size_t Read (void *buffer, size_t count, size_t offset) const override
 Reads count bytes from the file held by this object at the given offset into buffer.
 
virtual AR_API std::pair< FILE *, size_t > GetFileUnsafe () const override
 Returns the FILE* handle this object was created with and an offset of 0, since the asset's contents are located at the beginning of the file.
 
- Public Member Functions inherited from ArAsset
 ArAsset (const ArAsset &)=delete
 
ArAssetoperator= (const ArAsset &)=delete
 
virtual AR_API size_t GetSize () const =0
 Returns size of the asset.
 
virtual AR_API std::shared_ptr< const char > GetBuffer () const =0
 Returns a pointer to a buffer with the contents of the asset, with size given by GetSize().
 
virtual AR_API size_t Read (void *buffer, size_t count, size_t offset) const =0
 Read count bytes at offset from the beginning of the asset into buffer.
 
virtual AR_API std::pair< FILE *, size_t > GetFileUnsafe () const =0
 Returns a read-only FILE* handle and offset for this asset if available, or (nullptr, 0) otherwise.
 
virtual AR_API std::shared_ptr< ArAssetGetDetachedAsset () const
 Returns an ArAsset with the contents of this asset detached from from this asset's serialized data.
 

Static Public Member Functions

static AR_API std::shared_ptr< ArFilesystemAssetOpen (const ArResolvedPath &resolvedPath)
 Constructs a new ArFilesystemAsset for the file at resolvedPath.
 
static AR_API ArTimestamp GetModificationTimestamp (const ArResolvedPath &resolvedPath)
 Returns an ArTimestamp holding the mtime of the file at resolvedPath.
 

Detailed Description

ArAsset implementation for asset represented by a file on a filesystem.

Definition at line 44 of file filesystemAsset.h.

Constructor & Destructor Documentation

◆ ArFilesystemAsset()

AR_API ArFilesystemAsset ( FILE *  file)
explicit

Constructs an ArFilesystemAsset for the given file.

The ArFilesystemAsset object takes ownership of file and will close the file handle on destruction.

◆ ~ArFilesystemAsset()

AR_API ~ArFilesystemAsset ( )

Closes the file owned by this object.

Member Function Documentation

◆ GetBuffer()

virtual AR_API std::shared_ptr< const char > GetBuffer ( ) const
overridevirtual

Creates a read-only memory map for the file held by this object and returns a pointer to the start of the mapped contents.

Implements ArAsset.

◆ GetFileUnsafe()

virtual AR_API std::pair< FILE *, size_t > GetFileUnsafe ( ) const
overridevirtual

Returns the FILE* handle this object was created with and an offset of 0, since the asset's contents are located at the beginning of the file.

Implements ArAsset.

◆ GetModificationTimestamp()

static AR_API ArTimestamp GetModificationTimestamp ( const ArResolvedPath resolvedPath)
static

Returns an ArTimestamp holding the mtime of the file at resolvedPath.

Returns an invalid ArTimestamp if the mtime could not be retrieved.

◆ GetSize()

virtual AR_API size_t GetSize ( ) const
overridevirtual

Returns the size of the file held by this object.

Implements ArAsset.

◆ Open()

static AR_API std::shared_ptr< ArFilesystemAsset > Open ( const ArResolvedPath resolvedPath)
static

Constructs a new ArFilesystemAsset for the file at resolvedPath.

Returns a null pointer if the file could not be opened.

◆ Read()

virtual AR_API size_t Read ( void *  buffer,
size_t  count,
size_t  offset 
) const
overridevirtual

Reads count bytes from the file held by this object at the given offset into buffer.

Implements ArAsset.


The documentation for this class was generated from the following file: