OpenWalnut  1.3.1
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
WModuleMetaInformation Class Reference

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< AuthorgetAuthors () const
 A list of authors.
std::vector< OnlinegetOnlineResources () const
 A list of online resources.
std::vector< std::string > getTags () const
 A list of tags provided for the module.
std::vector< ScreenshotgetScreenshots () 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.

Detailed Description

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.

Member Typedef Documentation

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.

Convenience typedef for a boost::shared_ptr< WModuleMetaInformation >.

Definition at line 49 of file WModuleMetaInformation.h.

Constructor & Destructor Documentation

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.

Parameters
namethe 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.

Parameters
moduleThe 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

Destructor.

Cleans internal list.

Definition at line 74 of file WModuleMetaInformation.cpp.

Member Function Documentation

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.

Returns
Author list.

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.

Returns
the description.

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.

Returns
the path to help

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.

Returns
the path to the icon file

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.

Returns
the name

Definition at line 79 of file WModuleMetaInformation.cpp.

References m_name.

std::vector< WModuleMetaInformation::Online > WModuleMetaInformation::getOnlineResources ( ) const
std::vector< WModuleMetaInformation::Screenshot > WModuleMetaInformation::getScreenshots ( ) const
std::vector< std::string > WModuleMetaInformation::getTags ( ) const

A list of tags provided for the module.

Returns
the tag list.

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.

Returns
URL to website

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.

Returns
true if icon is available. Does not check existence or validity of image file.

Definition at line 96 of file WModuleMetaInformation.cpp.

References WStructuredTextParser::StructuredValueTree::exists(), m_loaded, m_metaData, and m_name.

Member Data Documentation

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.

Referenced by getHelp(), and getIcon().

WStructuredTextParser::StructuredValueTree WModuleMetaInformation::m_metaData
private
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().


The documentation for this class was generated from the following files: