diff options
Diffstat (limited to 'engines/sword25/kernel/resmanager.h')
-rw-r--r-- | engines/sword25/kernel/resmanager.h | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/engines/sword25/kernel/resmanager.h b/engines/sword25/kernel/resmanager.h index 940a04147b..7f438bb709 100644 --- a/engines/sword25/kernel/resmanager.h +++ b/engines/sword25/kernel/resmanager.h @@ -35,14 +35,12 @@ #ifndef SWORD25_RESOURCEMANAGER_H #define SWORD25_RESOURCEMANAGER_H -// Includes #include "common/list.h" #include "sword25/kernel/common.h" namespace Sword25 { -// Class definitions class ResourceService; class Resource; class Kernel; @@ -55,7 +53,7 @@ public: * Returns a requested resource. If any error occurs, returns NULL * @param FileName Filename of resource */ - Resource *RequestResource(const Common::String &FileName); + Resource *requestResource(const Common::String &fileName); /** * Loads a resource into the cache @@ -63,13 +61,13 @@ public: * @param ForceReload Indicates whether the file should be reloaded if it's already in the cache. * This is useful for files that may have changed in the interim */ - bool PrecacheResource(const Common::String &FileName, bool ForceReload = false); + bool precacheResource(const Common::String &fileName, bool forceReload = false); /** * Returns the number of loaded resources */ - int GetResourceCount() const { - return static_cast<int>(m_Resources.size()); + int getResourceCount() const { + return static_cast<int>(_resources.size()); } /** @@ -77,25 +75,25 @@ public: * Note: This method is not optimised for speed and should be used only for debugging purposes * @param Ord Ordinal number of the resource. Must be between 0 and GetResourceCount() - 1. */ - Resource *GetResourceByOrdinal(int Ord) const; + Resource *getResourceByOrdinal(int ord) const; /** * Registers a RegisterResourceService. This method is the constructor of * BS_ResourceService, and thus helps all resource services in the ResourceManager list * @param pService Which service */ - bool RegisterResourceService(ResourceService *pService); + bool registerResourceService(ResourceService *pService); /** * Releases all resources that are not locked. **/ - void EmptyCache(); + void emptyCache(); /** * Returns the maximum memory the kernel has used */ - int GetMaxMemoryUsage() const { - return m_MaxMemoryUsage; + int getMaxMemoryUsage() const { + return _maxMemoryUsage; } /** @@ -104,28 +102,28 @@ public: * as a guideline, and not as a fixed boundary. It is not guaranteed not to be exceeded; * the whole game engine may still use more memory than any amount specified. */ - void SetMaxMemoryUsage(uint MaxMemoryUsage); + void setMaxMemoryUsage(uint maxMemoryUsage); /** * Specifies whether a warning is written to the log when a cache miss occurs. * THe default value is "false". */ - bool IsLogCacheMiss() const { - return m_LogCacheMiss; + bool isLogCacheMiss() const { + return _logCacheMiss; } /** * Sets whether warnings are written to the log if a cache miss occurs. * @param Flag If "true", then future warnings will be logged */ - void SetLogCacheMiss(bool Flag) { - m_LogCacheMiss = Flag; + void setLogCacheMiss(bool flag) { + _logCacheMiss = flag; } /** * Writes the names of all currently locked resources to the log file */ - void DumpLockedResources(); + void dumpLockedResources(); private: /** @@ -133,9 +131,9 @@ private: * Only the BS_Kernel class can generate copies this class. Thus, the constructor is private */ ResourceManager(Kernel *pKernel) : - m_KernelPtr(pKernel), - m_MaxMemoryUsage(100000000), - m_LogCacheMiss(false) + _kernelPtr(pKernel), + _maxMemoryUsage(100000000), + _logCacheMiss(false) {} virtual ~ResourceManager(); @@ -147,7 +145,7 @@ private: * Moves a resource to the top of the resource list * @param pResource The resource */ - void MoveToFront(Resource *pResource); + void moveToFront(Resource *pResource); /** * Loads a resource and updates the m_UsedMemory total @@ -161,31 +159,31 @@ private: * Returns the full path of a given resource filename. * It will return an empty string if a path could not be created. */ - Common::String GetUniqueFileName(const Common::String &FileName) const; + Common::String getUniqueFileName(const Common::String &fileName) const; /** * Deletes a resource, removes it from the lists, and updates m_UsedMemory */ - Common::List<Resource *>::iterator DeleteResource(Resource *pResource); + Common::List<Resource *>::iterator deleteResource(Resource *pResource); /** * Returns a pointer to a loaded resource. If any error occurs, NULL will be returned. * @param UniqueFileName The absolute path and filename * Gibt einen Pointer auf die angeforderte Resource zurück, oder NULL, wenn die Resourcen nicht geladen ist. */ - Resource *GetResource(const Common::String &UniqueFileName) const; + Resource *getResource(const Common::String &uniqueFileName) const; /** * Deletes resources as necessary until the specified memory limit is not being exceeded. */ - void DeleteResourcesIfNecessary(); - - Kernel *m_KernelPtr; - uint m_MaxMemoryUsage; - Common::Array<ResourceService *> m_ResourceServices; - Common::List<Resource *> m_Resources; - Common::List<Resource *> m_ResourceHashTable[HASH_TABLE_BUCKETS]; - bool m_LogCacheMiss; + void deleteResourcesIfNecessary(); + + Kernel *_kernelPtr; + uint _maxMemoryUsage; + Common::Array<ResourceService *> _resourceServices; + Common::List<Resource *> _resources; + Common::List<Resource *> _resourceHashTable[HASH_TABLE_BUCKETS]; + bool _logCacheMiss; }; } // End of namespace Sword25 |