OpenWalnut
1.4.0
|
A class abstracting module meta information. More...
#include <WModuleMetaInformation.h>
Classes | |
struct | Author |
Structure to contain all supported author information. More... | |
struct | Online |
Structure to encapsulate the META info online resources. More... | |
struct | Screenshot |
Structure to encapsulate a screenshot info. More... | |
Public Types | |
typedef boost::shared_ptr < WModuleMetaInformation > | SPtr |
Convenience typedef for a boost::shared_ptr< WModuleMetaInformation >. | |
typedef boost::shared_ptr < const WModuleMetaInformation > | ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WModuleMetaInformation >. | |
Public Member Functions | |
WModuleMetaInformation (std::string name) | |
Constructor. | |
WModuleMetaInformation (boost::shared_ptr< WModule > module) | |
Construct a meta info object that loads all information from the specified file. | |
virtual | ~WModuleMetaInformation () |
Destructor. | |
std::string | getName () const |
The name of the module. | |
boost::filesystem::path | getIcon () const |
Get the icon path. | |
bool | isIconAvailable () const |
Check whether the meta info contained an icon. | |
std::string | getWebsite () const |
The URL to a module website. | |
std::string | getDescription () const |
A module description. | |
boost::filesystem::path | getHelp () const |
Path to a text or HTML file containing some module help. | |
std::vector< Author > | getAuthors () const |
A list of authors. | |
std::vector< Online > | getOnlineResources () const |
A list of online resources. | |
std::vector< std::string > | getTags () const |
A list of tags provided for the module. | |
std::vector< Screenshot > | getScreenshots () const |
Returns the list of screenshots. | |
Private Attributes | |
std::string | m_name |
The name of the module providing this meta information. | |
std::string | m_description |
The default description if none was specified in the META file. | |
WStructuredTextParser::StructuredValueTree | m_metaData |
The tree representing the data. | |
bool | m_loaded |
If true, m_metaData should be queried in all getters. | |
boost::filesystem::path | m_localPath |
The module local path. |
A class abstracting module meta information.
It encapsulates module name, description, icon, author lists, help resources, online resources and much more. It is guaranteed to, at least, provide a module name. Everything else is optional. It also encapsulates the WStructuredTextParser class for loading the data.
Definition at line 43 of file WModuleMetaInformation.h.
typedef boost::shared_ptr< const WModuleMetaInformation > WModuleMetaInformation::ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WModuleMetaInformation >.
Definition at line 54 of file WModuleMetaInformation.h.
typedef boost::shared_ptr< WModuleMetaInformation > WModuleMetaInformation::SPtr |
Convenience typedef for a boost::shared_ptr< WModuleMetaInformation >.
Definition at line 49 of file WModuleMetaInformation.h.
WModuleMetaInformation::WModuleMetaInformation | ( | std::string | name | ) | [explicit] |
Constructor.
The help object will be empty, meaning there is no further meta info available. The name is the only required value. Of course, this is of limited use in most cases.
name | the name of the module |
Definition at line 36 of file WModuleMetaInformation.cpp.
WModuleMetaInformation::WModuleMetaInformation | ( | boost::shared_ptr< WModule > | module | ) | [explicit] |
Construct a meta info object that loads all information from the specified file.
If the file exist and could not be parsed, only an error log is printed. No exception is thrown.
module | The module to load the meta file for. |
Definition at line 43 of file WModuleMetaInformation.cpp.
References wlog::error(), WStructuredTextParser::StructuredValueTree::exists(), m_loaded, m_metaData, m_name, and WException::what().
WModuleMetaInformation::~WModuleMetaInformation | ( | ) | [virtual] |
std::vector< WModuleMetaInformation::Author > WModuleMetaInformation::getAuthors | ( | ) | const |
A list of authors.
If the META file did not contain any author information, this returns the OpenWalnut Team as author.
Definition at line 144 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getValue(), WStructuredTextParser::StructuredValueTree::getValues(), m_loaded, m_metaData, and m_name.
std::string WModuleMetaInformation::getDescription | ( | ) | const |
A module description.
Can be empty but is initialized with the description of the module given on construction.
Definition at line 120 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getValue(), m_description, m_loaded, m_metaData, and m_name.
boost::filesystem::path WModuleMetaInformation::getHelp | ( | ) | const |
Path to a text or HTML file containing some module help.
Can be invalid. Check for existence before opening.
Definition at line 132 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getValue(), m_loaded, m_localPath, m_metaData, and m_name.
boost::filesystem::path WModuleMetaInformation::getIcon | ( | ) | const |
Get the icon path.
Can be invalid. Check for existence before opening.
Definition at line 84 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getValue(), m_loaded, m_localPath, m_metaData, and m_name.
std::string WModuleMetaInformation::getName | ( | ) | const |
The name of the module.
Will always return the name of the module given on construction.
Definition at line 79 of file WModuleMetaInformation.cpp.
References m_name.
std::vector< WModuleMetaInformation::Online > WModuleMetaInformation::getOnlineResources | ( | ) | const |
A list of online resources.
Can be empty.
Definition at line 181 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getSubTrees(), WModuleMetaInformation::Online::m_description, m_loaded, m_metaData, WModuleMetaInformation::Online::m_name, m_name, and WModuleMetaInformation::Online::m_url.
std::vector< WModuleMetaInformation::Screenshot > WModuleMetaInformation::getScreenshots | ( | ) | const |
Returns the list of screenshots.
Definition at line 229 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getSubTrees(), WModuleMetaInformation::Screenshot::m_description, WModuleMetaInformation::Screenshot::m_filename, m_loaded, m_metaData, and m_name.
std::vector< std::string > WModuleMetaInformation::getTags | ( | ) | const |
A list of tags provided for the module.
Definition at line 217 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getValues(), m_loaded, m_metaData, and m_name.
std::string WModuleMetaInformation::getWebsite | ( | ) | const |
The URL to a module website.
Can be empty.
Definition at line 108 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::getValue(), m_loaded, m_metaData, and m_name.
bool WModuleMetaInformation::isIconAvailable | ( | ) | const |
Check whether the meta info contained an icon.
Definition at line 96 of file WModuleMetaInformation.cpp.
References WStructuredTextParser::StructuredValueTree::exists(), m_loaded, m_metaData, and m_name.
std::string WModuleMetaInformation::m_description [private] |
The default description if none was specified in the META file.
Initialized with the description of the module specified during construction.
Definition at line 223 of file WModuleMetaInformation.h.
Referenced by getDescription().
bool WModuleMetaInformation::m_loaded [private] |
If true, m_metaData should be queried in all getters.
If false, you can query m_meta but it will only tell you that the desired value could not be found.
Definition at line 234 of file WModuleMetaInformation.h.
Referenced by getAuthors(), getDescription(), getHelp(), getIcon(), getOnlineResources(), getScreenshots(), getTags(), getWebsite(), isIconAvailable(), and WModuleMetaInformation().
boost::filesystem::path WModuleMetaInformation::m_localPath [private] |
The module local path.
Used for several meta infos returning a path.
Definition at line 239 of file WModuleMetaInformation.h.
The tree representing the data.
Definition at line 228 of file WModuleMetaInformation.h.
Referenced by getAuthors(), getDescription(), getHelp(), getIcon(), getOnlineResources(), getScreenshots(), getTags(), getWebsite(), isIconAvailable(), and WModuleMetaInformation().
std::string WModuleMetaInformation::m_name [private] |
The name of the module providing this meta information.
Definition at line 217 of file WModuleMetaInformation.h.
Referenced by getAuthors(), getDescription(), getHelp(), getIcon(), getName(), getOnlineResources(), getScreenshots(), getTags(), getWebsite(), isIconAvailable(), and WModuleMetaInformation().