diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/QtDialog/RegexExplorer.cxx | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/QtDialog/RegexExplorer.cxx')
-rw-r--r-- | Source/QtDialog/RegexExplorer.cxx | 80 |
1 files changed, 30 insertions, 50 deletions
diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx index dfcf048..d23a08c 100644 --- a/Source/QtDialog/RegexExplorer.cxx +++ b/Source/QtDialog/RegexExplorer.cxx @@ -12,16 +12,16 @@ #include "RegexExplorer.h" -RegexExplorer::RegexExplorer(QWidget* p) : QDialog(p), m_matched(false) +RegexExplorer::RegexExplorer(QWidget* p) + : QDialog(p) + , m_matched(false) { this->setupUi(this); - for(int i = 1; i < cmsys::RegularExpression::NSUBEXP; ++i) - { - matchNumber->addItem( - QString("Match %1").arg(QString::number(i)), - QVariant(i)); - } + for (int i = 1; i < cmsys::RegularExpression::NSUBEXP; ++i) { + matchNumber->addItem(QString("Match %1").arg(QString::number(i)), + QVariant(i)); + } matchNumber->setCurrentIndex(0); } @@ -44,10 +44,9 @@ void RegexExplorer::on_regularExpression_textChanged(const QString& text) bool validExpression = stripEscapes(m_regex) && m_regexParser.compile(m_regex); - if(!validExpression) - { + if (!validExpression) { m_regexParser.set_invalid(); - } + } setStatusColor(labelRegexValid, validExpression); @@ -56,8 +55,7 @@ void RegexExplorer::on_regularExpression_textChanged(const QString& text) void RegexExplorer::on_inputText_textChanged() { - if(m_regexParser.is_valid()) - { + if (m_regexParser.is_valid()) { QString plainText = inputText->toPlainText(); #ifdef QT_NO_STL m_text = plainText.toAscii().constData(); @@ -65,19 +63,16 @@ void RegexExplorer::on_inputText_textChanged() m_text = plainText.toStdString(); #endif m_matched = m_regexParser.find(m_text); - } - else - { + } else { m_matched = false; - } + } setStatusColor(labelRegexMatch, m_matched); - if(!m_matched) - { + if (!m_matched) { clearMatch(); return; - } + } #ifdef QT_NO_STL QString matchText = m_regexParser.match(0).c_str(); @@ -91,18 +86,16 @@ void RegexExplorer::on_inputText_textChanged() void RegexExplorer::on_matchNumber_currentIndexChanged(int index) { - if(!m_matched) - { + if (!m_matched) { return; - } + } QVariant itemData = matchNumber->itemData(index); int idx = itemData.toInt(); - if(idx < 1 || idx >= cmsys::RegularExpression::NSUBEXP) - { + if (idx < 1 || idx >= cmsys::RegularExpression::NSUBEXP) { return; - } + } #ifdef QT_NO_STL QString match = m_regexParser.match(idx).c_str(); @@ -125,42 +118,29 @@ bool RegexExplorer::stripEscapes(std::string& source) std::string result; result.reserve(source.size()); - for(char inc = *in; inc != '\0'; inc = *++in) - { - if(inc == '\\') - { + for (char inc = *in; inc != '\0'; inc = *++in) { + if (inc == '\\') { char nextc = in[1]; - if(nextc == 't') - { + if (nextc == 't') { result.append(1, '\t'); in++; - } - else if(nextc == 'n') - { + } else if (nextc == 'n') { result.append(1, '\n'); in++; - } - else if(nextc == 't') - { + } else if (nextc == 't') { result.append(1, '\t'); in++; - } - else if(isalnum(nextc) || nextc == '\0') - { + } else if (isalnum(nextc) || nextc == '\0') { return false; - } - else - { + } else { result.append(1, nextc); in++; - } - } - else - { - result.append(1, inc); } + } else { + result.append(1, inc); } + } - source = result; - return true; + source = result; + return true; } |