00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "CeylanModule.h"
00028
00029 #include "CeylanStringUtils.h"
00030 #include "CeylanLogPlug.h"
00031 #include "CeylanOperators.h"
00032
00033
00034 #include <list>
00035
00036
00037
00038 using std::string ;
00039
00040 using namespace Ceylan ;
00041 using namespace Ceylan::Log ;
00042
00043
00044
00045 ModuleException::ModuleException( const std::string & message ) :
00046 Ceylan::Exception( message )
00047 {
00048
00049 }
00050
00051
00052
00053 ModuleException::~ModuleException() throw()
00054 {
00055
00056 }
00057
00058
00059
00060
00061 Module::Module( const string & name,
00062 const string & description,
00063 const string & homepageURL,
00064 const string & author,
00065 const string & authorMail,
00066 const Version & version,
00067 const string & licence ) :
00068 Object(),
00069 _name( name ),
00070 _description( description ),
00071 _homepageURL( homepageURL ),
00072 _author( author ),
00073 _authorMail( authorMail ),
00074 _version(),
00075 _licence( licence )
00076 {
00077
00078 setVersion( version ) ;
00079
00080 send( "Creating " + toString( low ) ) ;
00081
00082 }
00083
00084
00085
00086 Module::Module() :
00087 Object(),
00088 _name(),
00089 _description(),
00090 _homepageURL(),
00091 _author(),
00092 _authorMail(),
00093 _version(),
00094 _licence()
00095 {
00096
00097 send( "Creating a blank module" ) ;
00098
00099 }
00100
00101
00102
00103 Module::~Module() throw()
00104 {
00105
00106 send( "Deleting " + toString( low ) ) ;
00107
00108 }
00109
00110
00111
00112 string Module::getName() const
00113 {
00114
00115 return _name ;
00116
00117 }
00118
00119
00120
00121 void Module::setName( const string & name )
00122 {
00123
00124 _name = name ;
00125
00126 }
00127
00128
00129
00130 string Module::getDescription() const
00131 {
00132
00133 return _description ;
00134
00135 }
00136
00137
00138
00139 void Module::setDescription( const string & description )
00140 {
00141
00142 _description = description ;
00143
00144 }
00145
00146
00147
00148 string Module::getHomePage() const
00149 {
00150
00151 return _homepageURL ;
00152
00153 }
00154
00155
00156
00157 void Module::setHomePage( const string & homePage )
00158 {
00159
00160 _homepageURL = homePage ;
00161
00162 }
00163
00164
00165
00166 string Module::getAuthor() const
00167 {
00168
00169 return _author ;
00170
00171 }
00172
00173
00174
00175 void Module::setAuthor( const string & author )
00176 {
00177
00178 _author = author ;
00179
00180 }
00181
00182
00183
00184 string Module::getAuthorMail() const
00185 {
00186
00187 return _authorMail ;
00188
00189 }
00190
00191
00192
00193 void Module::setAuthorMail( const string & authorMail )
00194 {
00195
00196 _authorMail = authorMail ;
00197
00198 }
00199
00200
00201
00202 const Version & Module::getVersion() const
00203 {
00204
00205 return _version ;
00206
00207 }
00208
00209
00210
00211 void Module::setVersion( const Version & version )
00212 {
00213
00214 _version.setMajorNumber( version.getMajorNumber() ) ;
00215 _version.setMinorNumber( version.getMinorNumber() ) ;
00216 _version.setReleaseNumber( version.getReleaseNumber() ) ;
00217
00218 }
00219
00220
00221
00222
00223 string Module::getLicence() const
00224 {
00225
00226 return _licence ;
00227
00228 }
00229
00230
00231
00232 void Module::setLicence( const string & licence )
00233 {
00234
00235 _licence = licence ;
00236
00237 }
00238
00239
00240
00241 const string Module::toString( VerbosityLevels level ) const
00242 {
00243
00244 string res ;
00245
00246 res = "Module " + getName() + ", version " + _version.toString() ;
00247
00248 if ( level == low )
00249 return res ;
00250
00251 std::list<string> moduleList ;
00252
00253 moduleList.push_back( "Description: " + _description + "." ) ;
00254
00255 if ( TextDisplayable::GetOutputFormat() == TextDisplayable::html )
00256 {
00257
00258 moduleList.push_back( "<a href=\"" + _homepageURL
00259 + "\" target=\"_blank\">Homepage</a>" ) ;
00260 moduleList.push_back( "<a href=\"mailto:" + _authorMail
00261 + "\">" + _author + "</a>" ) ;
00262
00263 }
00264 else
00265 {
00266
00267 moduleList.push_back( "Home page: " + _homepageURL + "." ) ;
00268 moduleList.push_back( "Author: " + _author + " ("
00269 + _authorMail + ")." ) ;
00270
00271 }
00272
00273 moduleList.push_back( "Released through licence " + _licence + "." ) ;
00274
00275 return res + ": " + formatStringList( moduleList ) ;
00276
00277 }
00278