RegexExplorer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2015 Kitware, Inc., Gregor Jasny
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef RegexExplorer_h
  11. #define RegexExplorer_h
  12. #include <string>
  13. #include <cmsys/RegularExpression.hxx>
  14. #include <QDialog>
  15. #include "ui_RegexExplorer.h"
  16. class QString;
  17. class QWidget;
  18. class RegexExplorer : public QDialog, public Ui::RegexExplorer
  19. {
  20. Q_OBJECT
  21. public:
  22. RegexExplorer(QWidget* p);
  23. private slots:
  24. void on_regularExpression_textChanged(const QString& text);
  25. void on_inputText_textChanged();
  26. void on_matchNumber_currentIndexChanged(int index);
  27. private:
  28. static void setStatusColor(QWidget* widget, bool successful);
  29. static bool stripEscapes(std::string& regex);
  30. void clearMatch();
  31. cmsys::RegularExpression m_regexParser;
  32. std::string m_text;
  33. std::string m_regex;
  34. bool m_matched;
  35. };
  36. #endif