Rbuild: Added "description" field to the various backend factories, and then used the description field to generate the help text.

(updated the patch in bugzilla bug #790)


svn path=/trunk/; revision=20844
This commit is contained in:
Nathan Woods 2006-01-14 01:00:56 +00:00
parent 0dfeb869d7
commit 45846ec6ea
6 changed files with 30 additions and 8 deletions

View file

@ -29,13 +29,15 @@ Backend::Factory::factories = NULL;
int
Backend::Factory::ref = 0;
Backend::Factory::Factory ( const std::string& name_ )
Backend::Factory::Factory ( const std::string& name_, const std::string& description_ )
{
string name(name_);
strlwr ( &name[0] );
if ( !ref++ )
factories = new map<string,Factory*>;
(*factories)[name] = this;
m_name = name;
m_description = description_;
}
Backend::Factory::~Factory ()

View file

@ -32,10 +32,12 @@ public:
{
static std::map<std::string,Factory*>* factories;
static int ref;
std::string m_name;
std::string m_description;
protected:
Factory ( const std::string& name_ );
Factory ( const std::string& name_, const std::string& description_ );
virtual ~Factory();
virtual Backend* operator() ( Project&,
@ -45,6 +47,19 @@ public:
static Backend* Create ( const std::string& name,
Project& project,
Configuration& configuration );
static std::map<std::string,Factory*>::iterator map_begin(void)
{
return factories->begin();
}
static std::map<std::string,Factory*>::iterator map_end(void)
{
return factories->end();
}
const char *Name(void) { return m_name.c_str(); }
const char *Description(void) { return m_description.c_str(); }
};
protected:

View file

@ -32,7 +32,7 @@ static class DevCppFactory : public Backend::Factory
{
public:
DevCppFactory() : Factory("devcpp") {}
DevCppFactory() : Factory("devcpp", "Dev C++") {}
Backend *operator() (Project &project,
Configuration& configuration)
{

View file

@ -58,7 +58,7 @@ v2s ( const string_list& v, int wrap_at )
static class MingwFactory : public Backend::Factory
{
public:
MingwFactory() : Factory ( "mingw" ) {}
MingwFactory() : Factory ( "mingw", "Minimalist GNU Win32" ) {}
Backend* operator() ( Project& project,
Configuration& configuration )
{

View file

@ -38,7 +38,7 @@ static class MSVCFactory : public Backend::Factory
{
public:
MSVCFactory() : Factory("MSVC") {}
MSVCFactory() : Factory("MSVC", "Microsoft Visual C") {}
Backend *operator() (Project &project,
Configuration& configuration)
{

View file

@ -17,6 +17,7 @@
*/
#include "pch.h"
#include <typeinfo>
#include <algorithm>
#include <stdio.h>
#ifdef WIN32
@ -239,9 +240,13 @@ main ( int argc, char** argv )
printf ( " -vs{version} Version of MS VS project files. Default is %s.\n", MS_VS_DEF_VERSION );
printf ( "\n" );
printf ( " buildsystem Target build system. Can be one of:\n" );
printf ( " mingw MinGW\n" );
printf ( " devcpp DevC++\n" );
printf ( " msvc MS Visual Studio\n" );
std::map<std::string,Backend::Factory*>::iterator iter;
for (iter = Backend::Factory::map_begin(); iter != Backend::Factory::map_end(); iter++)
{
Backend::Factory *factory = iter->second;
printf ( " %-10s %s\n", factory->Name(), factory->Description());
}
return 1;
}
try