UrlFileCacheInterface Class Reference

#include <urlfile_cache.h>

详细描述

UrlFileCacheInterface offers helper functions to allow to access to files with unsupported URLSCHEMEs. E.g. preset:// wont work with openexr because this lib needs a valid utf8 character path and InputStreams cannot be used to virtualize the read. In that case you would write:

maxon::Url url = MaxonConvert (name, MAXONCONVERTMODE::READ ); maxon::UrlFileCacheEntry fileCacheEntry;
if (! maxon::UrlFileCacheInterface::IsAccessible (url)) { fileCacheEntry = maxon::UrlFileCacheInterface::FindOrCreateUrl (url) iferr_return ; url = fileCacheEntry.GetCacheUrl(); } ifnoerr ( maxon::BaseArray<Char> buffer = url.GetSystemPath().GetCString(maxon::StringEncodings::Utf8())) return exr_load(buffer.GetFirst(), &wbm); else return IMAGERESULT ::MISC_ERROR;

静态公共成员函数

static MAXON_METHOD Bool   IsAccessible (const maxon::Url &url)
static MAXON_METHOD Result < UrlFileCacheEntry >  FindOrCreateUrl (const Url &sourceUrl, const TimeValue &maxCacheTime= Seconds (1.0), URLFILECACHEFLAGS flags= URLFILECACHEFLAGS::NONE )
static MAXON_METHOD Result < void >  FlushCache (const Url &url)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( UrlFileCacheInterface , MAXON_REFERENCE_NONE , "net.maxon.interface.urlfilecache")

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( UrlFileCacheInterface   ,
MAXON_REFERENCE_NONE   ,
"net.maxon.interface.urlfilecache"   
)
private

◆  IsAccessible()

static MAXON_METHOD Bool IsAccessible ( const maxon::Url url )
static

Check if the url scheme is directly accessible via fopen().

参数
[in] url Url to check.
返回
true if the url can accessed directly. false if the url needs a cached copy. in that case use UrlFileCacheInterface::FindOrCreateUrl() to create or find the cache file.

◆  FindOrCreateUrl()

static MAXON_METHOD Result <UrlFileCacheEntry> FindOrCreateUrl ( const Url sourceUrl ,
const TimeValue maxCacheTime = Seconds(1.0) ,
URLFILECACHEFLAGS   flags = URLFILECACHEFLAGS::NONE  
)
static

Finds or creates a new UrlFileCacheEntry for the given source Url .

参数
[in] sourceUrl Url to be cached.
[in] maxCacheTime Time to wait until to delete the cache file after it's not needed anymore.
[in] flags See URLFILECACHEFLAGS.
返回
A UrlFileCacheEntry which ensures the existence of the cache file as long as any reference to this handle exists.

◆  FlushCache()

static MAXON_METHOD Result <void> FlushCache ( const Url url )
static

Flushes the url from the cache. Existing UrlFileCacheEntries keep alive until the last handle vanishes. Calling the FindOrCreateUrl will create a new cache file for this url.

maxon::UrlFileCacheInterface::FindOrCreateUrl
static MAXON_METHOD Result< UrlFileCacheEntry > FindOrCreateUrl(const Url &sourceUrl, const TimeValue &maxCacheTime=Seconds(1.0), URLFILECACHEFLAGS flags=URLFILECACHEFLAGS::NONE)
ifnoerr
#define ifnoerr(...)
The opposite of iferr.
定义: errorbase.h:385
iferr_return
#define iferr_return
定义: resultbase.h:1434
maxon::BaseArray< Char >
maxon::Url
定义: url.h:819
MaxonConvert
maxon::Url MaxonConvert(const Filename &fn, MAXONCONVERTMODE convertMode)
maxon::UrlFileCacheInterface::IsAccessible
static MAXON_METHOD Bool IsAccessible(const maxon::Url &url)
MAXONCONVERTMODE::READ
@ READ
Check for file read operation.
IMAGERESULT
IMAGERESULT
定义: ge_prepass.h:3659