cmQtAutoGen.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmQtAutoGen_h
  4. #define cmQtAutoGen_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. /** \class cmQtAutoGen
  9. * \brief Common base class for QtAutoGen classes
  10. */
  11. class cmQtAutoGen
  12. {
  13. public:
  14. /// @brief Nested lists separator
  15. static std::string const ListSep;
  16. /// @brief Maximum number of parallel threads/processes in a generator
  17. static unsigned int const ParallelMax;
  18. /// @brief AutoGen generator type
  19. enum class GeneratorT
  20. {
  21. GEN, // General
  22. MOC,
  23. UIC,
  24. RCC
  25. };
  26. public:
  27. /// @brief Returns the generator name
  28. static std::string const& GeneratorName(GeneratorT genType);
  29. /// @brief Returns the generator name in upper case
  30. static std::string GeneratorNameUpper(GeneratorT genType);
  31. /// @brief Returns a the string escaped and enclosed in quotes
  32. static std::string Quoted(std::string const& text);
  33. static std::string QuotedCommand(std::vector<std::string> const& command);
  34. /// @brief Returns the parent directory of the file with a "/" suffix
  35. static std::string SubDirPrefix(std::string const& filename);
  36. /// @brief Appends the suffix to the filename before the last dot
  37. static std::string AppendFilenameSuffix(std::string const& filename,
  38. std::string const& suffix);
  39. /// @brief Merges newOpts into baseOpts
  40. static void UicMergeOptions(std::vector<std::string>& baseOpts,
  41. std::vector<std::string> const& newOpts,
  42. bool isQt5);
  43. /// @brief Merges newOpts into baseOpts
  44. static void RccMergeOptions(std::vector<std::string>& baseOpts,
  45. std::vector<std::string> const& newOpts,
  46. bool isQt5);
  47. /// @brief Parses the content of a qrc file
  48. ///
  49. /// Use when rcc does not support the "--list" option
  50. static void RccListParseContent(std::string const& content,
  51. std::vector<std::string>& files);
  52. /// @brief Parses the output of the "rcc --list ..." command
  53. static bool RccListParseOutput(std::string const& rccStdOut,
  54. std::string const& rccStdErr,
  55. std::vector<std::string>& files,
  56. std::string& error);
  57. /// @brief Converts relative qrc entry paths to full paths
  58. static void RccListConvertFullPath(std::string const& qrcFileDir,
  59. std::vector<std::string>& files);
  60. };
  61. #endif