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