RegexExplorer.h 883 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 <string>
  5. #include <QDialog>
  6. #include "cmsys/RegularExpression.hxx"
  7. #include "ui_RegexExplorer.h"
  8. class QString;
  9. class QWidget;
  10. class RegexExplorer
  11. : public QDialog
  12. , public Ui::RegexExplorer
  13. {
  14. Q_OBJECT
  15. public:
  16. RegexExplorer(QWidget* p);
  17. private slots:
  18. void on_regularExpression_textChanged(const QString& text);
  19. void on_inputText_textChanged();
  20. void on_matchNumber_currentIndexChanged(int index);
  21. void on_matchAll_toggled(bool checked);
  22. private:
  23. static void setStatusColor(QWidget* widget, bool successful);
  24. static bool stripEscapes(std::string& regex);
  25. void clearMatch();
  26. cmsys::RegularExpression m_regexParser;
  27. std::string m_text;
  28. std::string m_regex;
  29. bool m_matched;
  30. };