diff options
author | Kevin Funk <kfunk@kde.org> | 2017-09-24 23:55:01 +0200 |
---|---|---|
committer | Kevin Funk <kevin.funk@kdab.com> | 2017-09-27 08:38:38 +0000 |
commit | c5c6aba3b07a44726da96cd2acaed05e67fe3ff8 (patch) | |
tree | c66bf2bd56898e27be055fab9dd511793f97fcc1 /src | |
parent | 45c751bb6045cc0edb5e850f8cb001c8c88651a9 (diff) |
Replace Q_NULLPTR with nullptr
Change-Id: I6bee476e2f467b57ee8e4bba1e780cf79c7a460e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineloader.cpp | 10 | ||||
-rw-r--r-- | src/scxml/qscxmlcompiler.cpp | 34 | ||||
-rw-r--r-- | src/scxml/qscxmlcompiler_p.h | 32 | ||||
-rw-r--r-- | src/scxml/qscxmldatamodel.cpp | 4 | ||||
-rw-r--r-- | src/scxml/qscxmldatamodel_p.h | 2 | ||||
-rw-r--r-- | src/scxml/qscxmlecmascriptdatamodel.cpp | 4 | ||||
-rw-r--r-- | src/scxml/qscxmlecmascriptplatformproperties.cpp | 2 | ||||
-rw-r--r-- | src/scxml/qscxmlerror.cpp | 10 | ||||
-rw-r--r-- | src/scxml/qscxmlevent.cpp | 16 | ||||
-rw-r--r-- | src/scxml/qscxmlevent_p.h | 6 | ||||
-rw-r--r-- | src/scxml/qscxmlinvokableservice.cpp | 2 | ||||
-rw-r--r-- | src/scxml/qscxmlstatemachine.cpp | 16 | ||||
-rw-r--r-- | src/scxml/qscxmltabledata.cpp | 4 |
13 files changed, 71 insertions, 71 deletions
diff --git a/src/imports/scxmlstatemachine/statemachineloader.cpp b/src/imports/scxmlstatemachine/statemachineloader.cpp index 946988f..682bbed 100644 --- a/src/imports/scxmlstatemachine/statemachineloader.cpp +++ b/src/imports/scxmlstatemachine/statemachineloader.cpp @@ -58,9 +58,9 @@ QScxmlStateMachineLoader::QScxmlStateMachineLoader(QObject *parent) : QObject(parent) - , m_dataModel(Q_NULLPTR) - , m_implicitDataModel(Q_NULLPTR) - , m_stateMachine(Q_NULLPTR) + , m_dataModel(nullptr) + , m_implicitDataModel(nullptr) + , m_stateMachine(nullptr) { } @@ -93,8 +93,8 @@ void QScxmlStateMachineLoader::setSource(const QUrl &source) QUrl oldSource = m_source; if (m_stateMachine) { delete m_stateMachine; - m_stateMachine = Q_NULLPTR; - m_implicitDataModel = Q_NULLPTR; + m_stateMachine = nullptr; + m_implicitDataModel = nullptr; } if (parse(source)) { diff --git a/src/scxml/qscxmlcompiler.cpp b/src/scxml/qscxmlcompiler.cpp index b39b786..a5946a1 100644 --- a/src/scxml/qscxmlcompiler.cpp +++ b/src/scxml/qscxmlcompiler.cpp @@ -77,7 +77,7 @@ class ScxmlVerifier: public DocumentModel::NodeVisitor public: ScxmlVerifier(std::function<void (const DocumentModel::XmlLocation &, const QString &)> errorHandler) : m_errorHandler(errorHandler) - , m_doc(Q_NULLPTR) + , m_doc(nullptr) , m_hasErrors(false) {} @@ -642,7 +642,7 @@ inline QScxmlInvokableService *InvokeDynamicScxmlFactory::invoke( bool ok = true; auto srcexpr = calculateSrcexpr(parentStateMachine, invokeInfo().expr, &ok); if (!ok) - return Q_NULLPTR; + return nullptr; if (!srcexpr.isEmpty()) return invokeDynamicScxmlService(srcexpr, parentStateMachine, this); @@ -672,7 +672,7 @@ QScxmlScxmlService *invokeDynamicScxmlService(const QString &sourceUrl, if (!errs.isEmpty()) { qWarning() << errs; - return Q_NULLPTR; + return nullptr; } QXmlStreamReader reader(data); @@ -684,7 +684,7 @@ QScxmlScxmlService *invokeDynamicScxmlService(const QString &sourceUrl, const auto errors = compiler.errors(); for (const QScxmlError &error : errors) qWarning() << error.toString(); - return Q_NULLPTR; + return nullptr; } auto mainDoc = QScxmlCompilerPrivate::get(&compiler)->scxmlDocument(); @@ -693,7 +693,7 @@ QScxmlScxmlService *invokeDynamicScxmlService(const QString &sourceUrl, const auto errors = compiler.errors(); for (const QScxmlError &error : errors) qWarning() << error.toString(); - return Q_NULLPTR; + return nullptr; } auto childStateMachine = DynamicStateMachine::build(mainDoc); @@ -812,7 +812,7 @@ QScxmlStateMachine *QScxmlCompiler::compile() QScxmlStateMachine *QScxmlCompilerPrivate::instantiateStateMachine() const { #ifdef BUILD_QSCXMLC - return Q_NULLPTR; + return nullptr; #else // BUILD_QSCXMLC DocumentModel::ScxmlDocument *doc = scxmlDocument(); if (doc && doc->root) { @@ -846,14 +846,14 @@ void QScxmlCompilerPrivate::instantiateDataModel(QScxmlStateMachine *stateMachin Q_UNUSED(stateMachine) #else auto doc = scxmlDocument(); - auto root = doc ? doc->root : Q_NULLPTR; - if (root == Q_NULLPTR) { + auto root = doc ? doc->root : nullptr; + if (root == nullptr) { qWarning() << "SCXML document has no root element"; } else { QScxmlDataModel *dm = QScxmlDataModelPrivate::instantiateDataModel(root->dataModel); QScxmlStateMachinePrivate::get(stateMachine)->parserData()->m_ownedDataModel.reset(dm); stateMachine->setDataModel(dm); - if (dm == Q_NULLPTR) + if (dm == nullptr) qWarning() << "No data-model instantiated"; } #endif // BUILD_QSCXMLC @@ -1155,7 +1155,7 @@ DocumentModel::AbstractState *DocumentModel::Node::asAbstractState() return state; if (HistoryState *history = asHistoryState()) return history; - return Q_NULLPTR; + return nullptr; } void DocumentModel::DataElement::accept(DocumentModel::NodeVisitor *visitor) @@ -1317,7 +1317,7 @@ QScxmlCompilerPrivate *QScxmlCompilerPrivate::get(QScxmlCompiler *compiler) } QScxmlCompilerPrivate::QScxmlCompilerPrivate(QXmlStreamReader *reader) - : m_currentState(Q_NULLPTR) + : m_currentState(nullptr) , m_loader(&m_defaultLoader) , m_reader(reader) {} @@ -1339,7 +1339,7 @@ bool QScxmlCompilerPrivate::verifyDocument() DocumentModel::ScxmlDocument *QScxmlCompilerPrivate::scxmlDocument() const { - return m_doc && m_errors.isEmpty() ? m_doc.data() : Q_NULLPTR; + return m_doc && m_errors.isEmpty() ? m_doc.data() : nullptr; } QString QScxmlCompilerPrivate::fileName() const @@ -1960,7 +1960,7 @@ bool QScxmlCompilerPrivate::postReadElementDataModel() bool QScxmlCompilerPrivate::postReadElementData() { const ParserState parserState = current(); - DocumentModel::DataElement *data = Q_NULLPTR; + DocumentModel::DataElement *data = nullptr; if (auto state = m_currentState->asState()) { data = state->dataElements.last(); } else if (auto scxml = m_currentState->asScxml()) { @@ -2342,7 +2342,7 @@ void QScxmlCompilerPrivate::addError(const DocumentModel::XmlLocation &location, DocumentModel::AbstractState *QScxmlCompilerPrivate::currentParent() const { - return m_currentState ? m_currentState->asAbstractState() : Q_NULLPTR; + return m_currentState ? m_currentState->asAbstractState() : nullptr; } DocumentModel::XmlLocation QScxmlCompilerPrivate::xmlLocation() const @@ -2369,18 +2369,18 @@ DocumentModel::If *QScxmlCompilerPrivate::lastIf() { if (!hasPrevious()) { addError(QStringLiteral("No previous instruction found for else block")); - return Q_NULLPTR; + return nullptr; } DocumentModel::Instruction *lastI = previous().instruction; if (!lastI) { addError(QStringLiteral("No previous instruction found for else block")); - return Q_NULLPTR; + return nullptr; } DocumentModel::If *ifI = lastI->asIf(); if (!ifI) { addError(QStringLiteral("Previous instruction for else block is not an 'if'")); - return Q_NULLPTR; + return nullptr; } return ifI; } diff --git a/src/scxml/qscxmlcompiler_p.h b/src/scxml/qscxmlcompiler_p.h index b170382..4b270f8 100644 --- a/src/scxml/qscxmlcompiler_p.h +++ b/src/scxml/qscxmlcompiler_p.h @@ -90,14 +90,14 @@ struct Node { virtual ~Node(); virtual void accept(NodeVisitor *visitor) = 0; - virtual If *asIf() { return Q_NULLPTR; } - virtual Send *asSend() { return Q_NULLPTR; } - virtual Invoke *asInvoke() { return Q_NULLPTR; } - virtual Script *asScript() { return Q_NULLPTR; } - virtual State *asState() { return Q_NULLPTR; } - virtual Transition *asTransition() { return Q_NULLPTR; } - virtual HistoryState *asHistoryState() { return Q_NULLPTR; } - virtual Scxml *asScxml() { return Q_NULLPTR; } + virtual If *asIf() { return nullptr; } + virtual Send *asSend() { return nullptr; } + virtual Invoke *asInvoke() { return nullptr; } + virtual Script *asScript() { return nullptr; } + virtual State *asState() { return nullptr; } + virtual Transition *asTransition() { return nullptr; } + virtual HistoryState *asHistoryState() { return nullptr; } + virtual Scxml *asScxml() { return nullptr; } AbstractState *asAbstractState(); private: @@ -261,16 +261,16 @@ struct StateOrTransition: public Node struct StateContainer { StateContainer() - : parent(Q_NULLPTR) + : parent(nullptr) {} StateContainer *parent; virtual ~StateContainer() {} virtual void add(StateOrTransition *s) = 0; - virtual AbstractState *asAbstractState() { return Q_NULLPTR; } - virtual State *asState() { return Q_NULLPTR; } - virtual Scxml *asScxml() { return Q_NULLPTR; } + virtual AbstractState *asAbstractState() { return nullptr; } + virtual State *asState() { return nullptr; } + virtual Scxml *asScxml() { return nullptr; } }; struct AbstractState: public StateContainer @@ -297,9 +297,9 @@ struct State: public AbstractState, public StateOrTransition State(const XmlLocation &xmlLocation) : StateOrTransition(xmlLocation) - , doneData(Q_NULLPTR) + , doneData(nullptr) , type(Normal) - , initialTransition(Q_NULLPTR) + , initialTransition(nullptr) {} void add(StateOrTransition *s) override @@ -352,7 +352,7 @@ struct HistoryState: public AbstractState, public StateOrTransition } Transition *defaultConfiguration() - { return children.isEmpty() ? Q_NULLPTR : children.first()->asTransition(); } + { return children.isEmpty() ? nullptr : children.first()->asTransition(); } HistoryState *asHistoryState() override { return this; } void accept(NodeVisitor *visitor) override; @@ -414,7 +414,7 @@ struct ScxmlDocument ScxmlDocument(const QString &fileName) : fileName(fileName) - , root(Q_NULLPTR) + , root(nullptr) , isVerified(false) {} diff --git a/src/scxml/qscxmldatamodel.cpp b/src/scxml/qscxmldatamodel.cpp index f7a7bb2..b67628b 100644 --- a/src/scxml/qscxmldatamodel.cpp +++ b/src/scxml/qscxmldatamodel.cpp @@ -120,7 +120,7 @@ void QScxmlDataModel::setStateMachine(QScxmlStateMachine *stateMachine) { Q_D(QScxmlDataModel); - if (d->m_stateMachine == Q_NULLPTR && stateMachine != Q_NULLPTR) { + if (d->m_stateMachine == nullptr && stateMachine != nullptr) { d->m_stateMachine = stateMachine; if (stateMachine) stateMachine->setDataModel(this); @@ -139,7 +139,7 @@ QScxmlStateMachine *QScxmlDataModel::stateMachine() const QScxmlDataModel *QScxmlDataModelPrivate::instantiateDataModel(DocumentModel::Scxml::DataModelType type) { - QScxmlDataModel *dataModel = Q_NULLPTR; + QScxmlDataModel *dataModel = nullptr; switch (type) { case DocumentModel::Scxml::NullDataModel: dataModel = new QScxmlNullDataModel; diff --git a/src/scxml/qscxmldatamodel_p.h b/src/scxml/qscxmldatamodel_p.h index 089071a..b91c63c 100644 --- a/src/scxml/qscxmldatamodel_p.h +++ b/src/scxml/qscxmldatamodel_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class QScxmlDataModelPrivate : public QObjectPrivate { public: - QScxmlDataModelPrivate() : m_stateMachine(Q_NULLPTR) {} + QScxmlDataModelPrivate() : m_stateMachine(nullptr) {} static QScxmlDataModel *instantiateDataModel(DocumentModel::Scxml::DataModelType type); diff --git a/src/scxml/qscxmlecmascriptdatamodel.cpp b/src/scxml/qscxmlecmascriptdatamodel.cpp index 2bbf134..d8548d7 100644 --- a/src/scxml/qscxmlecmascriptdatamodel.cpp +++ b/src/scxml/qscxmlecmascriptdatamodel.cpp @@ -66,7 +66,7 @@ class QScxmlEcmaScriptDataModelPrivate : public QScxmlDataModelPrivate Q_DECLARE_PUBLIC(QScxmlEcmaScriptDataModel) public: QScxmlEcmaScriptDataModelPrivate() - : jsEngine(Q_NULLPTR) + : jsEngine(nullptr) {} QString evalStr(const QString &expr, const QString &context, bool *ok) @@ -312,7 +312,7 @@ private: // Uses private API QV4::Scope scope(engine); QV4::ScopedObject o(scope, QJSValuePrivate::getValue(object)); - if (o == Q_NULLPTR) { + if (o == nullptr) { return SetPropertyFailedForAnotherReason; } diff --git a/src/scxml/qscxmlecmascriptplatformproperties.cpp b/src/scxml/qscxmlecmascriptplatformproperties.cpp index c4bb195..95e3b4f 100644 --- a/src/scxml/qscxmlecmascriptplatformproperties.cpp +++ b/src/scxml/qscxmlecmascriptplatformproperties.cpp @@ -47,7 +47,7 @@ class QScxmlPlatformProperties::Data { public: Data() - : m_stateMachine(Q_NULLPTR) + : m_stateMachine(nullptr) {} QScxmlStateMachine *m_stateMachine; diff --git a/src/scxml/qscxmlerror.cpp b/src/scxml/qscxmlerror.cpp index 84cf4fe..3033040 100644 --- a/src/scxml/qscxmlerror.cpp +++ b/src/scxml/qscxmlerror.cpp @@ -94,7 +94,7 @@ public: * Creates a new invalid SCXML error. */ QScxmlError::QScxmlError() - : d(Q_NULLPTR) + : d(nullptr) {} /*! @@ -115,7 +115,7 @@ QScxmlError::QScxmlError(const QString &fileName, int line, int column, const QS * Constructs a copy of \a other. */ QScxmlError::QScxmlError(const QScxmlError &other) - : d(Q_NULLPTR) + : d(nullptr) { *this = other; } @@ -135,7 +135,7 @@ QScxmlError &QScxmlError::operator=(const QScxmlError &other) d->description = other.d->description; } else { delete d; - d = Q_NULLPTR; + d = nullptr; } return *this; } @@ -146,7 +146,7 @@ QScxmlError &QScxmlError::operator=(const QScxmlError &other) QScxmlError::~QScxmlError() { delete d; - d = Q_NULLPTR; + d = nullptr; } /*! @@ -156,7 +156,7 @@ QScxmlError::~QScxmlError() */ bool QScxmlError::isValid() const { - return d != Q_NULLPTR; + return d != nullptr; } /*! diff --git a/src/scxml/qscxmlevent.cpp b/src/scxml/qscxmlevent.cpp index d8c7c1d..2ec7566 100644 --- a/src/scxml/qscxmlevent.cpp +++ b/src/scxml/qscxmlevent.cpp @@ -52,8 +52,8 @@ QAtomicInt QScxmlEventBuilder::idCounter = QAtomicInt(0); QScxmlEvent *QScxmlEventBuilder::buildEvent() { - auto dataModel = stateMachine ? stateMachine->dataModel() : Q_NULLPTR; - auto tableData = stateMachine ? stateMachine->tableData() : Q_NULLPTR; + auto dataModel = stateMachine ? stateMachine->dataModel() : nullptr; + auto tableData = stateMachine ? stateMachine->tableData() : nullptr; QString eventName = event; bool ok = true; @@ -95,14 +95,14 @@ QScxmlEvent *QScxmlEventBuilder::buildEvent() sendid = generateId(); ok = stateMachine->dataModel()->setScxmlProperty(idLocation, sendid, tableData->string(instructionLocation)); if (!ok) - return Q_NULLPTR; + return nullptr; } QString origin = target; if (targetexpr != NoEvaluator) { origin = dataModel->evaluateToString(targetexpr, &ok); if (!ok) - return Q_NULLPTR; + return nullptr; } if (origin.isEmpty()) { if (eventType == QScxmlEvent::ExternalEvent) { @@ -116,14 +116,14 @@ QScxmlEvent *QScxmlEventBuilder::buildEvent() QStringLiteral("Error in %1: %2 is not a legal target") .arg(tableData->string(instructionLocation), origin), sendid); - return Q_NULLPTR; + return nullptr; } else if (!stateMachine->isDispatchableTarget(origin)) { // [6.2.4] and test521. submitError(QStringLiteral("error.communication"), QStringLiteral("Error in %1: cannot dispatch to target '%2'") .arg(tableData->string(instructionLocation), origin), sendid); - return Q_NULLPTR; + return nullptr; } QString origintype = type; @@ -134,7 +134,7 @@ QScxmlEvent *QScxmlEventBuilder::buildEvent() if (typeexpr != NoEvaluator) { origintype = dataModel->evaluateToString(typeexpr, &ok); if (!ok) - return Q_NULLPTR; + return nullptr; } if (!origintype.isEmpty() && origintype != QStringLiteral("http://www.w3.org/TR/scxml/#SCXMLEventProcessor")) { @@ -143,7 +143,7 @@ QScxmlEvent *QScxmlEventBuilder::buildEvent() QStringLiteral("Error in %1: %2 is not a valid type") .arg(tableData->string(instructionLocation), origintype), sendid); - return Q_NULLPTR; + return nullptr; } QString invokeid; diff --git a/src/scxml/qscxmlevent_p.h b/src/scxml/qscxmlevent_p.h index f5f5164..6d7f1c4 100644 --- a/src/scxml/qscxmlevent_p.h +++ b/src/scxml/qscxmlevent_p.h @@ -94,14 +94,14 @@ class QScxmlEventBuilder void init() // Because stupid VS2012 can't cope with non-static field initializers. { - stateMachine = Q_NULLPTR; + stateMachine = nullptr; eventexpr = QScxmlExecutableContent::NoEvaluator; contentExpr = QScxmlExecutableContent::NoEvaluator; - params = Q_NULLPTR; + params = nullptr; eventType = QScxmlEvent::ExternalEvent; targetexpr = QScxmlExecutableContent::NoEvaluator; typeexpr = QScxmlExecutableContent::NoEvaluator; - namelist = Q_NULLPTR; + namelist = nullptr; } public: diff --git a/src/scxml/qscxmlinvokableservice.cpp b/src/scxml/qscxmlinvokableservice.cpp index 4cf9bd9..912be00 100644 --- a/src/scxml/qscxmlinvokableservice.cpp +++ b/src/scxml/qscxmlinvokableservice.cpp @@ -419,7 +419,7 @@ QScxmlInvokableService *QScxmlDynamicScxmlServiceFactory::invoke( bool ok = true; auto srcexpr = calculateSrcexpr(parentStateMachine, invokeInfo().expr, &ok); if (!ok) - return Q_NULLPTR; + return nullptr; return invokeDynamicScxmlService(srcexpr, parentStateMachine, this); } diff --git a/src/scxml/qscxmlstatemachine.cpp b/src/scxml/qscxmlstatemachine.cpp index 7cbabc7..c1d9a68 100644 --- a/src/scxml/qscxmlstatemachine.cpp +++ b/src/scxml/qscxmlstatemachine.cpp @@ -399,7 +399,7 @@ QMetaObject::Connection ScxmlEventRouter::connectToEvent(const QStringList &segm { QString segment = nextSegment(segments); if (segment.isEmpty()) { - const int *types = Q_NULLPTR; + const int *types = nullptr; if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection) types = QtPrivate::ConnectionTypes<QtPrivate::List<QScxmlEvent> >::types(); @@ -422,11 +422,11 @@ QScxmlStateMachinePrivate::QScxmlStateMachinePrivate(const QMetaObject *metaObje , m_isInvoked(false) , m_isInitialized(false) , m_isProcessingEvents(false) - , m_dataModel(Q_NULLPTR) + , m_dataModel(nullptr) , m_loader(&m_defaultLoader) - , m_executionEngine(Q_NULLPTR) - , m_tableData(Q_NULLPTR) - , m_parentStateMachine(Q_NULLPTR) + , m_executionEngine(nullptr) + , m_tableData(nullptr) + , m_parentStateMachine(nullptr) , m_eventLoopHook(this) , m_metaObject(metaObject) , m_infoSignalProxy(nullptr) @@ -729,7 +729,7 @@ void QScxmlStateMachinePrivate::resetEvent() void QScxmlStateMachinePrivate::emitStateActive(int stateIndex, bool active) { Q_Q(QScxmlStateMachine); - void *args[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&active)) }; + void *args[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&active)) }; const int signalIndex = m_stateIndexToSignalIndex.value(stateIndex, -1); if (signalIndex >= 0) QMetaObject::activate(q, m_metaObject, signalIndex, args); @@ -1717,7 +1717,7 @@ void QScxmlStateMachine::setDataModel(QScxmlDataModel *model) { Q_D(QScxmlStateMachine); - if (d->m_dataModel == Q_NULLPTR && model != Q_NULLPTR) { + if (d->m_dataModel == nullptr && model != nullptr) { d->m_dataModel = model; if (model) model->setStateMachine(this); @@ -1893,7 +1893,7 @@ QMetaObject::Connection QScxmlStateMachine::connectToStateImpl(const QString &sc QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) { - const int *types = Q_NULLPTR; + const int *types = nullptr; if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection) types = QtPrivate::ConnectionTypes<QtPrivate::List<bool> >::types(); diff --git a/src/scxml/qscxmltabledata.cpp b/src/scxml/qscxmltabledata.cpp index 23ead19..aa9a35e 100644 --- a/src/scxml/qscxmltabledata.cpp +++ b/src/scxml/qscxmltabledata.cpp @@ -667,7 +667,7 @@ protected: { SequenceInfo info = m_activeSequences.back(); m_activeSequences.pop_back(); - m_instructions.setSequenceInfo(m_activeSequences.isEmpty() ? Q_NULLPTR : + m_instructions.setSequenceInfo(m_activeSequences.isEmpty() ? nullptr : &m_activeSequences.last()); auto sequence = m_instructions.at<InstructionSequence>(info.location); @@ -896,7 +896,7 @@ private: public: InstructionStorage(QVector<qint32> &storage) : m_instr(storage) - , m_info(Q_NULLPTR) + , m_info(nullptr) {} ContainerId newContainerId() const { return m_instr.size(); } |