CrystalSpace

Public API Reference

CS::Utility::VfsHierarchicalCache Class Reference

This is a general cache that can cache data on VFS. More...

#include <csutil/vfshiercache.h>

Inheritance diagram for CS::Utility::VfsHierarchicalCache:

List of all members.

Public Member Functions

 VfsHierarchicalCache (iObjectRegistry *object_reg, const char *vfsdir)
 Construct the cache with the given directory.
iHierarchicalCache implementation



virtual bool CacheData (const void *data, size_t size, const char *path)
 Cache some data.
virtual bool ClearCache (const char *path)
 Clear items from the cache.
virtual void Flush ()
 Ensure that the cached data is written on whatever medium is behind the cache.
virtual csPtr< iHierarchicalCacheGetRootedCache (const char *base)
 Create a new hierarchical cache which is a view of this cache with the items root at base.
virtual csPtr< iStringArrayGetSubItems (const char *path)
 Get cache items directly under path.
virtual iHierarchicalCacheGetTopCache ()
 Get the cache which is the ultimate hierarchical ancestor of a cache.
virtual bool IsCacheWriteable () const
 Query if cache can be written to (as some caches may be static/read-only).
virtual csPtr< iDataBufferReadCache (const char *path)
 Retrieve some data from the cache.

Detailed Description

This is a general cache that can cache data on VFS.

Definition at line 41 of file vfshiercache.h.


Constructor & Destructor Documentation

CS::Utility::VfsHierarchicalCache::VfsHierarchicalCache ( iObjectRegistry object_reg,
const char *  vfsdir 
)

Construct the cache with the given directory.

All cached data will be put somewhere in that directory.


Member Function Documentation

virtual bool CS::Utility::VfsHierarchicalCache::CacheData ( const void *  data,
size_t  size,
const char *  path 
) [virtual]

Cache some data.

Returns true if this succeeded. path needs to be absolute.

Implements iHierarchicalCache.

virtual bool CS::Utility::VfsHierarchicalCache::ClearCache ( const char *  path  )  [virtual]

Clear items from the cache.

Clears all items below the given path. path needs to be absolute.

Implements iHierarchicalCache.

virtual void CS::Utility::VfsHierarchicalCache::Flush (  )  [virtual]

Ensure that the cached data is written on whatever medium is behind the cache.

Implements iHierarchicalCache.

virtual csPtr<iHierarchicalCache> CS::Utility::VfsHierarchicalCache::GetRootedCache ( const char *  base  )  [virtual]

Create a new hierarchical cache which is a view of this cache with the items root at base.

You can imagine the returned cache prepending base to all item requests or storage.

Implements iHierarchicalCache.

virtual csPtr<iStringArray> CS::Utility::VfsHierarchicalCache::GetSubItems ( const char *  path  )  [virtual]

Get cache items directly under path.

Implements iHierarchicalCache.

virtual iHierarchicalCache* CS::Utility::VfsHierarchicalCache::GetTopCache (  )  [virtual]

Get the cache which is the ultimate hierarchical ancestor of a cache.

Implements iHierarchicalCache.

virtual bool CS::Utility::VfsHierarchicalCache::IsCacheWriteable (  )  const [inline, virtual]

Query if cache can be written to (as some caches may be static/read-only).

Implements iHierarchicalCache.

Definition at line 80 of file vfshiercache.h.

virtual csPtr<iDataBuffer> CS::Utility::VfsHierarchicalCache::ReadCache ( const char *  path  )  [virtual]

Retrieve some data from the cache.

Returns 0 if the data could not be found in the cache. path needs to be absolute.

Remarks:
Don't modify returned buffer!

Implements iHierarchicalCache.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1