Commit 6aceadac authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor: Fix "! condition" coding style

Change-Id: I216b74933f5e94c49be7f05f0b09ac01b3319d8c
Reviewed-by: default avatarAurindam Jana <aurindam.jana@digia.com>
parent dbb1cb84
...@@ -50,12 +50,12 @@ bool CppAutoCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor, ...@@ -50,12 +50,12 @@ bool CppAutoCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor,
{ {
QChar ch; QChar ch;
if (! textToInsert.isEmpty()) if (!textToInsert.isEmpty())
ch = textToInsert.at(0); ch = textToInsert.at(0);
if (! (MatchingText::shouldInsertMatchingText(cursor) if (!(MatchingText::shouldInsertMatchingText(cursor)
|| ch == QLatin1Char('\'') || ch == QLatin1Char('\'')
|| ch == QLatin1Char('"'))) || ch == QLatin1Char('"')))
return false; return false;
else if (isInCommentHelper(cursor)) else if (isInCommentHelper(cursor))
return false; return false;
......
...@@ -243,7 +243,7 @@ struct CanonicalSymbol ...@@ -243,7 +243,7 @@ struct CanonicalSymbol
const QTextCursor &cursor, const QTextCursor &cursor,
QString *code) QString *code)
{ {
if (! info.doc) if (!info.doc)
return 0; return 0;
QTextCursor tc = cursor; QTextCursor tc = cursor;
...@@ -255,8 +255,8 @@ struct CanonicalSymbol ...@@ -255,8 +255,8 @@ struct CanonicalSymbol
int pos = tc.position(); int pos = tc.position();
if (! isIdentifierChar(document->characterAt(pos))) if (!isIdentifierChar(document->characterAt(pos)))
if (! (pos > 0 && isIdentifierChar(document->characterAt(pos - 1)))) if (!(pos > 0 && isIdentifierChar(document->characterAt(pos - 1))))
return 0; return 0;
while (isIdentifierChar(document->characterAt(pos))) while (isIdentifierChar(document->characterAt(pos)))
...@@ -293,7 +293,7 @@ struct CanonicalSymbol ...@@ -293,7 +293,7 @@ struct CanonicalSymbol
const LookupItem &r = results.at(i); const LookupItem &r = results.at(i);
Symbol *decl = r.declaration(); Symbol *decl = r.declaration();
if (! (decl && decl->enclosingScope())) if (!(decl && decl->enclosingScope()))
break; break;
if (Class *classScope = r.declaration()->enclosingScope()->asClass()) { if (Class *classScope = r.declaration()->enclosingScope()->asClass()) {
...@@ -771,7 +771,7 @@ void CPPEditorWidget::onDocumentUpdated() ...@@ -771,7 +771,7 @@ void CPPEditorWidget::onDocumentUpdated()
const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Document::Ptr doc) const const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Document::Ptr doc) const
{ {
if (! doc) if (!doc)
return 0; return 0;
int line, col; int line, col;
...@@ -883,7 +883,7 @@ void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &inf ...@@ -883,7 +883,7 @@ void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &inf
{ {
abortRename(); abortRename();
if (! info.doc) if (!info.doc)
return; return;
if (const Macro *macro = findCanonicalMacro(textCursor(), info.doc)) { if (const Macro *macro = findCanonicalMacro(textCursor(), info.doc)) {
...@@ -934,7 +934,7 @@ void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &inf ...@@ -934,7 +934,7 @@ void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &inf
} else { } else {
const QList<QTextEdit::ExtraSelection> selections = extraSelections(CodeSemanticsSelection); const QList<QTextEdit::ExtraSelection> selections = extraSelections(CodeSemanticsSelection);
if (! selections.isEmpty()) if (!selections.isEmpty())
setExtraSelections(CodeSemanticsSelection, QList<QTextEdit::ExtraSelection>()); setExtraSelections(CodeSemanticsSelection, QList<QTextEdit::ExtraSelection>());
} }
} }
...@@ -1011,7 +1011,7 @@ void CPPEditorWidget::jumpToOutlineElement(int index) ...@@ -1011,7 +1011,7 @@ void CPPEditorWidget::jumpToOutlineElement(int index)
modelIndex = m_proxyModel->index(index, 0); // toplevel index modelIndex = m_proxyModel->index(index, 0); // toplevel index
QModelIndex sourceIndex = m_proxyModel->mapToSource(modelIndex); QModelIndex sourceIndex = m_proxyModel->mapToSource(modelIndex);
Symbol *symbol = m_outlineModel->symbolFromIndex(sourceIndex); Symbol *symbol = m_outlineModel->symbolFromIndex(sourceIndex);
if (! symbol) if (!symbol)
return; return;
openCppEditorAt(linkToSymbol(symbol)); openCppEditorAt(linkToSymbol(symbol));
...@@ -1248,10 +1248,10 @@ static inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolv ...@@ -1248,10 +1248,10 @@ static inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolv
const FullySpecifiedType ty = result.type().simplified(); const FullySpecifiedType ty = result.type().simplified();
if (ty->isForwardClassDeclarationType()) { if (ty->isForwardClassDeclarationType()) {
while (! candidates.isEmpty()) { while (!candidates.isEmpty()) {
LookupItem r = candidates.takeFirst(); LookupItem r = candidates.takeFirst();
if (! r.type()->isForwardClassDeclarationType()) { if (!r.type()->isForwardClassDeclarationType()) {
result = r; result = r;
break; break;
} }
...@@ -1259,10 +1259,10 @@ static inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolv ...@@ -1259,10 +1259,10 @@ static inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolv
} }
if (ty->isObjCForwardClassDeclarationType()) { if (ty->isObjCForwardClassDeclarationType()) {
while (! candidates.isEmpty()) { while (!candidates.isEmpty()) {
LookupItem r = candidates.takeFirst(); LookupItem r = candidates.takeFirst();
if (! r.type()->isObjCForwardClassDeclarationType()) { if (!r.type()->isObjCForwardClassDeclarationType()) {
result = r; result = r;
break; break;
} }
...@@ -1270,10 +1270,10 @@ static inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolv ...@@ -1270,10 +1270,10 @@ static inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolv
} }
if (ty->isObjCForwardProtocolDeclarationType()) { if (ty->isObjCForwardProtocolDeclarationType()) {
while (! candidates.isEmpty()) { while (!candidates.isEmpty()) {
LookupItem r = candidates.takeFirst(); LookupItem r = candidates.takeFirst();
if (! r.type()->isObjCForwardProtocolDeclarationType()) { if (!r.type()->isObjCForwardProtocolDeclarationType()) {
result = r; result = r;
break; break;
} }
...@@ -1359,7 +1359,7 @@ CPPEditorWidget::Link CPPEditorWidget::attemptFuncDeclDef(const QTextCursor &cur ...@@ -1359,7 +1359,7 @@ CPPEditorWidget::Link CPPEditorWidget::attemptFuncDeclDef(const QTextCursor &cur
CPPEditorWidget::Link CPPEditorWidget::findMacroLink(const QByteArray &name) const CPPEditorWidget::Link CPPEditorWidget::findMacroLink(const QByteArray &name) const
{ {
if (! name.isEmpty()) { if (!name.isEmpty()) {
if (Document::Ptr doc = m_lastSemanticInfo.doc) { if (Document::Ptr doc = m_lastSemanticInfo.doc) {
const Snapshot snapshot = m_modelManager->snapshot(); const Snapshot snapshot = m_modelManager->snapshot();
QSet<QString> processed; QSet<QString> processed;
...@@ -1375,7 +1375,7 @@ CPPEditorWidget::Link CPPEditorWidget::findMacroLink(const QByteArray &name, ...@@ -1375,7 +1375,7 @@ CPPEditorWidget::Link CPPEditorWidget::findMacroLink(const QByteArray &name,
const Snapshot &snapshot, const Snapshot &snapshot,
QSet<QString> *processed) const QSet<QString> *processed) const
{ {
if (doc && ! name.startsWith('<') && ! processed->contains(doc->fileName())) { if (doc && !name.startsWith('<') && !processed->contains(doc->fileName())) {
processed->insert(doc->fileName()); processed->insert(doc->fileName());
foreach (const Macro &macro, doc->definedMacros()) { foreach (const Macro &macro, doc->definedMacros()) {
...@@ -1476,7 +1476,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo ...@@ -1476,7 +1476,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo
if (tokens.at(j).is(T_LPAREN)) { if (tokens.at(j).is(T_LPAREN)) {
++depth; ++depth;
} else if (tokens.at(j).is(T_RPAREN)) { } else if (tokens.at(j).is(T_RPAREN)) {
if (! --depth) if (!--depth)
break; break;
} }
} }
...@@ -1508,7 +1508,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo ...@@ -1508,7 +1508,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo
const QTextBlock block = tc.block(); const QTextBlock block = tc.block();
int pos = cursor.positionInBlock(); int pos = cursor.positionInBlock();
QChar ch = document()->characterAt(cursor.position()); QChar ch = document()->characterAt(cursor.position());
if (pos > 0 && ! (ch.isLetterOrNumber() || ch == QLatin1Char('_'))) if (pos > 0 && !(ch.isLetterOrNumber() || ch == QLatin1Char('_')))
--pos; // positionInBlock points to a delimiter character. --pos; // positionInBlock points to a delimiter character.
const Token tk = SimpleLexer::tokenAt(block.text(), pos, const Token tk = SimpleLexer::tokenAt(block.text(), pos,
BackwardsScanner::previousBlockState(block), true); BackwardsScanner::previousBlockState(block), true);
...@@ -1567,7 +1567,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo ...@@ -1567,7 +1567,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo
const QChar ch = document()->characterAt(pos); const QChar ch = document()->characterAt(pos);
if (ch.isSpace()) if (ch.isSpace())
continue; continue;
if (ch == QLatin1Char('(') && ! expression.isEmpty()) { if (ch == QLatin1Char('(') && !expression.isEmpty()) {
tc.setPosition(pos); tc.setPosition(pos);
if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true)) if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true))
expression.append(tc.selectedText()); expression.append(tc.selectedText());
...@@ -1648,7 +1648,7 @@ Symbol *CPPEditorWidget::findDefinition(Symbol *symbol, const Snapshot &snapshot ...@@ -1648,7 +1648,7 @@ Symbol *CPPEditorWidget::findDefinition(Symbol *symbol, const Snapshot &snapshot
if (symbol->isFunction()) if (symbol->isFunction())
return 0; // symbol is a function definition. return 0; // symbol is a function definition.
else if (! symbol->type()->isFunctionType()) else if (!symbol->type()->isFunctionType())
return 0; // not a function declaration return 0; // not a function declaration
return symbolFinder()->findMatchingDefinition(symbol, snapshot); return symbolFinder()->findMatchingDefinition(symbol, snapshot);
...@@ -1729,7 +1729,7 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e) ...@@ -1729,7 +1729,7 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QSignalMapper mapper; QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (! isOutdated()) { if (!isOutdated()) {
TextEditor::IAssistInterface *interface = TextEditor::IAssistInterface *interface =
createAssistInterface(TextEditor::QuickFix, TextEditor::ExplicitlyInvoked); createAssistInterface(TextEditor::QuickFix, TextEditor::ExplicitlyInvoked);
if (interface) { if (interface) {
...@@ -2057,7 +2057,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo) ...@@ -2057,7 +2057,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
setExtraSelections(UnusedSymbolSelection, unusedSelections); setExtraSelections(UnusedSymbolSelection, unusedSelections);
if (! m_renameSelections.isEmpty()) if (!m_renameSelections.isEmpty())
setExtraSelections(CodeSemanticsSelection, m_renameSelections); // ### setExtraSelections(CodeSemanticsSelection, m_renameSelections); // ###
else else
markSymbols(textCursor(), semanticInfo); markSymbols(textCursor(), semanticInfo);
......
...@@ -373,7 +373,7 @@ void CppEditorPlugin::onAllTasksFinished(const QString &type) ...@@ -373,7 +373,7 @@ void CppEditorPlugin::onAllTasksFinished(const QString &type)
void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor) void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor)
{ {
if (! editor) if (!editor)
return; return;
if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget())) if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget()))
......
...@@ -175,8 +175,8 @@ void CppHighlighter::highlightBlock(const QString &text) ...@@ -175,8 +175,8 @@ void CppHighlighter::highlightBlock(const QString &text)
// we need to insert a close comment parenthesis, if // we need to insert a close comment parenthesis, if
// - the line starts in a C Comment (initalState != 0) // - the line starts in a C Comment (initalState != 0)
// - the first token of the line is a T_COMMENT (i == 0 && tk.is(T_COMMENT)) // - the first token of the line is a T_COMMENT (i == 0 && tk.is(T_COMMENT))
// - is not a continuation line (tokens.size() > 1 || ! state) // - is not a continuation line (tokens.size() > 1 || !state)
if (initialState && i == 0 && (tokens.size() > 1 || ! state)) { if (initialState && i == 0 && (tokens.size() > 1 || !state)) {
--braceDepth; --braceDepth;
// unless we are at the end of the block, we reduce the folding indent // unless we are at the end of the block, we reduce the folding indent
if (i == tokens.size()-1) if (i == tokens.size()-1)
...@@ -206,7 +206,7 @@ void CppHighlighter::highlightBlock(const QString &text) ...@@ -206,7 +206,7 @@ void CppHighlighter::highlightBlock(const QString &text)
if (text.length() > lastTokenEnd) if (text.length() > lastTokenEnd)
highlightLine(text, lastTokenEnd, text.length() - lastTokenEnd, m_formats[CppVisualWhitespace]); highlightLine(text, lastTokenEnd, text.length() - lastTokenEnd, m_formats[CppVisualWhitespace]);
if (! initialState && state && ! tokens.isEmpty()) { if (!initialState && state && !tokens.isEmpty()) {
parentheses.append(Parenthesis(Parenthesis::Opened, QLatin1Char('+'), parentheses.append(Parenthesis(Parenthesis::Opened, QLatin1Char('+'),
tokens.last().begin())); tokens.last().begin()));
++braceDepth; ++braceDepth;
...@@ -356,7 +356,7 @@ void CppHighlighter::highlightWord(QStringRef word, int position, int length) ...@@ -356,7 +356,7 @@ void CppHighlighter::highlightWord(QStringRef word, int position, int length)
|| (word.at(1) == QLatin1Char('T') && word.at(2) == QLatin1Char('_'))) { // QT_ || (word.at(1) == QLatin1Char('T') && word.at(2) == QLatin1Char('_'))) { // QT_
for (int i = 1; i < word.length(); ++i) { for (int i = 1; i < word.length(); ++i) {
const QChar &ch = word.at(i); const QChar &ch = word.at(i);
if (! (ch.isUpper() || ch == QLatin1Char('_'))) if (!(ch.isUpper() || ch == QLatin1Char('_')))
return; return;
} }
...@@ -375,7 +375,7 @@ void CppHighlighter::highlightDoxygenComment(const QString &text, int position, ...@@ -375,7 +375,7 @@ void CppHighlighter::highlightDoxygenComment(const QString &text, int position,
const QTextCharFormat &format = m_formats[CppDoxygenCommentFormat]; const QTextCharFormat &format = m_formats[CppDoxygenCommentFormat];
const QTextCharFormat &kwFormat = m_formats[CppDoxygenTagFormat]; const QTextCharFormat &kwFormat = m_formats[CppDoxygenTagFormat];
while (! it->isNull()) { while (!it->isNull()) {
if (it->unicode() == QLatin1Char('\\') || if (it->unicode() == QLatin1Char('\\') ||
it->unicode() == QLatin1Char('@')) { it->unicode() == QLatin1Char('@')) {
++it; ++it;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment