Whitespace fix
This commit is contained in:
parent
9ee1f567a5
commit
b180214152
@ -25,7 +25,7 @@ class ResourceStream
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ResourceStream() { };
|
virtual ~ResourceStream() { };
|
||||||
|
|
||||||
/// Get size of resource
|
/// Get size of resource
|
||||||
virtual size_t getSize() = 0;
|
virtual size_t getSize() = 0;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class ResourceStream
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Low level resource file interface.
|
* Low level resource file interface.
|
||||||
* Never use it, use ResourcesCollection instead.
|
* Never use it, use ResourcesCollection instead.
|
||||||
***/
|
***/
|
||||||
@ -61,7 +61,7 @@ class ResourceFile
|
|||||||
std::wstring name; /// resource file name
|
std::wstring name; /// resource file name
|
||||||
Buffer *buffer;
|
Buffer *buffer;
|
||||||
bool ownBuffer;
|
bool ownBuffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Resource file directory entry
|
/// Resource file directory entry
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -74,7 +74,7 @@ class ResourceFile
|
|||||||
} DirectoryEntry;
|
} DirectoryEntry;
|
||||||
/// List of directory entries.
|
/// List of directory entries.
|
||||||
typedef std::list<DirectoryEntry> Directory;
|
typedef std::list<DirectoryEntry> Directory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Create resource file. Throws exception if file can't be opened.
|
/// Create resource file. Throws exception if file can't be opened.
|
||||||
/// \param fileName the name of resource file.
|
/// \param fileName the name of resource file.
|
||||||
@ -94,20 +94,20 @@ class ResourceFile
|
|||||||
/// \param offset offset from start of resource file to packed data
|
/// \param offset offset from start of resource file to packed data
|
||||||
/// \param packedSize size of packed resource
|
/// \param packedSize size of packed resource
|
||||||
/// \param unpackedSize size of unpacked resource
|
/// \param unpackedSize size of unpacked resource
|
||||||
void load(char *buf, long offset, long packedSize,
|
void load(char *buf, long offset, long packedSize,
|
||||||
long unpackedSize, int level);
|
long unpackedSize, int level);
|
||||||
|
|
||||||
/// Allocate buffer and load data. Memory returned by this
|
/// Allocate buffer and load data. Memory returned by this
|
||||||
/// method must be freed by free() function call.
|
/// method must be freed by free() function call.
|
||||||
/// \param offset offset from start of resource file to packed data
|
/// \param offset offset from start of resource file to packed data
|
||||||
/// \param packedSize size of packed resource
|
/// \param packedSize size of packed resource
|
||||||
/// \param unpackedSize size of unpacked resource
|
/// \param unpackedSize size of unpacked resource
|
||||||
void* load(long offset, long packedSize, long unpackedSize,
|
void* load(long offset, long packedSize, long unpackedSize,
|
||||||
int level);
|
int level);
|
||||||
|
|
||||||
/// Get priority of this resource file.
|
/// Get priority of this resource file.
|
||||||
int getPriority() const { return priority; };
|
int getPriority() const { return priority; };
|
||||||
|
|
||||||
/// Get the name of resource file.
|
/// Get the name of resource file.
|
||||||
const std::wstring& getFileName() const { return name; };
|
const std::wstring& getFileName() const { return name; };
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ class SimpleResourceFile: public ResourceFile
|
|||||||
private:
|
private:
|
||||||
typedef std::map<std::wstring, DirectoryEntry> DirectoryMap;
|
typedef std::map<std::wstring, DirectoryEntry> DirectoryMap;
|
||||||
DirectoryMap directory; /// Directory map.
|
DirectoryMap directory; /// Directory map.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Open resource file. Throws exception if file can't be opened.
|
/// Open resource file. Throws exception if file can't be opened.
|
||||||
/// \param fileName the name of resource file.
|
/// \param fileName the name of resource file.
|
||||||
@ -156,7 +156,7 @@ class SimpleResourceFile: public ResourceFile
|
|||||||
|
|
||||||
|
|
||||||
/// Internationalized resource entity.
|
/// Internationalized resource entity.
|
||||||
class ResVariant
|
class ResVariant
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int i18nScore;
|
int i18nScore;
|
||||||
@ -167,7 +167,7 @@ class ResVariant
|
|||||||
int refCnt;
|
int refCnt;
|
||||||
void *data;
|
void *data;
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Create resource variation.
|
/// Create resource variation.
|
||||||
/// \param file reesource file
|
/// \param file reesource file
|
||||||
@ -175,18 +175,18 @@ class ResVariant
|
|||||||
/// \param entry entry in global resources directory
|
/// \param entry entry in global resources directory
|
||||||
ResVariant(ResourceFile *file, int score,
|
ResVariant(ResourceFile *file, int score,
|
||||||
const ResourceFile::DirectoryEntry &entry);
|
const ResourceFile::DirectoryEntry &entry);
|
||||||
|
|
||||||
~ResVariant();
|
~ResVariant();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Return locale compability score.
|
/// Return locale compability score.
|
||||||
int getI18nScore() const { return i18nScore; };
|
int getI18nScore() const { return i18nScore; };
|
||||||
|
|
||||||
/// Get pointer to unpacked resource data.
|
/// Get pointer to unpacked resource data.
|
||||||
/// Must be freed after use this delRef()
|
/// Must be freed after use this delRef()
|
||||||
void* getRef();
|
void* getRef();
|
||||||
|
|
||||||
/// Get pointer to unpacked resource data and return resource size.
|
/// Get pointer to unpacked resource data and return resource size.
|
||||||
/// Must be freed after use this delRef().
|
/// Must be freed after use this delRef().
|
||||||
/// \param size returned size of resource data.
|
/// \param size returned size of resource data.
|
||||||
void* getRef(size_t &size);
|
void* getRef(size_t &size);
|
||||||
@ -212,7 +212,7 @@ class ResVariant
|
|||||||
/// Return data in buffer
|
/// Return data in buffer
|
||||||
/// \param buffer buffer to store data.
|
/// \param buffer buffer to store data.
|
||||||
void getData(Buffer &buffer);
|
void getData(Buffer &buffer);
|
||||||
|
|
||||||
/// Create ResourceStream for resource.
|
/// Create ResourceStream for resource.
|
||||||
/// This may be usefull for large streams unpacked data,
|
/// This may be usefull for large streams unpacked data,
|
||||||
/// for example video and sound.
|
/// for example video and sound.
|
||||||
@ -223,7 +223,7 @@ class ResVariant
|
|||||||
|
|
||||||
/// Internationalized resources.
|
/// Internationalized resources.
|
||||||
/// Collection of localized data (ResVariant) with single name.
|
/// Collection of localized data (ResVariant) with single name.
|
||||||
class Resource
|
class Resource
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef std::vector<ResVariant*> Variants;
|
typedef std::vector<ResVariant*> Variants;
|
||||||
@ -262,7 +262,7 @@ class Resource
|
|||||||
/// \param variant variant number.
|
/// \param variant variant number.
|
||||||
void* getRef(int variant=0);
|
void* getRef(int variant=0);
|
||||||
|
|
||||||
/// Load data from variant.
|
/// Load data from variant.
|
||||||
/// data must be freed with delRef()
|
/// data must be freed with delRef()
|
||||||
/// \param size size of data.
|
/// \param size size of data.
|
||||||
/// \param variant variant number.
|
/// \param variant variant number.
|
||||||
@ -278,12 +278,12 @@ class Resource
|
|||||||
|
|
||||||
/// Get name of this resource.
|
/// Get name of this resource.
|
||||||
const std::wstring& getName() const { return name; };
|
const std::wstring& getName() const { return name; };
|
||||||
|
|
||||||
/// Load data into buffer.
|
/// Load data into buffer.
|
||||||
/// \param buffer buffer for data.
|
/// \param buffer buffer for data.
|
||||||
/// \param variant variant number.
|
/// \param variant variant number.
|
||||||
void getData(Buffer &buffer, int variant=0);
|
void getData(Buffer &buffer, int variant=0);
|
||||||
|
|
||||||
/// Create ResourceStream for resource.
|
/// Create ResourceStream for resource.
|
||||||
/// This may be usefull for large streams unpacked data,
|
/// This may be usefull for large streams unpacked data,
|
||||||
/// for example video and sound.
|
/// for example video and sound.
|
||||||
@ -295,7 +295,7 @@ class Resource
|
|||||||
|
|
||||||
/// Internationalized resource files collection.
|
/// Internationalized resource files collection.
|
||||||
/// When ResourceCollection created all resources checked against
|
/// When ResourceCollection created all resources checked against
|
||||||
/// current locale. Resources not belonged to current locale are
|
/// current locale. Resources not belonged to current locale are
|
||||||
/// ignored, resources that can be used in current locale sorted
|
/// ignored, resources that can be used in current locale sorted
|
||||||
/// by locale relevance score.
|
/// by locale relevance score.
|
||||||
/// All resources names interpeted as name[_language][_COUNTRY].extension
|
/// All resources names interpeted as name[_language][_COUNTRY].extension
|
||||||
@ -314,46 +314,46 @@ class ResourcesCollection
|
|||||||
private:
|
private:
|
||||||
/// Map resource names to resources.
|
/// Map resource names to resources.
|
||||||
typedef std::map<std::wstring, Resource*> ResourcesMap;
|
typedef std::map<std::wstring, Resource*> ResourcesMap;
|
||||||
|
|
||||||
/// List of resources.
|
/// List of resources.
|
||||||
typedef std::list<Resource*> ResourcesList;
|
typedef std::list<Resource*> ResourcesList;
|
||||||
|
|
||||||
/// Map group names to resources list.
|
/// Map group names to resources list.
|
||||||
typedef std::map<std::wstring, ResourcesList> ResourcesListMap;
|
typedef std::map<std::wstring, ResourcesList> ResourcesListMap;
|
||||||
|
|
||||||
/// List of resource files.
|
/// List of resource files.
|
||||||
typedef std::vector<ResourceFile*> ResourceFiles;
|
typedef std::vector<ResourceFile*> ResourceFiles;
|
||||||
|
|
||||||
ResourcesMap resources; /// Map of all available resources.
|
ResourcesMap resources; /// Map of all available resources.
|
||||||
ResourcesListMap groups; /// Map of all available groups.
|
ResourcesListMap groups; /// Map of all available groups.
|
||||||
ResourceFiles files; /// List of resource files.
|
ResourceFiles files; /// List of resource files.
|
||||||
Buffer buffer; /// Temporary buffer for resource files.
|
Buffer buffer; /// Temporary buffer for resource files.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Load resource files, make grouping and i18n optimizations.
|
/// Load resource files, make grouping and i18n optimizations.
|
||||||
ResourcesCollection(StringList &directories);
|
ResourcesCollection(StringList &directories);
|
||||||
~ResourcesCollection();
|
~ResourcesCollection();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Returns resource entry.
|
/// Returns resource entry.
|
||||||
/// If resource not found Exception will be thrown.
|
/// If resource not found Exception will be thrown.
|
||||||
Resource* getResource(const std::wstring &name);
|
Resource* getResource(const std::wstring &name);
|
||||||
|
|
||||||
/// Load resource.
|
/// Load resource.
|
||||||
/// Loaded data must be freed with delRef method.
|
/// Loaded data must be freed with delRef method.
|
||||||
void* getRef(const std::wstring &name, int &size);
|
void* getRef(const std::wstring &name, int &size);
|
||||||
|
|
||||||
/// Load resource.
|
/// Load resource.
|
||||||
/// Loaded data must be freed with delRef method.
|
/// Loaded data must be freed with delRef method.
|
||||||
void* getRef(const std::wstring &name);
|
void* getRef(const std::wstring &name);
|
||||||
|
|
||||||
/// Delete reference to resource.
|
/// Delete reference to resource.
|
||||||
void delRef(void *data);
|
void delRef(void *data);
|
||||||
|
|
||||||
/// Visit all group members.
|
/// Visit all group members.
|
||||||
void forEachInGroup(const std::wstring &groupName,
|
void forEachInGroup(const std::wstring &groupName,
|
||||||
Visitor<Resource*> &visitor);
|
Visitor<Resource*> &visitor);
|
||||||
|
|
||||||
/// Create ResourceStream for resource.
|
/// Create ResourceStream for resource.
|
||||||
/// This may be usefull for large streams unpacked data,
|
/// This may be usefull for large streams unpacked data,
|
||||||
/// for example video and sound.
|
/// for example video and sound.
|
||||||
@ -382,7 +382,7 @@ class ResDataHolder
|
|||||||
private:
|
private:
|
||||||
void *data;
|
void *data;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Create holder without data
|
/// Create holder without data
|
||||||
ResDataHolder();
|
ResDataHolder();
|
||||||
@ -404,10 +404,9 @@ class ResDataHolder
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Global collection of resources.
|
/// Global collection of resources.
|
||||||
/// Careated at first step at boot time stage2
|
/// Careated at first step at boot time stage2
|
||||||
extern ResourcesCollection *resources;
|
extern ResourcesCollection *resources;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user