Loading...
Searching...
No Matches
ArFilesystemWritableAsset Class Reference

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

#include <filesystemWritableAsset.h>

+ Inheritance diagram for ArFilesystemWritableAsset:

Public Member Functions

AR_API ArFilesystemWritableAsset (TfSafeOutputFile &&file)
 Constructs an ArFilesystemWritableAsset for the given file.
 
virtual AR_API bool Close () override
 Closes the file owned by this asset.
 
virtual AR_API size_t Write (const void *buffer, size_t count, size_t offset) override
 Writes count bytes from buffer at offset from the beginning of the file held by this object.
 
- Public Member Functions inherited from ArWritableAsset
 ArWritableAsset (const ArWritableAsset &)=delete
 
ArWritableAssetoperator= (const ArWritableAsset &)=delete
 
virtual bool Close ()=0
 Close this asset, performing any necessary finalization or commits of data that was previously written.
 
virtual size_t Write (const void *buffer, size_t count, size_t offset)=0
 Writes count bytes from buffer at offset from the beginning of the asset.
 

Static Public Member Functions

static AR_API std::shared_ptr< ArFilesystemWritableAssetCreate (const ArResolvedPath &resolvedPath, ArResolver::WriteMode writeMode)
 Constructs a new ArFilesystemWritableAsset for the file at resolvedPath with the given writeMode.
 

Detailed Description

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

This implementation uses TfSafeOutputFile; in the case where the asset has been opened for replacement, data will be written to a temporary file which will be renamed over the destination file when this object is destroyed. See documentation for TfSafeOutputFile for more details.

Definition at line 46 of file filesystemWritableAsset.h.

Constructor & Destructor Documentation

◆ ArFilesystemWritableAsset()

AR_API ArFilesystemWritableAsset ( TfSafeOutputFile &&  file)
explicit

Constructs an ArFilesystemWritableAsset for the given file.

The ArFilesystemWritableAsset takes ownership of file.

Member Function Documentation

◆ Close()

virtual AR_API bool Close ( )
overridevirtual

Closes the file owned by this asset.

If the TfSafeOutputFile was opened for replacement, the temporary file that was being written to be will be renamed over the destination file.

Implements ArWritableAsset.

◆ Create()

static AR_API std::shared_ptr< ArFilesystemWritableAsset > Create ( const ArResolvedPath resolvedPath,
ArResolver::WriteMode  writeMode 
)
static

Constructs a new ArFilesystemWritableAsset for the file at resolvedPath with the given writeMode.

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

◆ Write()

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

Writes count bytes from buffer at offset from the beginning of the file held by this object.

Returns number of bytes written, or 0 on error.

Implements ArWritableAsset.


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