cmCPackIFWCommon.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <map>
  6. #include <string>
  7. class cmCPackIFWGenerator;
  8. class cmXMLWriter;
  9. /** \class cmCPackIFWCommon
  10. * \brief A base class for CPack IFW generator implementation subclasses
  11. */
  12. class cmCPackIFWCommon
  13. {
  14. public:
  15. // Constructor
  16. /**
  17. * Construct Part
  18. */
  19. cmCPackIFWCommon();
  20. public:
  21. // Internal implementation
  22. const char* GetOption(const std::string& op) const;
  23. bool IsOn(const std::string& op) const;
  24. bool IsSetToOff(const std::string& op) const;
  25. bool IsSetToEmpty(const std::string& op) const;
  26. /**
  27. * Compare \a version with QtIFW framework version
  28. */
  29. bool IsVersionLess(const char* version);
  30. /**
  31. * Compare \a version with QtIFW framework version
  32. */
  33. bool IsVersionGreater(const char* version);
  34. /**
  35. * Compare \a version with QtIFW framework version
  36. */
  37. bool IsVersionEqual(const char* version);
  38. /** Expand the list argument containing the map of the key-value pairs.
  39. * If the number of elements is odd, then the first value is used as the
  40. * default value with an empty key.
  41. * Any values with the same keys will be permanently overwritten.
  42. */
  43. static void ExpandListArgument(const std::string& arg,
  44. std::map<std::string, std::string>& argsOut);
  45. /** Expand the list argument containing the multimap of the key-value pairs.
  46. * If the number of elements is odd, then the first value is used as the
  47. * default value with an empty key.
  48. */
  49. static void ExpandListArgument(
  50. const std::string& arg, std::multimap<std::string, std::string>& argsOut);
  51. cmCPackIFWGenerator* Generator;
  52. protected:
  53. void WriteGeneratedByToStrim(cmXMLWriter& xout);
  54. };
  55. #define cmCPackIFWLogger(logType, msg) \
  56. do { \
  57. std::ostringstream cmCPackLog_msg; \
  58. cmCPackLog_msg << msg; \
  59. if (Generator) { \
  60. Generator->Logger->Log(cmCPackLog::LOG_##logType, __FILE__, __LINE__, \
  61. cmCPackLog_msg.str().c_str()); \
  62. } \
  63. } while (false)