diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2017-04-27 20:51:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-03 15:32:05 (GMT) |
commit | 9c13e8eb6fcc249afaf905d67e24b63884c4aa2f (patch) | |
tree | d120100d80cfaee00c0e369c00dddb1bee27c9c7 /Source/CPack/IFW/cmCPackIFWPackage.cxx | |
parent | 96820279541017402c1fe0852444aac68179ddb7 (diff) | |
download | CMake-9c13e8eb6fcc249afaf905d67e24b63884c4aa2f.zip CMake-9c13e8eb6fcc249afaf905d67e24b63884c4aa2f.tar.gz CMake-9c13e8eb6fcc249afaf905d67e24b63884c4aa2f.tar.bz2 |
CPackIFW: Refactor out some commonly used code
Move common used code to new cmCPackIFWCommon base class.
Diffstat (limited to 'Source/CPack/IFW/cmCPackIFWPackage.cxx')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 93 |
1 files changed, 17 insertions, 76 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index eda383f..7a0a00c 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -3,34 +3,19 @@ #include "cmCPackIFWPackage.h" #include "cmCPackComponentGroup.h" -#include "cmCPackGenerator.h" +#include "cmCPackIFWCommon.h" #include "cmCPackIFWGenerator.h" #include "cmCPackIFWInstaller.h" -#include "cmCPackLog.h" +#include "cmCPackLog.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" #include "cmTimestamp.h" #include "cmXMLWriter.h" -#include "cmConfigure.h" #include <map> #include <sstream> #include <stddef.h> -//----------------------------------------------------------------- Logger --- -#ifdef cmCPackLogger -#undef cmCPackLogger -#endif -#define cmCPackLogger(logType, msg) \ - do { \ - std::ostringstream cmCPackLog_msg; \ - cmCPackLog_msg << msg; \ - if (Generator) { \ - Generator->Logger->Log(logType, __FILE__, __LINE__, \ - cmCPackLog_msg.str().c_str()); \ - } \ - } while (false) - //---------------------------------------------------------- CompareStruct --- cmCPackIFWPackage::CompareStruct::CompareStruct() : Type(CompareNone) @@ -104,45 +89,8 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const //------------------------------------------------------ cmCPackIFWPackage --- cmCPackIFWPackage::cmCPackIFWPackage() - : Generator(CM_NULLPTR) - , Installer(CM_NULLPTR) -{ -} - -const char* cmCPackIFWPackage::GetOption(const std::string& op) const -{ - const char* option = Generator ? Generator->GetOption(op) : CM_NULLPTR; - return option && *option ? option : CM_NULLPTR; -} - -bool cmCPackIFWPackage::IsOn(const std::string& op) const + : Installer(CM_NULLPTR) { - return Generator ? Generator->IsOn(op) : false; -} - -bool cmCPackIFWPackage::IsSetToOff(const std::string& op) const -{ - return Generator ? Generator->IsSetToOff(op) : false; -} - -bool cmCPackIFWPackage::IsSetToEmpty(const std::string& op) const -{ - return Generator ? Generator->IsSetToEmpty(op) : false; -} - -bool cmCPackIFWPackage::IsVersionLess(const char* version) -{ - return Generator ? Generator->IsVersionLess(version) : false; -} - -bool cmCPackIFWPackage::IsVersionGreater(const char* version) -{ - return Generator ? Generator->IsVersionGreater(version) : false; -} - -bool cmCPackIFWPackage::IsVersionEqual(const char* version) -{ - return Generator ? Generator->IsVersionEqual(version) : false; } std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component) @@ -264,11 +212,11 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) Licenses.clear(); cmSystemTools::ExpandListArgument(option, Licenses); if (Licenses.size() % 2 != 0) { - cmCPackLogger( - cmCPackLog::LOG_WARNING, prefix - << "LICENSES" - << " should contain pairs of <display_name> and <file_path>." - << std::endl); + cmCPackIFWLogger( + WARNING, + prefix << "LICENSES" + << " should contain pairs of <display_name> and <file_path>." + << std::endl); Licenses.clear(); } } @@ -276,8 +224,8 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { SortingPriority = option; - cmCPackLogger( - cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set " + cmCPackIFWLogger( + WARNING, "The \"PRIORITY\" option is set " << "for component \"" << component->Name << "\", but there option is " << "deprecated. Please use \"SORTING_PRIORITY\" option instead." << std::endl); @@ -341,11 +289,11 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) Licenses.clear(); cmSystemTools::ExpandListArgument(option, Licenses); if (Licenses.size() % 2 != 0) { - cmCPackLogger( - cmCPackLog::LOG_WARNING, prefix - << "LICENSES" - << " should contain pairs of <display_name> and <file_path>." - << std::endl); + cmCPackIFWLogger( + WARNING, + prefix << "LICENSES" + << " should contain pairs of <display_name> and <file_path>." + << std::endl); Licenses.clear(); } } @@ -353,8 +301,8 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { SortingPriority = option; - cmCPackLogger( - cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set " + cmCPackIFWLogger( + WARNING, "The \"PRIORITY\" option is set " << "for component group \"" << group->Name << "\", but there option is " << "deprecated. Please use \"SORTING_PRIORITY\" option instead." @@ -714,10 +662,3 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.EndElement(); xout.EndDocument(); } - -void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout) -{ - if (Generator) { - Generator->WriteGeneratedByToStrim(xout); - } -} |