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) Modified: trunk/reactos/tools/rbuild/backend/backend.cpp Modified: trunk/reactos/tools/rbuild/backend/backend.h Modified: trunk/reactos/tools/rbuild/backend/devcpp/devcpp.cpp Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp Modified: trunk/reactos/tools/rbuild/rbuild.cpp _____
Modified: trunk/reactos/tools/rbuild/backend/backend.cpp --- trunk/reactos/tools/rbuild/backend/backend.cpp 2006-01-14 00:51:00 UTC (rev 20843) +++ trunk/reactos/tools/rbuild/backend/backend.cpp 2006-01-14 01:00:56 UTC (rev 20844) @@ -29,13 +29,15 @@
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 () _____
Modified: trunk/reactos/tools/rbuild/backend/backend.h --- trunk/reactos/tools/rbuild/backend/backend.h 2006-01-14 00:51:00 UTC (rev 20843) +++ trunk/reactos/tools/rbuild/backend/backend.h 2006-01-14 01:00:56 UTC (rev 20844) @@ -32,10 +32,12 @@
{ static std::mapstd::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 @@ static Backend* Create ( const std::string& name, Project& project, Configuration& configuration ); + + static std::mapstd::string,Factory*::iterator map_begin(void) + { + return factories->begin(); + } + + static std::mapstd::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: _____
Modified: trunk/reactos/tools/rbuild/backend/devcpp/devcpp.cpp --- trunk/reactos/tools/rbuild/backend/devcpp/devcpp.cpp 2006-01-14 00:51:00 UTC (rev 20843) +++ trunk/reactos/tools/rbuild/backend/devcpp/devcpp.cpp 2006-01-14 01:00:56 UTC (rev 20844) @@ -32,7 +32,7 @@
{ public:
- DevCppFactory() : Factory("devcpp") {} + DevCppFactory() : Factory("devcpp", "Dev C++") {} Backend *operator() (Project &project, Configuration& configuration) { _____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp --- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2006-01-14 00:51:00 UTC (rev 20843) +++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2006-01-14 01:00:56 UTC (rev 20844) @@ -58,7 +58,7 @@
static class MingwFactory : public Backend::Factory { public: - MingwFactory() : Factory ( "mingw" ) {} + MingwFactory() : Factory ( "mingw", "Minimalist GNU Win32" ) {} Backend* operator() ( Project& project, Configuration& configuration ) { _____
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp --- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp 2006-01-14 00:51:00 UTC (rev 20843) +++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp 2006-01-14 01:00:56 UTC (rev 20844) @@ -38,7 +38,7 @@
{ public:
- MSVCFactory() : Factory("MSVC") {} + MSVCFactory() : Factory("MSVC", "Microsoft Visual C") {} Backend *operator() (Project &project, Configuration& configuration) { _____
Modified: trunk/reactos/tools/rbuild/rbuild.cpp --- trunk/reactos/tools/rbuild/rbuild.cpp 2006-01-14 00:51:00 UTC (rev 20843) +++ trunk/reactos/tools/rbuild/rbuild.cpp 2006-01-14 01:00:56 UTC (rev 20844) @@ -17,6 +17,7 @@
*/ #include "pch.h" #include <typeinfo> +#include <algorithm>
#include <stdio.h> #ifdef WIN32 @@ -239,9 +240,13 @@ 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::mapstd::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