Skip to content
Snippets Groups Projects
Commit 99ef026d authored by Oliver Bock's avatar Oliver Bock
Browse files

Even more doxygen updates

parent a04c14ee
No related branches found
No related tags found
No related merge requests found
......@@ -8,19 +8,18 @@
#include "Resource.h"
/**
* \brief This factory instantiates Resource objects using a given identifier
* \brief This factory instantiates %Resource objects using a given identifier
*
* During contruction of the factory object itself it loads all available resources into
* an internal cache. The user can subsequently request a copy of this resource by specifying
* it using the resource's identifier.
*
* The resource data is expected to be stored in these three externally linked arrays:
* <ul>
* <li>\ref c_ResourceIdentifiers</li>
* <li>\ref c_ResourceIndex</li>
* <li>\ref c_ResourceStorage</li>
* </ul>
* These arrays are compiled using the Open Resource Compiler (ORC) which can be found
* - \ref c_ResourceIdentifiers
* - \ref c_ResourceIndex
* - \ref c_ResourceStorage
*
* These arrays are compiled using the Open %Resource Compiler (ORC) which can be found
* in the \c orc subdirectory.
*
* \see Resource
......@@ -73,12 +72,8 @@ extern const string c_ResourceIdentifiers[];
* This two-dimensional array contains the necessary indices for
* every resource in the storage container. Using these indices you
* can easily extract a requested resource:
* <ol>
* <li>Offset to the resource</li>
* <li>Length of the resource</li>
* </ol>
*
* \see c_ResourceStorage
* -# Offset to the resource
* -# Length of the resource
*
* \todo Does this need to be global?
* Maybe we should wrap a class around the generated resources?
......@@ -92,8 +87,6 @@ extern const unsigned int c_ResourceIndex[][2];
* expressed as hex values. Use the resource index to locate/retrieve
* a specific resource from the container.
*
* \see c_ResourceIndex
*
* \todo Does this need to be global?
* Maybe we should wrap a class around the generated resources?
*/
......
......@@ -11,22 +11,86 @@
using namespace std;
/**
* \brief Helper class that converts binary resources into source code ready for compilation
*
* This "compiler" takes a resource specification file, opens and loads the physical
* files and converts their contents into normal C/C++ source code. The source code
* comprises three arrays which can be subsequently compiled into object code which is
* then referenced by ResourceFactory using external linkage.
* \n
* %Resource specification file format:
* - Each line describes one resource
* - The descriptor has to look like this: LogicalResourceName|PhysicalResourceName
* - Lines starting with # are treated as comments
* - Empty lines are ignored
*
* As you can see the logical and the physical (file) resource name are delimited by the pipe (|) character.
* The logical resource name will be used again later. It is the identifier used to request a resource via
* ResourceFactory::createInstance()
*
* \see ResourceFactory
* \see ResourceFactory::c_ResourceIdentifiers
* \see ResourceFactory::c_ResourceIndex
* \see ResourceFactory::c_ResourceStorage
*/
class ResourceCompiler
{
public:
/**
* \brief Constructor
*
* \param inputFilename Name of the resource specification file (source, \c *.orc)
* \param outputFilename Name of the converted recources file (destination, \c *.cpp)
*/
ResourceCompiler(const string inputFilename, const string outputFilename);
/// Destructor
virtual ~ResourceCompiler();
/**
* \brief Converts the specified resources into the specified source code file
*
* It iterates over all resources found in the local cache and stores their data
* and meta information as source code in the destination file. Thus parseInputFile()
* and loadBinaryData() have to be called first for this to work.
*
* \see parseInputFile
* \see loadBinaryData
*/
void compile();
private:
/**
* \brief Parses the specified input file
*
* After validating the resource specification file its contents are
* stored for later use.
*
* \see loadBinaryData
*/
void parseInputFile();
/**
* \brief Loads binary resource file data into the local cache
*
* This methods tries to open all resource files found by loadBinaryData()
* and copies their binary data into the local cache.
*
* \see parseInputFile
*/
void loadBinaryData();
/// Path and filename of the resource specification file (source)
string m_ResourceSpecFile;
/// Path and filename of the converted source code file (destination)
string m_ResourceCodeFile;
/// Mapping between logical and physical resource names
map<string, string> m_ResourceFileMap;
/// %Resource cache (identified by logical resource name)
map<string, vector<unsigned char> > m_ResourceDataMap;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment