Emergency 20 Dokumentation  4.2.0
qsf::AssetProxy Class Reference

Asset proxy class. More...

#include <AssetProxy.h>

Inheritance diagram for qsf::AssetProxy:
qsf::Proxy

Public Member Functions

 AssetProxy ()
 Default constructor. More...
 
 AssetProxy (const AssetProxy &assetProxy)
 Copy constructor. More...
 
 AssetProxy (GlobalAssetId globalAssetId)
 Constructor. More...
 
 AssetProxy (const std::string &localAssetName)
 Constructor. More...
 
 AssetProxy (LocalAssetId localAssetId)
 Constructor. More...
 
 ~AssetProxy ()
 Destructor. More...
 
void clear ()
 Reset the asset proxy to initial default values. More...
 
bool isValid () const
 Return whether or not the asset proxy does wrap up an asset. More...
 
bool operator== (const AssetProxy &assetProxy) const
 Asset proxy equal operator. More...
 
bool operator!= (const AssetProxy &assetProxy) const
 Asset proxy not equal operator. More...
 
GlobalAssetId getGlobalAssetId () const
 Return the global ID of the asset this asset proxy wraps up. More...
 
void setGlobalAssetId (GlobalAssetId globalAssetId)
 Set the global ID of the asset this asset proxy wraps up. More...
 
const std::string & getLocalAssetName () const
 Return the local name of the asset this asset proxy wraps up. More...
 
 operator const std::string & () const
 Return the local name of the asset this asset proxy wraps up. More...
 
bool isLocalAssetIdInitialized () const
 Return whether or not the local asset ID is already initialized. More...
 
LocalAssetId getLocalAssetId () const
 Return the local ID of the asset this asset proxy wraps up. More...
 
void setLocalAssetName (const std::string &localAssetName)
 Set the local name of the asset this asset proxy wraps up. More...
 
std::string getCachedAssetDataFilename () const
 Return the virtual filename of the locally cached asset data of the asset this asset proxy wraps up. More...
 
std::string getAbsoluteCachedAssetDataFilename () const
 Return the absolute filename of the locally cached asset data of the asset this asset proxy wraps up. More...
 
AssetgetAsset () const
 Return the asset. More...
 
CachedAssetgetCachedAsset () const
 Return the cached asset. More...
 
std::string getCachedAssetType () const
 Return the type name of the cached asset. More...
 
AssetPackagegetAssetPackage () const
 Return the asset package the asset resides in. More...
 
ProjectId getProjectId () const
 Return the id of the project the asset resides in. More...
 
void serialize (BinarySerializer &serializer)
 Serialize or deserialize the asset proxy using a binary serializer. More...
 

Static Public Attributes

static const AssetProxy EMPTY
 

Additional Inherited Members

- Protected Member Functions inherited from qsf::Proxy
 Proxy ()
 Default constructor. More...
 
 ~Proxy ()
 Destructor. More...
 

Detailed Description

Asset proxy class.

Remarks
Here's a tiny asset proxy usage example:
qsf::AssetProxy assetProxy("sample/mesh/house/house01");
std::string filename(assetProxy.getCachedAssetDataFilename());
Note
  • Use "qsf::AssetProxy" instead of "std::string" to store asset references
  • It's recommended to access assets only via asset proxies

Constructor & Destructor Documentation

qsf::AssetProxy::AssetProxy ( )

Default constructor.

qsf::AssetProxy::AssetProxy ( const AssetProxy assetProxy)
inline

Copy constructor.

Parameters
[in]assetProxyAsset proxy to copy from
qsf::AssetProxy::AssetProxy ( GlobalAssetId  globalAssetId)
explicit

Constructor.

Parameters
[in]globalAssetIdGlobal ID of the asset this asset proxy wraps up, "qsf::getUninitialized<GlobalAssetId>()" if invalid
qsf::AssetProxy::AssetProxy ( const std::string &  localAssetName)
explicit

Constructor.

Parameters
[in]localAssetNameLocal UTF-8 name of the asset this asset proxy should wrap up (e.g. "sample/mesh/house/house01")
qsf::AssetProxy::AssetProxy ( LocalAssetId  localAssetId)
explicit

Constructor.

Parameters
[in]localAssetIdLocal asset id of the asset this asset proxy should wrap up, "qsf::getUninitialized<LocalAssetId>()" if invalid
qsf::AssetProxy::~AssetProxy ( )
inline

Destructor.

Note
  • Not virtual by intent

Member Function Documentation

void qsf::AssetProxy::clear ( )
inline

Reset the asset proxy to initial default values.

std::string qsf::AssetProxy::getAbsoluteCachedAssetDataFilename ( ) const

Return the absolute filename of the locally cached asset data of the asset this asset proxy wraps up.

Returns
The absolute UTF-8 filename of the locally cached asset data of the asset this asset proxy wraps up (e.g. "c:/application/data/sample/mesh/house/house01.mesh")
Asset* qsf::AssetProxy::getAsset ( ) const

Return the asset.

Returns
The asset, null pointer on error, do not destroy the instance
Note
  • Ease-of-use method, don't use this method if you don't have to (performance)
AssetPackage* qsf::AssetProxy::getAssetPackage ( ) const

Return the asset package the asset resides in.

Returns
The asset package the asset resides in, do no destroy the returned instance, null pointer on error
Note
  • Ease-of-use method, don't use this method if you don't have to (performance)
CachedAsset* qsf::AssetProxy::getCachedAsset ( ) const

Return the cached asset.

Returns
The cached asset, null pointer on error, do not destroy the instance
Note
  • Ease-of-use method, don't use this method if you don't have to (performance)
std::string qsf::AssetProxy::getCachedAssetDataFilename ( ) const

Return the virtual filename of the locally cached asset data of the asset this asset proxy wraps up.

Returns
The virtual UTF-8 filename of the locally cached asset data of the asset this asset proxy wraps up (e.g. "sample/mesh/house/house01.mesh")
std::string qsf::AssetProxy::getCachedAssetType ( ) const

Return the type name of the cached asset.

Returns
The UTF-8 type name (example: "dds") of the cached asset, do no destroy the returned instance, completely lower case
Note
  • Ease-of-use method, don't use this method if you don't have to (performance)
GlobalAssetId qsf::AssetProxy::getGlobalAssetId ( ) const

Return the global ID of the asset this asset proxy wraps up.

Returns
Global ID of the asset this asset proxy wraps up, "qsf::getUninitialized<GlobalAssetId>()" if invalid
LocalAssetId qsf::AssetProxy::getLocalAssetId ( ) const

Return the local ID of the asset this asset proxy wraps up.

Returns
Local ID of the asset this asset proxy wraps up (e.g. qsf::StringHash("sample/mesh/house/house01")), "qsf::getUninitialized<LocalAssetId>()" if invalid
Note
  • The local asset ID is generated by using "qsf::StringHash" on the local UTF-8 name of the asset this asset proxy wraps up
const std::string& qsf::AssetProxy::getLocalAssetName ( ) const

Return the local name of the asset this asset proxy wraps up.

Returns
Local UTF-8 name of the asset this asset proxy wraps up (e.g. "sample/mesh/house/house01")
ProjectId qsf::AssetProxy::getProjectId ( ) const

Return the id of the project the asset resides in.

Returns
The id of the project the asset resides in, uninitialized on error
Note
  • Ease-of-use method, don't use this method if you don't have to (performance)
bool qsf::AssetProxy::isLocalAssetIdInitialized ( ) const
inline

Return whether or not the local asset ID is already initialized.

Returns
"true" if the local asset ID is already initialized, else "false"
bool qsf::AssetProxy::isValid ( ) const

Return whether or not the asset proxy does wrap up an asset.

Returns
"true" if the asset proxy wraps up and asset and hence is considered to be valid, else "false"
qsf::AssetProxy::operator const std::string & ( ) const
inline

Return the local name of the asset this asset proxy wraps up.

Returns
Local UTF-8 name of the asset this asset proxy wraps up (e.g. "sample/mesh/house/house01")
Note
  • Ease-of-use operator returning the same result as "qsf::AssetProxy::getLocalAssetName()"
bool qsf::AssetProxy::operator!= ( const AssetProxy assetProxy) const
inline

Asset proxy not equal operator.

Parameters
[in]assetProxyThe other asset proxy to compare this asset proxy with
Returns
"true" if both asset proxies do not wrap up the same asset, else "false"
bool qsf::AssetProxy::operator== ( const AssetProxy assetProxy) const
inline

Asset proxy equal operator.

Parameters
[in]assetProxyThe other asset proxy to compare this asset proxy with
Returns
"true" if both asset proxies wrap up the same asset, else "false"
void qsf::AssetProxy::serialize ( BinarySerializer serializer)

Serialize or deserialize the asset proxy using a binary serializer.

Parameters
[in]serializerThe serializer, which can be either in read or write mode
void qsf::AssetProxy::setGlobalAssetId ( GlobalAssetId  globalAssetId)

Set the global ID of the asset this asset proxy wraps up.

Parameters
[in]globalAssetIdGlobal ID of the asset this asset proxy wraps up, "qsf::getUninitialized<GlobalAssetId>()" if invalid
void qsf::AssetProxy::setLocalAssetName ( const std::string &  localAssetName)

Set the local name of the asset this asset proxy wraps up.

Parameters
[in]localAssetNameLocal UTF-8 name of the asset this asset proxy should wrap up (e.g. "sample/mesh/house/house01")

Member Data Documentation

const AssetProxy qsf::AssetProxy::EMPTY
static

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