#include <imageutils/imagecache.h>
Public Member Functions | |
wxImageCache () | |
~wxImageCache () | |
void | Init () |
Initialize members. | |
void | Clear () |
Clear cache and index. | |
void | ClearCache () |
Clear current cache (resets internal storage for one folder). | |
void | ClearIndex () |
Clear index. | |
void | ClearAllCacheFiles () |
Delete all cache files. | |
bool | LoadFolderCache (const wxString &folder, bool force=false) |
Loads the cache items for this folder, if any. | |
bool | LoadCacheIndex (bool force=false) |
Loads the cache index, if any. | |
bool | SaveFolderCache () |
Saves the current cache items for this folder, if any. | |
bool | SaveCacheIndex () |
Saves the cache index, if necessary. | |
bool | AddCacheItem (wxImageCacheItem *item) |
Adds a cache item. | |
bool | AddCacheItem (const wxImage &image, const wxString &filename, const wxSize &sz) |
Adds a cache image. | |
bool | NewCache (const wxString &folder) |
Creates a new cache, and marks the cache as modified. | |
bool | UpdateCache () |
Saves the current folder cache (if modified) and index. | |
bool | PurgeCache (const wxSize &sz=wxDefaultSize) |
Purges the current cache of any items that are out of date w.r.t. | |
wxImageCacheItem * | FindCacheItem (const wxString &filename) |
void | DeleteCacheItem (wxImageCacheItem *item) |
void | SetCacheStorageFolder (const wxString &folder) |
Set the cache storage folder. | |
const wxString & | GetCacheStorageFolder () const |
Get the cache folder. | |
void | SetCacheStorageFolderFromTemp () |
Set the cache folder as the default directory for temporary files. | |
void | SetCurrentCacheFolder (const wxString &folder) |
Set the current cache folder. | |
const wxString & | GetCurrentCacheFolder () const |
Get the current cache folder. | |
bool | IsCacheLoaded () const |
Is a cache loaded? | |
void | SetModified (bool mod) |
Mark current folder cache as modified or not. | |
bool | IsModified () const |
Have modifications been made? | |
void | SetIndexModified (bool mod) |
Mark index as modified or not. | |
void | SetIndexName (const wxString &name) |
Set the index custom name. | |
void | Enable (bool enable) |
Whether the cache is enabled. | |
bool | IsIndexModified () const |
Have index modifications been made? | |
wxString | GetIndexFilename () const |
Get the index filename. | |
wxString | GetIndexName () const |
Get the index filename root. | |
wxString | GetCacheFilename () const |
Get the filename for the current folder cache. | |
wxString | GetFullPath (const wxString &filename) const |
Get full path (where the image actually is). | |
wxString | GetFullCachePath (const wxString &filename) const |
Get full cache path (in the cache folder). | |
bool | IsEnabled () const |
Whether the cache is enabled. | |
bool | ModifiedMoreRecently (const wxDateTime &date, const wxString &filename) |
Implementation. | |
wxDateTime | GetModificationTime (const wxString &filename) |
Get the modification time. | |
wxString | GetTempDir () const |
Get a suitable temporary directory. | |
wxString | MakeNewCacheFilename (const wxString &folder) const |
Make a new filename for the given folder. | |
void | AddToIndex (const wxString &folder) |
Add the folder to the index if necessary. | |
Protected Attributes | |
wxString | m_cacheStorageFolder |
Where the index and cache files are stored. | |
wxString | m_currentFolder |
Current folder, where m_cacheItems refer to this folder. | |
wxDateTime | m_indexLoaded |
Date of the last index file load. | |
wxList | m_cacheItems |
The cache items for the current folder. | |
wxArrayString | m_indexFolders |
Cache index folders. | |
wxArrayString | m_indexPaths |
Cache index cache file paths. | |
int | m_maxCachedFolders |
Maximum number of folders to store in cache. | |
bool | m_modified |
Whether we may have a folder cache to save. | |
bool | m_indexModified |
Whether the index itself has been modified. | |
bool | m_enabled |
Whether the cache is enabled. | |
wxString | m_indexName |
Custom index cache name. |
wxImageCache::wxImageCache | ( | ) | [inline] |
wxImageCache::~wxImageCache | ( | ) | [inline] |
bool wxImageCache::AddCacheItem | ( | const wxImage & | image, | |
const wxString & | filename, | |||
const wxSize & | sz | |||
) |
Adds a cache image.
bool wxImageCache::AddCacheItem | ( | wxImageCacheItem * | item | ) |
Adds a cache item.
void wxImageCache::AddToIndex | ( | const wxString & | folder | ) |
Add the folder to the index if necessary.
void wxImageCache::Clear | ( | ) |
Clear cache and index.
void wxImageCache::ClearAllCacheFiles | ( | ) |
Delete all cache files.
void wxImageCache::ClearCache | ( | ) |
Clear current cache (resets internal storage for one folder).
Clear current cache.
void wxImageCache::ClearIndex | ( | ) |
Clear index.
void wxImageCache::DeleteCacheItem | ( | wxImageCacheItem * | item | ) |
void wxImageCache::Enable | ( | bool | enable | ) | [inline] |
Whether the cache is enabled.
wxImageCacheItem * wxImageCache::FindCacheItem | ( | const wxString & | filename | ) |
wxString wxImageCache::GetCacheFilename | ( | ) | const |
Get the filename for the current folder cache.
const wxString& wxImageCache::GetCacheStorageFolder | ( | ) | const [inline] |
Get the cache folder.
const wxString& wxImageCache::GetCurrentCacheFolder | ( | ) | const [inline] |
Get the current cache folder.
wxString wxImageCache::GetFullCachePath | ( | const wxString & | filename | ) | const |
Get full cache path (in the cache folder).
Get full path in the cache folder.
wxString wxImageCache::GetFullPath | ( | const wxString & | filename | ) | const |
Get full path (where the image actually is).
Get full path.
wxString wxImageCache::GetIndexFilename | ( | ) | const |
Get the index filename.
wxString wxImageCache::GetIndexName | ( | ) | const [inline] |
Get the index filename root.
wxDateTime wxImageCache::GetModificationTime | ( | const wxString & | filename | ) |
Get the modification time.
wxString wxImageCache::GetTempDir | ( | ) | const |
Get a suitable temporary directory.
void wxImageCache::Init | ( | ) |
Initialize members.
bool wxImageCache::IsCacheLoaded | ( | ) | const [inline] |
Is a cache loaded?
bool wxImageCache::IsEnabled | ( | ) | const [inline] |
Whether the cache is enabled.
bool wxImageCache::IsIndexModified | ( | ) | const [inline] |
Have index modifications been made?
bool wxImageCache::IsModified | ( | ) | const [inline] |
Have modifications been made?
bool wxImageCache::LoadCacheIndex | ( | bool | force = false |
) |
Loads the cache index, if any.
bool wxImageCache::LoadFolderCache | ( | const wxString & | folder, | |
bool | force = false | |||
) |
Loads the cache items for this folder, if any.
If there are no cached items, will set the current folder in case new items are added.
wxString wxImageCache::MakeNewCacheFilename | ( | const wxString & | folder | ) | const |
Make a new filename for the given folder.
bool wxImageCache::ModifiedMoreRecently | ( | const wxDateTime & | date, | |
const wxString & | filename | |||
) |
Implementation.
Has the file been modified since this time?
Has the file been modified since this time?
bool wxImageCache::NewCache | ( | const wxString & | folder | ) |
Creates a new cache, and marks the cache as modified.
Index won't be updated until UpdateCache is called.
bool wxImageCache::PurgeCache | ( | const wxSize & | sz = wxDefaultSize |
) |
Purges the current cache of any items that are out of date w.r.t.
the file on disk, or are a different size from that specified.
the file on disk, or are a different size from that specified.
bool wxImageCache::SaveCacheIndex | ( | ) |
Saves the cache index, if necessary.
bool wxImageCache::SaveFolderCache | ( | ) |
Saves the current cache items for this folder, if any.
void wxImageCache::SetCacheStorageFolder | ( | const wxString & | folder | ) | [inline] |
Set the cache storage folder.
void wxImageCache::SetCacheStorageFolderFromTemp | ( | ) |
Set the cache folder as the default directory for temporary files.
void wxImageCache::SetCurrentCacheFolder | ( | const wxString & | folder | ) |
Set the current cache folder.
void wxImageCache::SetIndexModified | ( | bool | mod | ) | [inline] |
Mark index as modified or not.
void wxImageCache::SetIndexName | ( | const wxString & | name | ) | [inline] |
Set the index custom name.
void wxImageCache::SetModified | ( | bool | mod | ) | [inline] |
Mark current folder cache as modified or not.
bool wxImageCache::UpdateCache | ( | ) |
Saves the current folder cache (if modified) and index.
wxList wxImageCache::m_cacheItems [protected] |
The cache items for the current folder.
wxString wxImageCache::m_cacheStorageFolder [protected] |
Where the index and cache files are stored.
wxString wxImageCache::m_currentFolder [protected] |
Current folder, where m_cacheItems refer to this folder.
bool wxImageCache::m_enabled [protected] |
Whether the cache is enabled.
wxArrayString wxImageCache::m_indexFolders [protected] |
Cache index folders.
wxDateTime wxImageCache::m_indexLoaded [protected] |
Date of the last index file load.
bool wxImageCache::m_indexModified [protected] |
Whether the index itself has been modified.
wxString wxImageCache::m_indexName [protected] |
Custom index cache name.
wxArrayString wxImageCache::m_indexPaths [protected] |
Cache index cache file paths.
int wxImageCache::m_maxCachedFolders [protected] |
Maximum number of folders to store in cache.
bool wxImageCache::m_modified [protected] |
Whether we may have a folder cache to save.