diff options
-rw-r--r-- | tools/linguist/shared/abstractproitemvisitor.h | 16 | ||||
-rw-r--r-- | tools/linguist/shared/profileevaluator.cpp | 40 | ||||
-rw-r--r-- | tools/linguist/shared/proitems.cpp | 18 |
3 files changed, 36 insertions, 38 deletions
diff --git a/tools/linguist/shared/abstractproitemvisitor.h b/tools/linguist/shared/abstractproitemvisitor.h index 0691fdc..0f312ae 100644 --- a/tools/linguist/shared/abstractproitemvisitor.h +++ b/tools/linguist/shared/abstractproitemvisitor.h @@ -49,19 +49,19 @@ QT_BEGIN_NAMESPACE struct AbstractProItemVisitor { virtual ~AbstractProItemVisitor() {} - virtual bool visitBeginProBlock(ProBlock *block) = 0; - virtual bool visitEndProBlock(ProBlock *block) = 0; + virtual void visitBeginProBlock(ProBlock *block) = 0; + virtual void visitEndProBlock(ProBlock *block) = 0; - virtual bool visitBeginProVariable(ProVariable *variable) = 0; - virtual bool visitEndProVariable(ProVariable *variable) = 0; + virtual void visitBeginProVariable(ProVariable *variable) = 0; + virtual void visitEndProVariable(ProVariable *variable) = 0; virtual bool visitBeginProFile(ProFile *value) = 0; virtual bool visitEndProFile(ProFile *value) = 0; - virtual bool visitProValue(ProValue *value) = 0; - virtual bool visitProFunction(ProFunction *function) = 0; - virtual bool visitProOperator(ProOperator *function) = 0; - virtual bool visitProCondition(ProCondition *function) = 0; + virtual void visitProValue(ProValue *value) = 0; + virtual void visitProFunction(ProFunction *function) = 0; + virtual void visitProOperator(ProOperator *function) = 0; + virtual void visitProCondition(ProCondition *function) = 0; }; QT_END_NAMESPACE diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index f2e6433..71d1d61 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -171,16 +171,16 @@ public: /////////////// Evaluating pro file contents // implementation of AbstractProItemVisitor - bool visitBeginProBlock(ProBlock *block); - bool visitEndProBlock(ProBlock *block); - bool visitBeginProVariable(ProVariable *variable); - bool visitEndProVariable(ProVariable *variable); + void visitBeginProBlock(ProBlock *block); + void visitEndProBlock(ProBlock *block); + void visitBeginProVariable(ProVariable *variable); + void visitEndProVariable(ProVariable *variable); bool visitBeginProFile(ProFile *value); bool visitEndProFile(ProFile *value); - bool visitProValue(ProValue *value); - bool visitProFunction(ProFunction *function); - bool visitProOperator(ProOperator *oper); - bool visitProCondition(ProCondition *condition); + void visitProValue(ProValue *value); + void visitProFunction(ProFunction *function); + void visitProOperator(ProOperator *oper); + void visitProCondition(ProCondition *condition); QStringList valuesDirect(const QString &variableName) const { return m_valuemap[variableName]; } QStringList values(const QString &variableName) const; @@ -564,7 +564,7 @@ void ProFileEvaluator::Private::updateItem() } -bool ProFileEvaluator::Private::visitBeginProBlock(ProBlock *block) +void ProFileEvaluator::Private::visitBeginProBlock(ProBlock *block) { if (block->blockKind() & ProBlock::ScopeContentsKind) { if (!m_sts.condition) @@ -581,10 +581,9 @@ bool ProFileEvaluator::Private::visitBeginProBlock(ProBlock *block) Q_ASSERT(!m_sts.condition); } } - return true; } -bool ProFileEvaluator::Private::visitEndProBlock(ProBlock *block) +void ProFileEvaluator::Private::visitEndProBlock(ProBlock *block) { if (block->blockKind() & ProBlock::ScopeContentsKind) { if (m_skipLevel) { @@ -596,35 +595,31 @@ bool ProFileEvaluator::Private::visitEndProBlock(ProBlock *block) m_sts.condition = true; } } - return true; } -bool ProFileEvaluator::Private::visitBeginProVariable(ProVariable *variable) +void ProFileEvaluator::Private::visitBeginProVariable(ProVariable *variable) { m_lastVarName = variable->variable(); m_variableOperator = variable->variableOperator(); m_isFirstVariableValue = true; m_tempValuemap = m_valuemap; m_tempFilevaluemap = m_filevaluemap; - return true; } -bool ProFileEvaluator::Private::visitEndProVariable(ProVariable *variable) +void ProFileEvaluator::Private::visitEndProVariable(ProVariable *variable) { Q_UNUSED(variable); m_valuemap = m_tempValuemap; m_filevaluemap = m_tempFilevaluemap; m_lastVarName.clear(); - return true; } -bool ProFileEvaluator::Private::visitProOperator(ProOperator *oper) +void ProFileEvaluator::Private::visitProOperator(ProOperator *oper) { m_invertNext = (oper->operatorKind() == ProOperator::NotOperator); - return true; } -bool ProFileEvaluator::Private::visitProCondition(ProCondition *cond) +void ProFileEvaluator::Private::visitProCondition(ProCondition *cond) { if (!m_skipLevel) { if (cond->text().toLower() == QLatin1String("else")) { @@ -636,7 +631,6 @@ bool ProFileEvaluator::Private::visitProCondition(ProCondition *cond) } } m_invertNext = false; - return true; } bool ProFileEvaluator::Private::visitBeginProFile(ProFile * pro) @@ -731,7 +725,7 @@ static void replaceInList(QStringList *varlist, } } -bool ProFileEvaluator::Private::visitProValue(ProValue *value) +void ProFileEvaluator::Private::visitProValue(ProValue *value) { PRE(value); m_lineNo = value->lineNumber(); @@ -838,10 +832,9 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) } m_isFirstVariableValue = false; - return true; } -bool ProFileEvaluator::Private::visitProFunction(ProFunction *func) +void ProFileEvaluator::Private::visitProFunction(ProFunction *func) { // Make sure that called subblocks don't inherit & destroy the state bool invertThis = m_invertNext; @@ -860,7 +853,6 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func) if (!m_skipLevel && (result ^ invertThis)) m_sts.condition = true; } - return true; } diff --git a/tools/linguist/shared/proitems.cpp b/tools/linguist/shared/proitems.cpp index 471417e..83d4a0f 100644 --- a/tools/linguist/shared/proitems.cpp +++ b/tools/linguist/shared/proitems.cpp @@ -116,7 +116,8 @@ bool ProBlock::Accept(AbstractProItemVisitor *visitor) if (!item->Accept(visitor)) return false; } - return visitor->visitEndProBlock(this); + visitor->visitEndProBlock(this); + return true; } // --------------- ProVariable ---------------- @@ -155,7 +156,8 @@ bool ProVariable::Accept(AbstractProItemVisitor *visitor) if (!item->Accept(visitor)) return false; } - return visitor->visitEndProVariable(this); + visitor->visitEndProVariable(this); + return true; } // --------------- ProValue ---------------- @@ -192,7 +194,8 @@ ProItem::ProItemKind ProValue::kind() const bool ProValue::Accept(AbstractProItemVisitor *visitor) { - return visitor->visitProValue(this); + visitor->visitProValue(this); + return true; } // --------------- ProFunction ---------------- @@ -218,7 +221,8 @@ ProItem::ProItemKind ProFunction::kind() const bool ProFunction::Accept(AbstractProItemVisitor *visitor) { - return visitor->visitProFunction(this); + visitor->visitProFunction(this); + return true; } // --------------- ProCondition ---------------- @@ -244,7 +248,8 @@ ProItem::ProItemKind ProCondition::kind() const bool ProCondition::Accept(AbstractProItemVisitor *visitor) { - return visitor->visitProCondition(this); + visitor->visitProCondition(this); + return true; } // --------------- ProOperator ---------------- @@ -270,7 +275,8 @@ ProItem::ProItemKind ProOperator::kind() const bool ProOperator::Accept(AbstractProItemVisitor *visitor) { - return visitor->visitProOperator(this); + visitor->visitProOperator(this); + return true; } // --------------- ProFile ---------------- |