cmQtAutoUicHelpers.cxx 830 B

12345678910111213141516171819202122232425
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmQtAutoUicHelpers.h"
  4. cmQtAutoUicHelpers::cmQtAutoUicHelpers()
  5. {
  6. RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+"
  7. "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
  8. }
  9. void cmQtAutoUicHelpers::CollectUicIncludes(std::set<std::string>& includes,
  10. const std::string& content) const
  11. {
  12. if (content.find("ui_") == std::string::npos) {
  13. return;
  14. }
  15. const char* contentChars = content.c_str();
  16. cmsys::RegularExpressionMatch match;
  17. while (this->RegExpInclude.find(contentChars, match)) {
  18. includes.emplace(match.match(2));
  19. // Forward content pointer
  20. contentChars += match.end();
  21. }
  22. }