From 62decc533b03966c7584fae9b53f4e888bb711bf Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 5 Nov 2007 16:33:19 -0500 Subject: ENH: change name of class --- Source/CMakeLists.txt | 2 +- Source/CPack/cmCPackGeneratorFactory.cxx | 136 +++++++++++++++++++++++++++++++ Source/CPack/cmCPackGeneratorFactory.h | 64 +++++++++++++++ Source/CPack/cmCPackGenerators.cxx | 136 ------------------------------- Source/CPack/cmCPackGenerators.h | 64 --------------- Source/CPack/cpack.cxx | 6 +- 6 files changed, 204 insertions(+), 204 deletions(-) create mode 100644 Source/CPack/cmCPackGeneratorFactory.cxx create mode 100644 Source/CPack/cmCPackGeneratorFactory.h delete mode 100644 Source/CPack/cmCPackGenerators.cxx delete mode 100644 Source/CPack/cmCPackGenerators.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 56487cf..c67fe3e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -307,7 +307,7 @@ TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_L # Sources for CPack # SET(CPACK_SRCS - CPack/cmCPackGenerators.cxx + CPack/cmCPackGeneratorFactory.cxx CPack/cmCPackGenericGenerator.cxx CPack/cmCPackLog.cxx CPack/cmCPackNSISGenerator.cxx diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx new file mode 100644 index 0000000..a15217b --- /dev/null +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -0,0 +1,136 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include "cmCPackGeneratorFactory.h" + +#include "cmCPackGenericGenerator.h" +#include "cmCPackTGZGenerator.h" +#include "cmCPackTarBZip2Generator.h" +#include "cmCPackTarCompressGenerator.h" +#include "cmCPackZIPGenerator.h" +#include "cmCPackSTGZGenerator.h" +#include "cmCPackNSISGenerator.h" +#ifdef __APPLE__ +# include "cmCPackPackageMakerGenerator.h" +# include "cmCPackOSXX11Generator.h" +#endif + +#ifdef __CYGWIN__ +# include "cmCPackCygwinBinaryGenerator.h" +# include "cmCPackCygwinSourceGenerator.h" +#endif + +#if !defined(_WIN32) && !defined(__APPLE__) \ + && !defined(__QNXNTO__) && !defined(__BEOS__) +# include "cmCPackDebGenerator.h" +# include "cmCPackRPMGenerator.h" +#endif + + +#include "cmCPackLog.h" + +//---------------------------------------------------------------------- +cmCPackGeneratorFactory::cmCPackGeneratorFactory() +{ + this->RegisterGenerator("TGZ", "Tar GZip compression", + cmCPackTGZGenerator::CreateGenerator); + this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", + cmCPackSTGZGenerator::CreateGenerator); + this->RegisterGenerator("NSIS", "Null Soft Installer", + cmCPackNSISGenerator::CreateGenerator); +#ifdef __CYGWIN__ + this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer", + cmCPackCygwinBinaryGenerator::CreateGenerator); + this->RegisterGenerator("CygwinSource", "Cygwin Source Installer", + cmCPackCygwinSourceGenerator::CreateGenerator); +#endif + + this->RegisterGenerator("ZIP", "ZIP file format", + cmCPackZIPGenerator::CreateGenerator); + this->RegisterGenerator("TBZ2", "Tar BZip2 compression", + cmCPackTarBZip2Generator::CreateGenerator); + this->RegisterGenerator("TZ", "Tar Compress compression", + cmCPackTarCompressGenerator::CreateGenerator); +#ifdef __APPLE__ + this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer", + cmCPackPackageMakerGenerator::CreateGenerator); + this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle", + cmCPackOSXX11Generator::CreateGenerator); +#endif +#if !defined(_WIN32) && !defined(__APPLE__) \ + && !defined(__QNXNTO__) && !defined(__BEOS__) + this->RegisterGenerator("DEB", "Debian packages", + cmCPackDebGenerator::CreateGenerator); + this->RegisterGenerator("RPM", "RPM packages", + cmCPackRPMGenerator::CreateGenerator); +#endif +} + +//---------------------------------------------------------------------- +cmCPackGeneratorFactory::~cmCPackGeneratorFactory() +{ + std::vector::iterator it; + for ( it = this->Generators.begin(); it != this->Generators.end(); ++ it ) + { + delete *it; + } +} + +//---------------------------------------------------------------------- +cmCPackGenericGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) +{ + cmCPackGenericGenerator* gen = this->NewGeneratorInternal(name); + if ( !gen ) + { + return 0; + } + this->Generators.push_back(gen); + gen->SetLogger(this->Logger); + return gen; +} + +//---------------------------------------------------------------------- +cmCPackGenericGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( + const char* name) +{ + if ( !name ) + { + return 0; + } + cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it + = this->GeneratorCreators.find(name); + if ( it == this->GeneratorCreators.end() ) + { + return 0; + } + return (it->second)(); +} + +//---------------------------------------------------------------------- +void cmCPackGeneratorFactory::RegisterGenerator(const char* name, + const char* generatorDescription, + CreateGeneratorCall* createGenerator) +{ + if ( !name || !createGenerator ) + { + cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR, + "Cannot register generator" << std::endl); + return; + } + this->GeneratorCreators[name] = createGenerator; + this->GeneratorDescriptions[name] = generatorDescription; +} diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h new file mode 100644 index 0000000..4dcc55e --- /dev/null +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -0,0 +1,64 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef cmCPackGeneratorFactory_h +#define cmCPackGeneratorFactory_h + +#include "cmObject.h" + +class cmCPackLog; +class cmCPackGenericGenerator; + +/** \class cmCPackGeneratorFactory + * \brief A container for CPack generators + * + */ +class cmCPackGeneratorFactory : public cmObject +{ +public: + cmTypeMacro(cmCPackGeneratorFactory, cmObject); + + cmCPackGeneratorFactory(); + ~cmCPackGeneratorFactory(); + + //! Get the generator + cmCPackGenericGenerator* NewGenerator(const char* name); + void DeleteGenerator(cmCPackGenericGenerator* gen); + + typedef cmCPackGenericGenerator* CreateGeneratorCall(); + + void RegisterGenerator(const char* name, + const char* generatorDescription, + CreateGeneratorCall* createGenerator); + + void SetLogger(cmCPackLog* logger) { this->Logger = logger; } + + typedef std::map DescriptionsMap; + const DescriptionsMap& GetGeneratorsList() const + { return this->GeneratorDescriptions; } + +private: + cmCPackGenericGenerator* NewGeneratorInternal(const char* name); + std::vector Generators; + + typedef std::map t_GeneratorCreatorsMap; + t_GeneratorCreatorsMap GeneratorCreators; + DescriptionsMap GeneratorDescriptions; + cmCPackLog* Logger; +}; + +#endif diff --git a/Source/CPack/cmCPackGenerators.cxx b/Source/CPack/cmCPackGenerators.cxx deleted file mode 100644 index d9f3301..0000000 --- a/Source/CPack/cmCPackGenerators.cxx +++ /dev/null @@ -1,136 +0,0 @@ -/*========================================================================= - - Program: CMake - Cross-Platform Makefile Generator - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. - See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include "cmCPackGenerators.h" - -#include "cmCPackGenericGenerator.h" -#include "cmCPackTGZGenerator.h" -#include "cmCPackTarBZip2Generator.h" -#include "cmCPackTarCompressGenerator.h" -#include "cmCPackZIPGenerator.h" -#include "cmCPackSTGZGenerator.h" -#include "cmCPackNSISGenerator.h" -#ifdef __APPLE__ -# include "cmCPackPackageMakerGenerator.h" -# include "cmCPackOSXX11Generator.h" -#endif - -#ifdef __CYGWIN__ -# include "cmCPackCygwinBinaryGenerator.h" -# include "cmCPackCygwinSourceGenerator.h" -#endif - -#if !defined(_WIN32) && !defined(__APPLE__) \ - && !defined(__QNXNTO__) && !defined(__BEOS__) -# include "cmCPackDebGenerator.h" -# include "cmCPackRPMGenerator.h" -#endif - - -#include "cmCPackLog.h" - -//---------------------------------------------------------------------- -cmCPackGenerators::cmCPackGenerators() -{ - this->RegisterGenerator("TGZ", "Tar GZip compression", - cmCPackTGZGenerator::CreateGenerator); - this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", - cmCPackSTGZGenerator::CreateGenerator); - this->RegisterGenerator("NSIS", "Null Soft Installer", - cmCPackNSISGenerator::CreateGenerator); -#ifdef __CYGWIN__ - this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer", - cmCPackCygwinBinaryGenerator::CreateGenerator); - this->RegisterGenerator("CygwinSource", "Cygwin Source Installer", - cmCPackCygwinSourceGenerator::CreateGenerator); -#endif - - this->RegisterGenerator("ZIP", "ZIP file format", - cmCPackZIPGenerator::CreateGenerator); - this->RegisterGenerator("TBZ2", "Tar BZip2 compression", - cmCPackTarBZip2Generator::CreateGenerator); - this->RegisterGenerator("TZ", "Tar Compress compression", - cmCPackTarCompressGenerator::CreateGenerator); -#ifdef __APPLE__ - this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer", - cmCPackPackageMakerGenerator::CreateGenerator); - this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle", - cmCPackOSXX11Generator::CreateGenerator); -#endif -#if !defined(_WIN32) && !defined(__APPLE__) \ - && !defined(__QNXNTO__) && !defined(__BEOS__) - this->RegisterGenerator("DEB", "Debian packages", - cmCPackDebGenerator::CreateGenerator); - this->RegisterGenerator("RPM", "RPM packages", - cmCPackRPMGenerator::CreateGenerator); -#endif -} - -//---------------------------------------------------------------------- -cmCPackGenerators::~cmCPackGenerators() -{ - std::vector::iterator it; - for ( it = this->Generators.begin(); it != this->Generators.end(); ++ it ) - { - delete *it; - } -} - -//---------------------------------------------------------------------- -cmCPackGenericGenerator* cmCPackGenerators::NewGenerator(const char* name) -{ - cmCPackGenericGenerator* gen = this->NewGeneratorInternal(name); - if ( !gen ) - { - return 0; - } - this->Generators.push_back(gen); - gen->SetLogger(this->Logger); - return gen; -} - -//---------------------------------------------------------------------- -cmCPackGenericGenerator* cmCPackGenerators::NewGeneratorInternal( - const char* name) -{ - if ( !name ) - { - return 0; - } - cmCPackGenerators::t_GeneratorCreatorsMap::iterator it - = this->GeneratorCreators.find(name); - if ( it == this->GeneratorCreators.end() ) - { - return 0; - } - return (it->second)(); -} - -//---------------------------------------------------------------------- -void cmCPackGenerators::RegisterGenerator(const char* name, - const char* generatorDescription, - CreateGeneratorCall* createGenerator) -{ - if ( !name || !createGenerator ) - { - cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR, - "Cannot register generator" << std::endl); - return; - } - this->GeneratorCreators[name] = createGenerator; - this->GeneratorDescriptions[name] = generatorDescription; -} diff --git a/Source/CPack/cmCPackGenerators.h b/Source/CPack/cmCPackGenerators.h deleted file mode 100644 index 76a1697..0000000 --- a/Source/CPack/cmCPackGenerators.h +++ /dev/null @@ -1,64 +0,0 @@ -/*========================================================================= - - Program: CMake - Cross-Platform Makefile Generator - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - Copyright (c) 2002 Kitware, Inc. All rights reserved. - See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef cmCPackGenerators_h -#define cmCPackGenerators_h - -#include "cmObject.h" - -class cmCPackLog; -class cmCPackGenericGenerator; - -/** \class cmCPackGenerators - * \brief A container for CPack generators - * - */ -class cmCPackGenerators : public cmObject -{ -public: - cmTypeMacro(cmCPackGenerators, cmObject); - - cmCPackGenerators(); - ~cmCPackGenerators(); - - //! Get the generator - cmCPackGenericGenerator* NewGenerator(const char* name); - void DeleteGenerator(cmCPackGenericGenerator* gen); - - typedef cmCPackGenericGenerator* CreateGeneratorCall(); - - void RegisterGenerator(const char* name, - const char* generatorDescription, - CreateGeneratorCall* createGenerator); - - void SetLogger(cmCPackLog* logger) { this->Logger = logger; } - - typedef std::map DescriptionsMap; - const DescriptionsMap& GetGeneratorsList() const - { return this->GeneratorDescriptions; } - -private: - cmCPackGenericGenerator* NewGeneratorInternal(const char* name); - std::vector Generators; - - typedef std::map t_GeneratorCreatorsMap; - t_GeneratorCreatorsMap GeneratorCreators; - DescriptionsMap GeneratorDescriptions; - cmCPackLog* Logger; -}; - -#endif diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index bb071e9..12585e3 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -19,7 +19,7 @@ // Need these for documentation support. #include "cmake.h" #include "cmDocumentation.h" -#include "cmCPackGenerators.h" +#include "cmCPackGeneratorFactory.h" #include "cmCPackGenericGenerator.h" #include "cmake.h" #include "cmGlobalGenerator.h" @@ -232,7 +232,7 @@ int main (int argc, char *argv[]) cpackConfigFileSpecified = false; } - cmCPackGenerators generators; + cmCPackGeneratorFactory generators; generators.SetLogger(&log); cmCPackGenericGenerator* cpackGenerator = 0; @@ -453,7 +453,7 @@ int main (int argc, char *argv[]) doc.SetSection("Options",cmDocumentationOptions); std::vector v; - cmCPackGenerators::DescriptionsMap::const_iterator generatorIt; + cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt; for( generatorIt = generators.GetGeneratorsList().begin(); generatorIt != generators.GetGeneratorsList().end(); ++ generatorIt ) -- cgit v0.12