mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Make DocumentationEngine into a singleton object
Add documentation to DocumentationEngine Add unique identifier to Documentation class (and enforce in DocumentationEngine)
This commit is contained in:
@@ -27,24 +27,55 @@
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
|
||||
#include <ghoul/designpattern/singleton.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
|
||||
namespace openspace {
|
||||
namespace documentation {
|
||||
|
||||
class DocumentationEngine {
|
||||
/**
|
||||
* The DocumentationEngine has the ability to collect all Documentation%s that are
|
||||
* produced in the application an write them out as a documentation file for human
|
||||
* consumption.
|
||||
*/
|
||||
class DocumentationEngine : public ghoul::Singleton<DocumentationEngine> {
|
||||
public:
|
||||
struct DuplicateDocumentationException : public ghoul::RuntimeError {
|
||||
DuplicateDocumentationException(Documentation documentation);
|
||||
|
||||
Documentation documentation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Write the collected Documentation%s to disk at the \p filename in the specified
|
||||
* \p type. A new file is created and silently overwritten in the location that
|
||||
* \p filename is pointed to.
|
||||
* \param filename The file that is to be created containing all the Documentation
|
||||
* information.
|
||||
* \param type The type of documentation that is written. Currently allowed values are
|
||||
* \c text and \c html
|
||||
*/
|
||||
void writeDocumentation(const std::string& filename, const std::string& type);
|
||||
|
||||
void addDocumentation(Documentation doc);
|
||||
/**
|
||||
* Adds the \p documentation to the list of Documentation%s that are written to a
|
||||
* documentation file with the writeDocumentation method.
|
||||
* \param documentation The Documentation object that is to be stored for later use
|
||||
* \throws DuplicateDocumentationException If the \p documentation did not have a
|
||||
* unique identifier
|
||||
*/
|
||||
void addDocumentation(Documentation documentation);
|
||||
|
||||
static DocumentationEngine& ref();
|
||||
|
||||
private:
|
||||
/// The list of all Documentation%s that are stored by the DocumentationEngine
|
||||
std::vector<Documentation> _documentations;
|
||||
|
||||
};
|
||||
|
||||
} // namespace documentation
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
#define DocEng (openspace::documentation::DocumentationEngine::ref())
|
||||
|
||||
#endif // __DOCUMENTATIONENGINE_H__
|
||||
|
||||
Reference in New Issue
Block a user