30 #include "../common/WException.h"
31 #include "../common/WLogger.h"
32 #include "../common/WStructuredTextParser.h"
34 #include "WModuleMetaInformation.h"
44 m_name( module->getName() ),
45 m_description( module->getDescription() ),
47 m_localPath( module->getLocalPath() )
50 boost::filesystem::path metafile = module->getLocalPath() /
"META";
51 if( !boost::filesystem::exists( metafile ) )
59 m_metaData = WStructuredTextParser::StructuredValueTree( metafile );
65 wlog::error(
"Module (" +
m_name +
")" ) <<
"Meta file loaded but no entry for module \"" <<
m_name <<
"\" found. Ignoring.";
89 return boost::filesystem::path();
137 return boost::filesystem::path();
146 std::vector< WModuleMetaInformation::Author > r;
159 std::vector< std::string > authors =
m_metaData.getValues< std::string >(
m_name +
"/author" );
161 if( authors.empty() )
169 r.resize( authors.size() );
170 for( std::vector< std::string >::const_iterator i = authors.begin(); i != authors.end(); ++i )
172 r[ i - authors.begin() ].m_name = *i;
173 r[ i - authors.begin() ].m_email =
m_metaData.getValue< std::string >(
m_name +
"/" + *i +
"/email",
"" );
174 r[ i - authors.begin() ].m_what =
m_metaData.getValue< std::string >(
m_name +
"/" + *i +
"/what",
"" );
175 r[ i - authors.begin() ].m_url =
m_metaData.getValue< std::string >(
m_name +
"/" + *i +
"/url",
"" );
183 std::vector< WModuleMetaInformation::Online > r;
191 typedef std::vector< WStructuredTextParser::StructuredValueTree > TreeList;
193 for( TreeList::const_iterator i = onlineInfos.begin(); i != onlineInfos.end(); ++i )
200 o.
m_name = ( *i ).getValue< std::string >(
"name",
"" );
201 o.
m_url = ( *i ).getValue< std::string >(
"url",
"" );
208 o.
m_description = ( *i ).getValue< std::string >(
"description",
"" );
222 return std::vector< std::string >();
231 std::vector< WModuleMetaInformation::Screenshot > r;
239 typedef std::vector< WStructuredTextParser::StructuredValueTree > TreeList;
240 TreeList screenshotInfos =
m_metaData.getSubTrees(
m_name +
"/screenshot" );
241 for( TreeList::const_iterator i = screenshotInfos.begin(); i != screenshotInfos.end(); ++i )
248 s.
m_filename = ( *i ).getValue< boost::filesystem::path >(
"filename",
"" );
255 s.
m_description = ( *i ).getValue< std::string >(
"description",
"" );
virtual const char * what() const
Returns the message string set on throw.
WStreamedLogger error(const std::string &source)
Logging an error message.