diff --git a/debugger/breakpoint/breakpoint.cpp b/debugger/breakpoint/breakpoint.cpp --- a/debugger/breakpoint/breakpoint.cpp +++ b/debugger/breakpoint/breakpoint.cpp @@ -55,7 +55,7 @@ , m_state(NotStartedState) , m_kind(kind) , m_line(-1) - , m_movingCursor(0) + , m_movingCursor(nullptr) , m_hitCount(0) , m_ignoreHits(0) { @@ -69,7 +69,7 @@ , m_deleted(false) , m_state(NotStartedState) , m_line(-1) - , m_movingCursor(0) + , m_movingCursor(nullptr) , m_hitCount(0) , m_ignoreHits(0) { @@ -214,7 +214,7 @@ if (m->breakpointIndex(this, 0).isValid()) { m->removeRow(m->breakpointIndex(this, 0).row()); } - m_model = 0; // invalidate + m_model = nullptr; // invalidate } int Breakpoint::line() const { diff --git a/debugger/breakpoint/breakpointdetails.cpp b/debugger/breakpoint/breakpointdetails.cpp --- a/debugger/breakpoint/breakpointdetails.cpp +++ b/debugger/breakpoint/breakpointdetails.cpp @@ -38,7 +38,7 @@ using namespace KDevelop; BreakpointDetails::BreakpointDetails(QWidget *parent) - : QWidget(parent), m_currentBreakpoint(0) + : QWidget(parent), m_currentBreakpoint(nullptr) { QVBoxLayout* layout = new QVBoxLayout(this); @@ -69,7 +69,7 @@ layout->addStretch(); - setItem(0); //initialize with no breakpoint active + setItem(nullptr); //initialize with no breakpoint active } void KDevelop::BreakpointDetails::setIgnoreHits(int ignoreHits) diff --git a/debugger/breakpoint/breakpointmodel.cpp b/debugger/breakpoint/breakpointmodel.cpp --- a/debugger/breakpoint/breakpointmodel.cpp +++ b/debugger/breakpoint/breakpointmodel.cpp @@ -153,9 +153,9 @@ } QMenu menu; - QAction deleteAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("&Delete Breakpoint"), 0); - QAction disableAction(QIcon::fromTheme(QStringLiteral("dialog-cancel")), i18n("&Disable Breakpoint"), 0); - QAction enableAction(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")), i18n("&Enable Breakpoint"), 0); + QAction deleteAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("&Delete Breakpoint"), nullptr); + QAction disableAction(QIcon::fromTheme(QStringLiteral("dialog-cancel")), i18n("&Disable Breakpoint"), nullptr); + QAction enableAction(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")), i18n("&Enable Breakpoint"), nullptr); menu.addAction(&deleteAction); if (b->enabled()) { menu.addAction(&disableAction); @@ -209,7 +209,7 @@ { /* FIXME: all this logic must be in item */ if (!index.isValid()) - return 0; + return nullptr; if (index.column() == 0) return static_cast( @@ -245,7 +245,7 @@ if (controller) controller->breakpointAboutToBeDeleted(row); m_breakpoints.removeAt(row); - b->m_model = 0; + b->m_model = nullptr; // To be changed: the controller is currently still responsible for deleting the breakpoint // object } @@ -495,7 +495,7 @@ { foreach (Breakpoint *breakpoint, m_breakpoints) { if (breakpoint->movingCursor() && breakpoint->movingCursor()->document() == document) { - breakpoint->setMovingCursor(0); + breakpoint->setMovingCursor(nullptr); } } } @@ -547,7 +547,7 @@ Breakpoint* BreakpointModel::breakpoint(int row) { - if (row >= m_breakpoints.count()) return 0; + if (row >= m_breakpoints.count()) return nullptr; return m_breakpoints.at(row); } @@ -636,5 +636,5 @@ return b; } } - return 0; + return nullptr; } diff --git a/debugger/breakpoint/breakpointwidget.cpp b/debugger/breakpoint/breakpointwidget.cpp --- a/debugger/breakpoint/breakpointwidget.cpp +++ b/debugger/breakpoint/breakpointwidget.cpp @@ -50,7 +50,7 @@ BreakpointWidget::BreakpointWidget(IDebugController *controller, QWidget *parent) : AutoOrientedSplitter(parent), m_firstShow(true), m_debugController(controller), - m_breakpointDisableAllAction(0), m_breakpointEnableAllAction(0), m_breakpointRemoveAll(0) + m_breakpointDisableAllAction(nullptr), m_breakpointEnableAllAction(nullptr), m_breakpointRemoveAll(nullptr) { setWindowTitle(i18nc("@title:window", "Debugger Breakpoints")); setWhatsThis(i18nc("@info:whatsthis", "Displays a list of breakpoints with " @@ -247,7 +247,7 @@ QModelIndexList selected = m_breakpointsView->selectionModel()->selectedIndexes(); IF_DEBUG( qCDebug(DEBUGGER) << selected; ) if (selected.isEmpty()) { - m_details->setItem(0); + m_details->setItem(nullptr); } else { m_details->setItem(m_debugController->breakpointModel()->breakpoint(selected.first().row())); } diff --git a/debugger/framestack/framestackwidget.cpp b/debugger/framestack/framestackwidget.cpp --- a/debugger/framestack/framestackwidget.cpp +++ b/debugger/framestack/framestackwidget.cpp @@ -70,7 +70,7 @@ } FramestackWidget::FramestackWidget(IDebugController* controller, QWidget* parent) - : AutoOrientedSplitter(Qt::Horizontal, parent), m_session(0) + : AutoOrientedSplitter(Qt::Horizontal, parent), m_session(nullptr) { connect(controller, &IDebugController::currentSessionChanged, @@ -137,8 +137,8 @@ { m_session = session; - m_threadsListView->setModel(session ? session->frameStackModel() : 0); - m_framesTreeView->setModel(session ? session->frameStackModel() : 0); + m_threadsListView->setModel(session ? session->frameStackModel() : nullptr); + m_framesTreeView->setModel(session ? session->frameStackModel() : nullptr); if (session) { connect(session->frameStackModel(), &IFrameStackModel::dataChanged, diff --git a/debugger/interfaces/ibreakpointcontroller.cpp b/debugger/interfaces/ibreakpointcontroller.cpp --- a/debugger/interfaces/ibreakpointcontroller.cpp +++ b/debugger/interfaces/ibreakpointcontroller.cpp @@ -52,7 +52,7 @@ BreakpointModel* IBreakpointController::breakpointModel() const { - if (!ICore::self()) return 0; + if (!ICore::self()) return nullptr; return ICore::self()->debugController()->breakpointModel(); } @@ -79,7 +79,7 @@ // This is a slightly odd place to issue this notification, // but then again it's not clear which place would be more natural Breakpoint* breakpoint = model->breakpoint(row); - KNotification* ev = 0; + KNotification* ev = nullptr; switch(breakpoint->kind()) { case Breakpoint::CodeBreakpoint: ev = new KNotification(QStringLiteral("BreakpointHit"), ICore::self()->uiController()->activeMainWindow()); diff --git a/debugger/interfaces/ivariablecontroller.cpp b/debugger/interfaces/ivariablecontroller.cpp --- a/debugger/interfaces/ivariablecontroller.cpp +++ b/debugger/interfaces/ivariablecontroller.cpp @@ -40,7 +40,7 @@ VariableCollection* IVariableController::variableCollection() { - if (!ICore::self()) return 0; + if (!ICore::self()) return nullptr; return ICore::self()->debugController()->variableCollection(); } diff --git a/debugger/util/treeitem.cpp b/debugger/util/treeitem.cpp --- a/debugger/util/treeitem.cpp +++ b/debugger/util/treeitem.cpp @@ -30,7 +30,7 @@ using namespace KDevelop; TreeItem::TreeItem(TreeModel* model, TreeItem *parent) -: model_(model), more_(false), ellipsis_(0), expanded_(false) +: model_(model), more_(false), ellipsis_(nullptr), expanded_(false) { parentItem = parent; } @@ -62,7 +62,7 @@ model_->beginRemoveRows(index, childItems.size(), childItems.size()); more_ = false; delete ellipsis_; - ellipsis_ = 0; + ellipsis_ = nullptr; if (!initial) model_->endRemoveRows(); } @@ -136,7 +136,7 @@ childItems.clear(); more_ = false; delete ellipsis_; - ellipsis_ = 0; + ellipsis_ = nullptr; model_->endRemoveRows(); } } @@ -148,7 +148,7 @@ else if (row == childItems.size() && more_) return ellipsis_; else - return NULL; + return nullptr; } @@ -226,7 +226,7 @@ { model_->beginRemoveRows(index, childItems.size(), childItems.size()); delete ellipsis_; - ellipsis_ = 0; + ellipsis_ = nullptr; more_ = more; model_->endRemoveRows(); } diff --git a/debugger/util/treemodel.cpp b/debugger/util/treemodel.cpp --- a/debugger/util/treemodel.cpp +++ b/debugger/util/treemodel.cpp @@ -31,7 +31,7 @@ TreeModel::TreeModel(const QVector& headers, QObject *parent) - : QAbstractItemModel(parent), headers_(headers), root_(NULL) + : QAbstractItemModel(parent), headers_(headers), root_(nullptr) { } @@ -67,7 +67,7 @@ Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return nullptr; return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -142,7 +142,7 @@ QModelIndex TreeModel::indexForItem(TreeItem *item, int column) const { - if (item->parent() == 0) + if (item->parent() == nullptr) return QModelIndex(); if (TreeItem* parent = item->parent()) diff --git a/debugger/util/treeview.cpp b/debugger/util/treeview.cpp --- a/debugger/util/treeview.cpp +++ b/debugger/util/treeview.cpp @@ -28,7 +28,7 @@ using namespace KDevelop; -AsyncTreeView::AsyncTreeView(TreeModel* model, QSortFilterProxyModel *proxy, QWidget *parent = 0) +AsyncTreeView::AsyncTreeView(TreeModel* model, QSortFilterProxyModel *proxy, QWidget *parent = nullptr) : QTreeView(parent) , m_proxy(proxy) { diff --git a/debugger/variable/variablecollection.cpp b/debugger/variable/variablecollection.cpp --- a/debugger/variable/variablecollection.cpp +++ b/debugger/variable/variablecollection.cpp @@ -240,14 +240,14 @@ } Watches::Watches(TreeModel* model, TreeItem* parent) -: TreeItem(model, parent), finishResult_(0) +: TreeItem(model, parent), finishResult_(nullptr) { setData(QVector() << i18n("Auto") << QString()); } Variable* Watches::add(const QString& expression) { - if (!hasStartedSession()) return 0; + if (!hasStartedSession()) return nullptr; Variable* v = currentSession()->variableController()->createVariable( model(), this, expression); @@ -280,7 +280,7 @@ if (finishResult_) { finishResult_->die(); - finishResult_ = 0; + finishResult_ = nullptr; } } diff --git a/debugger/variable/variablewidget.cpp b/debugger/variable/variablewidget.cpp --- a/debugger/variable/variablewidget.cpp +++ b/debugger/variable/variablewidget.cpp @@ -258,9 +258,9 @@ Variable* VariableTree::selectedVariable() const { - if (selectionModel()->selectedRows().isEmpty()) return 0; + if (selectionModel()->selectedRows().isEmpty()) return nullptr; auto item = selectionModel()->currentIndex().data(TreeModel::ItemRole).value(); - if (!item) return 0; + if (!item) return nullptr; return qobject_cast(item); } diff --git a/interfaces/context.cpp b/interfaces/context.cpp --- a/interfaces/context.cpp +++ b/interfaces/context.cpp @@ -38,7 +38,7 @@ { Context::Context() - : d(0) + : d(nullptr) {} Context::~Context() diff --git a/interfaces/ibuddydocumentfinder.cpp b/interfaces/ibuddydocumentfinder.cpp --- a/interfaces/ibuddydocumentfinder.cpp +++ b/interfaces/ibuddydocumentfinder.cpp @@ -47,7 +47,7 @@ IBuddyDocumentFinder* IBuddyDocumentFinder::finderForMimeType(const QString& mimeType) { - return Private::finders().value(mimeType, 0); + return Private::finders().value(mimeType, nullptr); } } diff --git a/interfaces/icore.cpp b/interfaces/icore.cpp --- a/interfaces/icore.cpp +++ b/interfaces/icore.cpp @@ -22,18 +22,18 @@ namespace KDevelop { -ICore *ICore::m_self = 0; +ICore *ICore::m_self = nullptr; ICore::ICore(QObject *parent) : QObject(parent) { - Q_ASSERT(m_self == 0); + Q_ASSERT(m_self == nullptr); m_self = this; } ICore::~ICore() { - m_self = 0; + m_self = nullptr; } ICore *ICore::self() diff --git a/interfaces/idocument.cpp b/interfaces/idocument.cpp --- a/interfaces/idocument.cpp +++ b/interfaces/idocument.cpp @@ -27,7 +27,7 @@ { public: inline IDocumentPrivate(KDevelop::ICore *core) - : m_core(core), scriptWrapper(0) + : m_core(core), scriptWrapper(nullptr) {} KDevelop::ICore* m_core; @@ -133,7 +133,7 @@ KTextEditor::View* IDocument::activeTextView() const { - return 0; + return nullptr; } QString KDevelop::IDocument::text(const KTextEditor::Range& range) const diff --git a/interfaces/ipartcontroller.cpp b/interfaces/ipartcontroller.cpp --- a/interfaces/ipartcontroller.cpp +++ b/interfaces/ipartcontroller.cpp @@ -29,7 +29,7 @@ namespace KDevelop { IPartController::IPartController( QWidget* toplevel ) - : KParts::PartManager( toplevel, 0 ) + : KParts::PartManager( toplevel, nullptr ) { } @@ -65,7 +65,7 @@ return loader.factory(); } - return 0; + return nullptr; } @@ -78,13 +78,13 @@ /*"KParts/ReadWritePart",*/ "KParts/ReadOnlyPart" }; - KParts::Part* part = 0; + KParts::Part* part = nullptr; for ( uint i = 0; i < length; ++i ) { KPluginFactory* editorFactory = findPartFactory( mimetype, QString::fromLatin1(services[ i ]), prefName ); if ( editorFactory ) { - part = editorFactory->create( 0, this ); + part = editorFactory->create( nullptr, this ); break; } } diff --git a/interfaces/iplugin.cpp b/interfaces/iplugin.cpp --- a/interfaces/iplugin.cpp +++ b/interfaces/iplugin.cpp @@ -174,7 +174,7 @@ ret->setXmlFile(file); } else { delete ret; - ret = 0; + ret = nullptr; } return ret; } diff --git a/interfaces/launchconfigurationtype.cpp b/interfaces/launchconfigurationtype.cpp --- a/interfaces/launchconfigurationtype.cpp +++ b/interfaces/launchconfigurationtype.cpp @@ -66,7 +66,7 @@ return l; } } - return 0; + return nullptr; } } diff --git a/language/assistant/renameaction.cpp b/language/assistant/renameaction.cpp --- a/language/assistant/renameaction.cpp +++ b/language/assistant/renameaction.cpp @@ -107,7 +107,7 @@ DocumentChangeSet::ChangeResult result = changes.applyAllChanges(); if (!result) { - KMessageBox::error(0, i18n("Failed to apply changes: %1", result.m_failureReason)); + KMessageBox::error(nullptr, i18n("Failed to apply changes: %1", result.m_failureReason)); } emit executed(this); diff --git a/language/assistant/renameassistant.cpp b/language/assistant/renameassistant.cpp --- a/language/assistant/renameassistant.cpp +++ b/language/assistant/renameassistant.cpp @@ -62,7 +62,7 @@ //In this case, we may either not have a decl at the cursor, or we got a decl, but are editing its use. //In either of those cases, give up and return 0 if (!declaration || !rangesConnect(declaration->rangeInCurrentRevision(), changed)) { - return 0; + return nullptr; } return declaration; diff --git a/language/assistant/renamefileaction.cpp b/language/assistant/renamefileaction.cpp --- a/language/assistant/renamefileaction.cpp +++ b/language/assistant/renamefileaction.cpp @@ -77,7 +77,7 @@ result = changes.applyAllChanges(); } if(!result) { - KMessageBox::error(0, i18n("Failed to apply changes: %1", result.m_failureReason)); + KMessageBox::error(nullptr, i18n("Failed to apply changes: %1", result.m_failureReason)); } emit executed(this); } diff --git a/language/backgroundparser/backgroundparser.cpp b/language/backgroundparser/backgroundparser.cpp --- a/language/backgroundparser/backgroundparser.cpp +++ b/language/backgroundparser/backgroundparser.cpp @@ -806,7 +806,7 @@ if (url.isEmpty()) { // this happens e.g. when setting the final location of a problem that is not // yet associated with a top ctx. - return 0; + return nullptr; } if ( !isValidURL(url) ) { qWarning() << "Tracker requested for invalild URL:" << url.toUrl(); @@ -814,7 +814,7 @@ Q_ASSERT(isValidURL(url)); QMutexLocker l(&d->m_managedMutex); - return d->m_managed.value(url, 0); + return d->m_managed.value(url, nullptr); } void BackgroundParser::documentClosed(IDocument* document) diff --git a/language/backgroundparser/documentchangetracker.cpp b/language/backgroundparser/documentchangetracker.cpp --- a/language/backgroundparser/documentchangetracker.cpp +++ b/language/backgroundparser/documentchangetracker.cpp @@ -62,7 +62,7 @@ { DocumentChangeTracker::DocumentChangeTracker( KTextEditor::Document* document ) - : m_needUpdate(false), m_document(document), m_moving(0) + : m_needUpdate(false), m_document(document), m_moving(nullptr) { m_url = IndexedString(document->url()); Q_ASSERT(document); @@ -204,8 +204,8 @@ void DocumentChangeTracker::documentDestroyed( QObject* ) { - m_document = 0; - m_moving = 0; + m_document = nullptr; + m_moving = nullptr; } DocumentChangeTracker::~DocumentChangeTracker() diff --git a/language/backgroundparser/tests/test_backgroundparser.cpp b/language/backgroundparser/tests/test_backgroundparser.cpp --- a/language/backgroundparser/tests/test_backgroundparser.cpp +++ b/language/backgroundparser/tests/test_backgroundparser.cpp @@ -316,7 +316,7 @@ doc->setText(QStringLiteral("hello world")); // required for proper benchmark results - doc->createView(0); + doc->createView(nullptr); QBENCHMARK { for ( int i = 0; i < 5000; i++ ) { { diff --git a/language/backgroundparser/tests/testparsejob.cpp b/language/backgroundparser/tests/testparsejob.cpp --- a/language/backgroundparser/tests/testparsejob.cpp +++ b/language/backgroundparser/tests/testparsejob.cpp @@ -43,12 +43,12 @@ ControlFlowGraph* TestParseJob::controlFlowGraph() { - return 0; + return nullptr; } DataAccessRepository* TestParseJob::dataAccessInformation() { - return 0; + return nullptr; } diff --git a/language/checks/controlflownode.cpp b/language/checks/controlflownode.cpp --- a/language/checks/controlflownode.cpp +++ b/language/checks/controlflownode.cpp @@ -21,7 +21,7 @@ using namespace KDevelop; ControlFlowNode::ControlFlowNode() - : m_conditionRange(RangeInRevision::invalid()), m_next(0), m_alternative(0) + : m_conditionRange(RangeInRevision::invalid()), m_next(nullptr), m_alternative(nullptr) {} ControlFlowNode::Type ControlFlowNode::type() const diff --git a/language/checks/dataaccessrepository.cpp b/language/checks/dataaccessrepository.cpp --- a/language/checks/dataaccessrepository.cpp +++ b/language/checks/dataaccessrepository.cpp @@ -57,7 +57,7 @@ if(a->pos() == cursor) return a; } - return 0; + return nullptr; } QList DataAccessRepository::accessesInRange(const RangeInRevision& range) const diff --git a/language/classmodel/classmodel.cpp b/language/classmodel/classmodel.cpp --- a/language/classmodel/classmodel.cpp +++ b/language/classmodel/classmodel.cpp @@ -187,7 +187,7 @@ } // If no parent exists, we have an invalid index (root node or not part of a model). - if ( a_node->getParent() == 0 ) + if ( a_node->getParent() == nullptr ) return QModelIndex(); return createIndex(a_node->row(), 0, a_node); @@ -196,7 +196,7 @@ KDevelop::DUChainBase* ClassModel::duObjectForIndex(const QModelIndex& a_index) { if ( !a_index.isValid() ) - return 0; + return nullptr; Node* node = static_cast(a_index.internalPointer()); @@ -204,13 +204,13 @@ return identifierNode->getDeclaration(); // Non was found. - return 0; + return nullptr; } QModelIndex ClassModel::getIndexForIdentifier(const KDevelop::IndexedQualifiedIdentifier& a_id) { ClassNode* node = m_allClassesNode->findClassNode(a_id); - if ( node == 0 ) + if ( node == nullptr ) return QModelIndex(); return index(node); diff --git a/language/classmodel/classmodelnode.cpp b/language/classmodel/classmodelnode.cpp --- a/language/classmodel/classmodelnode.cpp +++ b/language/classmodel/classmodelnode.cpp @@ -85,7 +85,7 @@ DUChainReadLocker readLock(DUChain::lock()); ClassMemberDeclaration* decl = dynamic_cast(getDeclaration()); - if ( decl == 0 ) + if ( decl == nullptr ) { static QIcon Icon = QIcon::fromTheme(QStringLiteral("enum")); a_resultIcon = Icon; @@ -185,7 +185,7 @@ continue; } - Node* newNode = 0; + Node* newNode = nullptr; if ( EnumerationType::Ptr enumType = decl->type() ) newNode = new EnumNode( decl, m_model ); @@ -276,14 +276,14 @@ foreach(Node* item, m_subIdentifiers) { ClassNode* classNode = dynamic_cast(item); - if ( classNode == 0 ) + if ( classNode == nullptr ) continue; if ( classNode->getIdentifier() == a_id ) return classNode; } - return 0; + return nullptr; } ////////////////////////////////////////////////////////////////////////////// @@ -322,7 +322,7 @@ DUChainReadLocker readLock(DUChain::lock()); ClassMemberDeclaration* decl = dynamic_cast(getDeclaration()); - if ( decl == 0 ) + if ( decl == nullptr ) return false; if ( decl->isTypeAlias() ) @@ -444,7 +444,7 @@ ////////////////////////////////////////////////////////////////////////////// Node::Node(const QString& a_displayName, NodesModelInterface* a_model) - : m_parentNode(0) + : m_parentNode(nullptr) , m_displayName(a_displayName) , m_model(a_model) { @@ -519,7 +519,7 @@ int Node::row() { - if ( m_parentNode == 0 ) + if ( m_parentNode == nullptr ) return -1; return m_parentNode->m_children.indexOf(this); diff --git a/language/classmodel/documentclassesfolder.cpp b/language/classmodel/documentclassesfolder.cpp --- a/language/classmodel/documentclassesfolder.cpp +++ b/language/classmodel/documentclassesfolder.cpp @@ -139,22 +139,22 @@ ClassIdentifierIterator iter = m_openFilesClasses.get().find(a_id); if ( iter == m_openFilesClasses.get().end() ) - return 0; + return nullptr; // If the node is invisible - make it visible by going over the identifiers list. - if ( iter->nodeItem == 0 ) + if ( iter->nodeItem == nullptr ) { QualifiedIdentifier qualifiedIdentifier = a_id.identifier(); // Ignore zero length identifiers. if ( qualifiedIdentifier.count() == 0 ) - return 0; + return nullptr; - ClassNode* closestNode = 0; + ClassNode* closestNode = nullptr; int closestNodeIdLen = qualifiedIdentifier.count(); // First find the closest visible class node by reverse iteration over the id list. - while ( (closestNodeIdLen > 0) && (closestNode == 0) ) + while ( (closestNodeIdLen > 0) && (closestNode == nullptr) ) { // Omit one from the end. --closestNodeIdLen; @@ -163,7 +163,7 @@ closestNode = findClassNode(qualifiedIdentifier.mid(0, closestNodeIdLen)); } - if ( closestNode != 0 ) + if ( closestNode != nullptr ) { // Start iterating forward from this node by exposing each class. // By the end of this loop, closestNode should hold the actual node. @@ -267,7 +267,7 @@ } // Where should we put this class? - Node* parentNode = 0; + Node* parentNode = nullptr; // Check if it's namespaced and add it to the proper namespace. if ( id.count() > 1 ) @@ -321,8 +321,8 @@ parentNode = this; } - ClassNode* newNode = 0; - if ( parentNode != 0 ) + ClassNode* newNode = nullptr; + if ( parentNode != nullptr ) { // Create the new node and add it. IndexedDeclaration decl; @@ -420,7 +420,7 @@ { // Stop condition. if ( a_identifier.count() == 0 ) - return 0; + return nullptr; // Look it up in the cache. NamespacesMap::iterator iter = m_namespaces.find(a_identifier); @@ -428,7 +428,7 @@ { // It's not in the cache - create folders up to it. Node* parentNode = getNamespaceFolder(a_identifier.left(-1)); - if ( parentNode == 0 ) + if ( parentNode == nullptr ) parentNode = this; // Create the new node. diff --git a/language/classmodel/projectfolder.cpp b/language/classmodel/projectfolder.cpp --- a/language/classmodel/projectfolder.cpp +++ b/language/classmodel/projectfolder.cpp @@ -34,7 +34,7 @@ ProjectFolder::ProjectFolder( NodesModelInterface* a_model ) : DocumentClassesFolder( QLatin1String(""), a_model ) - , m_project( 0 ) + , m_project( nullptr ) { } diff --git a/language/codecompletion/codecompletioncontext.cpp b/language/codecompletion/codecompletioncontext.cpp --- a/language/codecompletion/codecompletioncontext.cpp +++ b/language/codecompletion/codecompletioncontext.cpp @@ -42,7 +42,7 @@ int completionRecursionDepth = 0; CodeCompletionContext::CodeCompletionContext(DUContextPointer context, const QString& text, const KDevelop::CursorInRevision& position, int depth) - : m_text(text), m_depth(depth), m_valid(true), m_position(position), m_duContext(context), m_parentContext(0) + : m_text(text), m_depth(depth), m_valid(true), m_position(position), m_duContext(context), m_parentContext(nullptr) { IntPusher( completionRecursionDepth, completionRecursionDepth+1 ); diff --git a/language/codecompletion/codecompletionitem.cpp b/language/codecompletion/codecompletionitem.cpp --- a/language/codecompletion/codecompletionitem.cpp +++ b/language/codecompletion/codecompletionitem.cpp @@ -43,7 +43,7 @@ ///Leaf items class CompletionTreeItem; -CompletionTreeElement::CompletionTreeElement() : m_parent(0), m_rowInParent(0) { +CompletionTreeElement::CompletionTreeElement() : m_parent(nullptr), m_rowInParent(0) { } CompletionTreeElement::~CompletionTreeElement() { @@ -54,7 +54,7 @@ } void CompletionTreeElement::setParent(CompletionTreeElement* parent) { - Q_ASSERT(m_parent == 0); + Q_ASSERT(m_parent == nullptr); m_parent = parent; auto node = parent ? parent->asNode() : nullptr; diff --git a/language/codecompletion/codecompletionmodel.cpp b/language/codecompletion/codecompletionmodel.cpp --- a/language/codecompletion/codecompletionmodel.cpp +++ b/language/codecompletion/codecompletionmodel.cpp @@ -71,7 +71,7 @@ CompletionWorkerThread(CodeCompletionModel* model) : QThread(model), m_model(model), m_worker(m_model->createCompletionWorker()) { - Q_ASSERT(m_worker->parent() == 0); // Must be null, else we cannot change the thread affinity! + Q_ASSERT(m_worker->parent() == nullptr); // Must be null, else we cannot change the thread affinity! m_worker->moveToThread(this); Q_ASSERT(m_worker->thread() == this); } @@ -109,7 +109,7 @@ , m_forceWaitForModel(false) , m_fullCompletion(true) , m_mutex(new QMutex) - , m_thread(0) + , m_thread(nullptr) { qRegisterMetaType(); } diff --git a/language/codecompletion/codecompletionworker.cpp b/language/codecompletion/codecompletionworker.cpp --- a/language/codecompletion/codecompletionworker.cpp +++ b/language/codecompletion/codecompletionworker.cpp @@ -141,7 +141,7 @@ Q_UNUSED(contextText); Q_UNUSED(followingText); Q_UNUSED(position); - return 0; + return nullptr; } void CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer context, const KTextEditor::Cursor& position, QString followingText, const KTextEditor::Range& contextRange, const QString& contextText) @@ -196,7 +196,7 @@ * 2. Group by inheritance depth * 3. Group by simplified attributes * */ - CodeCompletionItemGrouper > > argumentHintDepthGrouper(tree, 0, items); + CodeCompletionItemGrouper > > argumentHintDepthGrouper(tree, nullptr, items); return tree; } diff --git a/language/codecompletion/normaldeclarationcompletionitem.cpp b/language/codecompletion/normaldeclarationcompletionitem.cpp --- a/language/codecompletion/normaldeclarationcompletionitem.cpp +++ b/language/codecompletion/normaldeclarationcompletionitem.cpp @@ -107,7 +107,7 @@ QWidget* NormalDeclarationCompletionItem::createExpandingWidget(const KDevelop::CodeCompletionModel* model) const { Q_UNUSED(model); - return 0; + return nullptr; } bool NormalDeclarationCompletionItem::createsExpandingWidget() const diff --git a/language/codegen/basicrefactoring.cpp b/language/codegen/basicrefactoring.cpp --- a/language/codegen/basicrefactoring.cpp +++ b/language/codegen/basicrefactoring.cpp @@ -105,7 +105,7 @@ if (declaration && acceptForContextMenu(declaration)) { QFileInfo finfo(declaration->topContext()->url().str()); if (finfo.isWritable()) { - QAction *action = new QAction(i18n("Rename \"%1\"...", declaration->qualifiedIdentifier().toString()), 0); + QAction *action = new QAction(i18n("Rename \"%1\"...", declaration->qualifiedIdentifier().toString()), nullptr); action->setData(QVariant::fromValue(IndexedDeclaration(declaration))); action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); connect(action, &QAction::triggered, this, &BasicRefactoring::executeRenameAction); @@ -330,7 +330,7 @@ hadIndices.insert(usedDeclarationIndex); DocumentChangeSet::ChangeResult result = applyChanges(originalName, replacementName, changes, collected.data(), usedDeclarationIndex); if (!result) { - KMessageBox::error(0, i18n("Applying changes failed: %1", result.m_failureReason)); + KMessageBox::error(nullptr, i18n("Applying changes failed: %1", result.m_failureReason)); return {}; } } @@ -338,7 +338,7 @@ DocumentChangeSet::ChangeResult result = applyChangesToDeclarations(originalName, replacementName, changes, collector->declarations()); if (!result) { - KMessageBox::error(0, i18n("Applying changes failed: %1", result.m_failureReason)); + KMessageBox::error(nullptr, i18n("Applying changes failed: %1", result.m_failureReason)); return {}; } @@ -351,7 +351,7 @@ result = changes.applyAllChanges(); if (!result) { - KMessageBox::error(0, i18n("Applying changes failed: %1", result.m_failureReason)); + KMessageBox::error(nullptr, i18n("Applying changes failed: %1", result.m_failureReason)); } return {}; diff --git a/language/codegen/documentchangeset.cpp b/language/codegen/documentchangeset.cpp --- a/language/codegen/documentchangeset.cpp +++ b/language/codegen/documentchangeset.cpp @@ -375,7 +375,7 @@ QString & output) { - ISourceFormatter* formatter = 0; + ISourceFormatter* formatter = nullptr; if(ICore::self()) { formatter = ICore::self()->sourceFormatterController()->formatterForUrl(file.toUrl()); } diff --git a/language/codegen/sourcefiletemplate.cpp b/language/codegen/sourcefiletemplate.cpp --- a/language/codegen/sourcefiletemplate.cpp +++ b/language/codegen/sourcefiletemplate.cpp @@ -95,20 +95,20 @@ SourceFileTemplate::SourceFileTemplate (const QString& templateDescription) : d(new KDevelop::SourceFileTemplatePrivate) { - d->archive = 0; + d->archive = nullptr; setTemplateDescription(templateDescription); } SourceFileTemplate::SourceFileTemplate() : d(new KDevelop::SourceFileTemplatePrivate) { - d->archive = 0; + d->archive = nullptr; } SourceFileTemplate::SourceFileTemplate (const SourceFileTemplate& other) : d(new KDevelop::SourceFileTemplatePrivate) { - d->archive = 0; + d->archive = nullptr; *this = other; } @@ -133,7 +133,7 @@ } d->archive->open(QIODevice::ReadOnly); } else { - d->archive = 0; + d->archive = nullptr; } d->descriptionFileName = other.d->descriptionFileName; return *this; @@ -162,7 +162,7 @@ if (archiveFileName.isEmpty() || !QFileInfo::exists(archiveFileName)) { qCWarning(LANGUAGE) << "Could not find a template archive for description" << templateDescription << ", archive file" << archiveFileName; - d->archive = 0; + d->archive = nullptr; } else { QFileInfo info(archiveFileName); diff --git a/language/codegen/utilities.cpp b/language/codegen/utilities.cpp --- a/language/codegen/utilities.cpp +++ b/language/codegen/utilities.cpp @@ -35,7 +35,7 @@ namespace CodeGenUtils { -IdentifierValidator::IdentifierValidator( DUContext * context) : QValidator(0), m_context(context) +IdentifierValidator::IdentifierValidator( DUContext * context) : QValidator(nullptr), m_context(context) { } @@ -52,7 +52,7 @@ return Acceptable; DUChainReadLocker lock(DUChain::lock(), 10); - return m_context->findLocalDeclarations(identifier, CursorInRevision::invalid(), 0, AbstractType::Ptr(), DUContext::NoFiltering).empty() ? Acceptable : Invalid; + return m_context->findLocalDeclarations(identifier, CursorInRevision::invalid(), nullptr, AbstractType::Ptr(), DUContext::NoFiltering).empty() ? Acceptable : Invalid; } IndexedString fetchImplementationFileForClass(const Declaration & targetClass) diff --git a/language/duchain/classdeclaration.cpp b/language/duchain/classdeclaration.cpp --- a/language/duchain/classdeclaration.cpp +++ b/language/duchain/classdeclaration.cpp @@ -138,7 +138,7 @@ bool ClassDeclaration::isPublicBaseClass( ClassDeclaration* base, const KDevelop::TopDUContext* topContext, int* baseConversionLevels ) const { - return isPublicBaseClassInternal( this, base, topContext, baseConversionLevels, 0, 0 ); + return isPublicBaseClassInternal( this, base, topContext, baseConversionLevels, 0, nullptr ); } QString ClassDeclaration::toString() const diff --git a/language/duchain/codemodel.cpp b/language/duchain/codemodel.cpp --- a/language/duchain/codemodel.cpp +++ b/language/duchain/codemodel.cpp @@ -349,7 +349,7 @@ }else{ ifDebug( qCDebug(LANGUAGE) << "found no index"; ) count = 0; - items = 0; + items = nullptr; } } diff --git a/language/duchain/declaration.cpp b/language/duchain/declaration.cpp --- a/language/duchain/declaration.cpp +++ b/language/duchain/declaration.cpp @@ -119,8 +119,8 @@ : DUChainBase(*new DeclarationData, range) { d_func_dynamic()->setClassId(this); - m_topContext = 0; - m_context = 0; + m_topContext = nullptr; + m_context = nullptr; m_indexInTopContext = 0; if(context) @@ -135,23 +135,23 @@ Declaration::Declaration(const Declaration& rhs) : DUChainBase(*new DeclarationData( *rhs.d_func() )) { - m_topContext = 0; - m_context = 0; + m_topContext = nullptr; + m_context = nullptr; m_indexInTopContext = 0; } Declaration::Declaration( DeclarationData & dd ) : DUChainBase(dd) { - m_topContext = 0; - m_context = 0; + m_topContext = nullptr; + m_context = nullptr; m_indexInTopContext = 0; } Declaration::Declaration( DeclarationData & dd, const RangeInRevision& range ) : DUChainBase(dd, range) { - m_topContext = 0; - m_context = 0; + m_topContext = nullptr; + m_context = nullptr; m_indexInTopContext = 0; } @@ -173,7 +173,7 @@ // Inserted by the builder after construction has finished. if( d->m_internalContext.context() ) - d->m_internalContext.context()->setOwner(0); + d->m_internalContext.context()->setOwner(nullptr); setInSymbolTable(false); } @@ -188,7 +188,7 @@ clearOwnIndex(); if(!topContext->deleting() || !topContext->isOnDisk()) { - setContext(0); + setContext(nullptr); setAbstractType(AbstractType::Ptr()); } @@ -199,7 +199,7 @@ QByteArray Declaration::comment() const { DUCHAIN_D(Declaration); if(!d->m_comment) - return 0; + return nullptr; else return Repositories::arrayFromItem(commentRepository().itemFromIndex(d->m_comment)); } @@ -274,7 +274,7 @@ Declaration* Declaration::specialize(const IndexedInstantiationInformation& /*specialization*/, const TopDUContext* topContext, int /*upDistance*/) { if(!topContext) - return 0; + return nullptr; return this; } @@ -331,7 +331,7 @@ if(context) m_topContext = context->topContext(); else - m_topContext = 0; + m_topContext = nullptr; d->m_anonymousInContext = anonymous; m_context = context; @@ -460,7 +460,7 @@ //Q_ASSERT( !oldInternalContext || oldInternalContext->owner() == this ); if( oldInternalContext && oldInternalContext->owner() == this ) - oldInternalContext->setOwner(0); + oldInternalContext->setOwner(nullptr); if( context ) diff --git a/language/duchain/declarationid.cpp b/language/duchain/declarationid.cpp --- a/language/duchain/declarationid.cpp +++ b/language/duchain/declarationid.cpp @@ -157,7 +157,7 @@ Declaration* DeclarationId::getDeclaration(const TopDUContext* top, bool instantiateIfRequired) const { - Declaration* ret = 0; + Declaration* ret = nullptr; if(m_isDirect == false) { //Find the declaration by its qualified identifier and additionalIdentity @@ -211,7 +211,7 @@ { const TopDUContext* topContextForSpecialization = top; if(!instantiateIfRequired) - topContextForSpecialization = 0; //If we don't want to instantiate new declarations, set the top-context to zero, so specialize(..) will only look-up + topContextForSpecialization = nullptr; //If we don't want to instantiate new declarations, set the top-context to zero, so specialize(..) will only look-up else if(!topContextForSpecialization) topContextForSpecialization = ret->topContext(); @@ -220,7 +220,7 @@ return ret; } }else - return 0; + return nullptr; } QualifiedIdentifier DeclarationId::qualifiedIdentifier() const @@ -232,7 +232,7 @@ return baseIdentifier; return m_specialization.information().applyToIdentifier(baseIdentifier); } else { - Declaration* decl = getDeclaration(0); + Declaration* decl = getDeclaration(nullptr); if(decl) return decl->qualifiedIdentifier(); diff --git a/language/duchain/duchain.cpp b/language/duchain/duchain.cpp --- a/language/duchain/duchain.cpp +++ b/language/duchain/duchain.cpp @@ -123,7 +123,7 @@ public: ///This constructor should only be used for lookup - EnvironmentInformationRequest(uint topContextIndex) : m_file(0), m_index(topContextIndex) { + EnvironmentInformationRequest(uint topContextIndex) : m_file(nullptr), m_index(topContextIndex) { } EnvironmentInformationRequest(const ParsingEnvironmentFile* file) : m_file(file), m_index(file->indexedTopContext().index()) { @@ -214,7 +214,7 @@ public: ///This constructor should only be used for lookup - EnvironmentInformationListRequest(const IndexedString& file) : m_file(file), m_item(0) { + EnvironmentInformationListRequest(const IndexedString& file) : m_file(file), m_item(nullptr) { } ///This is used to actually construct the information in the repository EnvironmentInformationListRequest(const IndexedString& file, const EnvironmentInformationListItem& item) : m_file(file), m_item(&item) { @@ -255,7 +255,7 @@ }; class DUChainPrivate; -static DUChainPrivate* duChainPrivateSelf = 0; +static DUChainPrivate* duChainPrivateSelf = nullptr; class DUChainPrivate { class CleanupThread : public QThread { @@ -298,7 +298,7 @@ DUChainPrivate* m_data; }; public: - DUChainPrivate() : m_chainsMutex(QMutex::Recursive), m_cleanupMutex(QMutex::Recursive), instance(0), m_cleanupDisabled(false), m_destroyed(false), m_environmentListInfo(QStringLiteral("Environment Lists")), m_environmentInfo(QStringLiteral("Environment Information")) + DUChainPrivate() : m_chainsMutex(QMutex::Recursive), m_cleanupMutex(QMutex::Recursive), instance(nullptr), m_cleanupDisabled(false), m_destroyed(false), m_environmentListInfo(QStringLiteral("Environment Lists")), m_environmentInfo(QStringLiteral("Environment Information")) { #if defined(TEST_NO_CLEANUP) m_cleanupDisabled = true; @@ -411,7 +411,7 @@ Q_ASSERT(hasChainForIndex(index)); QMutexLocker lock(&DUChain::chainsByIndexLock); - DUChain::chainsByIndex[index] = 0; + DUChain::chainsByIndex[index] = nullptr; } ///Must be locked before accessing content of this class. @@ -549,7 +549,7 @@ if(DUChain::chainsByIndex.size() > index) return DUChain::chainsByIndex[index]; else - return 0; + return nullptr; } ///Makes sure that the chain with the given index is loaded @@ -927,7 +927,7 @@ QHash::iterator it = m_indexEnvironmentInformations.find(topContextIndex); if(it != m_indexEnvironmentInformations.end()) return (*it).data(); - return 0; + return nullptr; } ///Loads/gets the environment-information for the given top-context index, or returns zero if none exists @@ -943,7 +943,7 @@ uint dataIndex = m_environmentInfo.findIndex(EnvironmentInformationRequest(topContextIndex)); if(!dataIndex) { //No environment-information stored for this top-context - return 0; + return nullptr; } const EnvironmentInformationItem& item(*m_environmentInfo.itemFromIndex(dataIndex)); @@ -1229,7 +1229,7 @@ { QMutexLocker lock(&DUChain::chainsByIndexLock); if(DUChain::chainsByIndex.size() <= chain->ownIndex()) - DUChain::chainsByIndex.resize(chain->ownIndex() + 100, 0); + DUChain::chainsByIndex.resize(chain->ownIndex() + 100, nullptr); DUChain::chainsByIndex[chain->ownIndex()] = chain; } @@ -1322,7 +1322,7 @@ } } - return 0; + return nullptr; } TopDUContext* DUChain::chainForDocument(const KDevelop::IndexedString& document, bool proxyContext) const @@ -1330,7 +1330,7 @@ ENSURE_CHAIN_READ_LOCKED; if(sdDUChainPrivate->m_destroyed) - return 0; + return nullptr; QList list = sdDUChainPrivate->getEnvironmentInformation(document); @@ -1351,7 +1351,7 @@ return ctx; } - return 0; + return nullptr; } QList DUChain::chainsForDocument(const QUrl& document) const @@ -1420,12 +1420,12 @@ TopDUContext* DUChain::chainForDocument( const IndexedString& document, const ParsingEnvironment* environment, bool proxyContext ) const { if(sdDUChainPrivate->m_destroyed) - return 0; + return nullptr; ParsingEnvironmentFilePointer envFile = environmentFileForDocument(document, environment, proxyContext); if(envFile) { return envFile->topContext(); }else{ - return 0; + return nullptr; } } @@ -1697,7 +1697,7 @@ while(!waiter.m_ready) { // we might have been shut down in the meanwhile if (!ICore::self()) { - return 0; + return nullptr; } QMetaObject::invokeMethod(ICore::self()->languageController()->backgroundParser(), "parseDocuments"); diff --git a/language/duchain/duchainbase.cpp b/language/duchain/duchainbase.cpp --- a/language/duchain/duchainbase.cpp +++ b/language/duchain/duchainbase.cpp @@ -44,25 +44,25 @@ } DUChainBase::DUChainBase(const RangeInRevision& range) - : d_ptr(new DUChainBaseData), m_ptr( 0L ) + : d_ptr(new DUChainBaseData), m_ptr( nullptr ) { d_func_dynamic()->m_range = range; d_func_dynamic()->setClassId(this); } DUChainBase::DUChainBase( DUChainBaseData & dd, const RangeInRevision& range ) - : d_ptr( &dd ), m_ptr( 0 ) + : d_ptr( &dd ), m_ptr( nullptr ) { d_func_dynamic()->m_range = range; } DUChainBase::DUChainBase( DUChainBaseData & dd ) - : d_ptr( &dd ), m_ptr( 0 ) + : d_ptr( &dd ), m_ptr( nullptr ) { } DUChainBase::DUChainBase( DUChainBase& rhs ) - : d_ptr( new DUChainBaseData(*rhs.d_func()) ), m_ptr( 0 ) + : d_ptr( new DUChainBaseData(*rhs.d_func()) ), m_ptr( nullptr ) { d_func_dynamic()->setClassId(this); } @@ -93,20 +93,20 @@ DUChainBase::~DUChainBase() { if (m_ptr) - m_ptr->m_base = 0; + m_ptr->m_base = nullptr; if(d_ptr->m_dynamic) { KDevelop::DUChainItemSystem::self().callDestructor(d_ptr); delete d_ptr; - d_ptr = 0; + d_ptr = nullptr; } } TopDUContext* DUChainBase::topContext() const { ///@todo Move the reference to the top-context right into this class, as it's common to all inheriters - return 0; + return nullptr; } namespace { diff --git a/language/duchain/duchainlock.cpp b/language/duchain/duchainlock.cpp --- a/language/duchain/duchainlock.cpp +++ b/language/duchain/duchainlock.cpp @@ -40,7 +40,7 @@ { public: DUChainLockPrivate() - : m_writer(0) + : m_writer(nullptr) , m_writerRecursion(0) , m_totalReaderRecursion(0) { } @@ -85,7 +85,7 @@ d->changeOwnReaderRecursion(1); QThread* w = d->m_writer.loadAcquire(); - if (w == 0 || w == QThread::currentThread()) { + if (w == nullptr || w == QThread::currentThread()) { //Successful lock: Either there is no writer, or we hold the write-lock by ourselves } else { ///Step 2: Start spinning until there is no writer any more @@ -146,7 +146,7 @@ return true; } else { //There may be readers.. we have to continue spinning - d->m_writer = 0; + d->m_writer = nullptr; d->m_writerRecursion = 0; } } @@ -170,7 +170,7 @@ //TODO: could testAndSet here if (d->m_writerRecursion.load() == 1) { - d->m_writer = 0; + d->m_writer = nullptr; d->m_writerRecursion = 0; } else { d->m_writerRecursion.fetchAndAddOrdered(-1); diff --git a/language/duchain/duchainpointer.h b/language/duchain/duchainpointer.h --- a/language/duchain/duchainpointer.h +++ b/language/duchain/duchainpointer.h @@ -91,7 +91,7 @@ friend class DUChainPointer; public: - DUChainPointer() : d(QExplicitlySharedDataPointer(0)) { + DUChainPointer() : d(QExplicitlySharedDataPointer(nullptr)) { } DUChainPointer(const DUChainPointer& rhs) diff --git a/language/duchain/duchainpointer.cpp b/language/duchain/duchainpointer.cpp --- a/language/duchain/duchainpointer.cpp +++ b/language/duchain/duchainpointer.cpp @@ -33,7 +33,7 @@ } DUChainPointerData::DUChainPointerData() - : m_base(0) + : m_base(nullptr) { } diff --git a/language/duchain/duchainregister.cpp b/language/duchain/duchainregister.cpp --- a/language/duchain/duchainregister.cpp +++ b/language/duchain/duchainregister.cpp @@ -32,34 +32,34 @@ } DUChainBase* DUChainItemSystem::create(DUChainBaseData* data) const { - if(uint(m_factories.size()) <= data->classId || m_factories[data->classId] == 0) - return 0; + if(uint(m_factories.size()) <= data->classId || m_factories[data->classId] == nullptr) + return nullptr; return m_factories[data->classId]->create(data); } DUChainBaseData* DUChainItemSystem::cloneData(const DUChainBaseData& data) const { - if(uint(m_factories.size()) <= data.classId || m_factories[data.classId] == 0) { + if(uint(m_factories.size()) <= data.classId || m_factories[data.classId] == nullptr) { ENSURE_VALID_CLASSID(data.classId) - return 0; + return nullptr; } return m_factories[data.classId]->cloneData(data); } void DUChainItemSystem::callDestructor(DUChainBaseData* data) const { - if(uint(m_factories.size()) <= data->classId || m_factories[data->classId] == 0) + if(uint(m_factories.size()) <= data->classId || m_factories[data->classId] == nullptr) return; return m_factories[data->classId]->callDestructor(data); } void DUChainItemSystem::freeDynamicData(KDevelop::DUChainBaseData* data) const { - if(uint(m_factories.size()) <= data->classId || m_factories[data->classId] == 0) + if(uint(m_factories.size()) <= data->classId || m_factories[data->classId] == nullptr) return; return m_factories[data->classId]->freeDynamicData(data); } uint DUChainItemSystem::dynamicSize(const DUChainBaseData& data) const { - if(uint(m_factories.size()) <= data.classId || m_factories[data.classId] == 0) + if(uint(m_factories.size()) <= data.classId || m_factories[data.classId] == nullptr) return 0; return m_factories[data.classId]->dynamicSize(data); } @@ -72,7 +72,7 @@ void DUChainItemSystem::copy(const DUChainBaseData& from, DUChainBaseData& to, bool constant) const { - if(uint(m_factories.size()) <= from.classId || m_factories[from.classId] == 0) { + if(uint(m_factories.size()) <= from.classId || m_factories[from.classId] == nullptr) { ENSURE_VALID_CLASSID(from.classId) return; } diff --git a/language/duchain/duchainutils.cpp b/language/duchain/duchainutils.cpp --- a/language/duchain/duchainutils.cpp +++ b/language/duchain/duchainutils.cpp @@ -247,16 +247,16 @@ TopDUContext* DUChainUtils::contentContextFromProxyContext(TopDUContext* top) { if(!top) - return 0; + return nullptr; if(top->parsingEnvironmentFile() && top->parsingEnvironmentFile()->isProxyContext()) { if(!top->importedParentContexts().isEmpty()) { - DUContext* ctx = top->importedParentContexts().at(0).context(0); + DUContext* ctx = top->importedParentContexts().at(0).context(nullptr); if(!ctx) - return 0; + return nullptr; TopDUContext* ret = ctx->topContext(); if(!ret) - return 0; + return nullptr; if(ret->url() != top->url()) qCDebug(LANGUAGE) << "url-mismatch between content and proxy:" << top->url().toUrl() << ret->url().toUrl(); if(ret->url() == top->url() && !ret->parsingEnvironmentFile()->isProxyContext()) @@ -267,11 +267,11 @@ } } else return top; - return 0; + return nullptr; } TopDUContext* DUChainUtils::standardContextForUrl(const QUrl& url, bool preferProxyContext) { - KDevelop::TopDUContext* chosen = 0; + KDevelop::TopDUContext* chosen = nullptr; auto languages = ICore::self()->languageController()->languagesForUrl(url); @@ -347,7 +347,7 @@ Declaration* DUChainUtils::declarationForDefinition(Declaration* definition, TopDUContext* topContext) { if(!definition) - return 0; + return nullptr; if(!topContext) topContext = definition->topContext(); @@ -363,7 +363,7 @@ Declaration* DUChainUtils::declarationInLine(const KTextEditor::Cursor& _cursor, DUContext* ctx) { if(!ctx) - return 0; + return nullptr; CursorInRevision cursor = ctx->transformToLocalRevision(_cursor); @@ -381,7 +381,7 @@ return decl; } - return 0; + return nullptr; } DUChainUtils::DUChainItemFilter::~DUChainItemFilter() { @@ -397,22 +397,22 @@ while(childIt != children.constEnd() || declIt != localDeclarations.constEnd()) { - DUContext* child = 0; + DUContext* child = nullptr; if(childIt != children.constEnd()) child = *childIt; - Declaration* decl = 0; + Declaration* decl = nullptr; if(declIt != localDeclarations.constEnd()) decl = *declIt; if(decl) { if(child && child->range().start.line >= decl->range().start.line) - child = 0; + child = nullptr; } if(child) { if(decl && decl->range().start >= child->range().start) - decl = 0; + decl = nullptr; } if(decl) { @@ -436,7 +436,7 @@ KDevelop::DUContext* DUChainUtils::getArgumentContext(KDevelop::Declaration* decl) { DUContext* internal = decl->internalContext(); if( !internal ) - return 0; + return nullptr; if( internal->type() == DUContext::Function ) return internal; foreach( const DUContext::Import &ctx, internal->importedParentContexts() ) { @@ -444,7 +444,7 @@ if( ctx.context(decl->topContext())->type() == DUContext::Function ) return ctx.context(decl->topContext()); } - return 0; + return nullptr; } QList DUChainUtils::collectAllVersions(Declaration* decl) { @@ -578,7 +578,7 @@ Declaration* DUChainUtils::getOverridden(const Declaration* decl) { const ClassFunctionDeclaration* classFunDecl = dynamic_cast(decl); if(!classFunDecl || !classFunDecl->isVirtual()) - return 0; + return nullptr; QList decls; @@ -595,7 +595,7 @@ return found; } - return 0; + return nullptr; } DUContext* DUChainUtils::getFunctionContext(Declaration* decl) { @@ -610,7 +610,7 @@ if(functionContext && functionContext->type() == DUContext::Function) return functionContext; - return 0; + return nullptr; } QVector KDevelop::DUChainUtils::allProblemsForContext(KDevelop::ReferencedTopDUContext top) diff --git a/language/duchain/ducontext.cpp b/language/duchain/ducontext.cpp --- a/language/duchain/ducontext.cpp +++ b/language/duchain/ducontext.cpp @@ -161,7 +161,7 @@ } DUContextDynamicData::DUContextDynamicData(DUContext* d) - : m_topContext(0) + : m_topContext(nullptr) , m_indexInTopContext(0) , m_context(d) { @@ -359,7 +359,7 @@ d_func_dynamic()->setClassId(this); DUCHAIN_D_DYNAMIC(DUContext); d->m_contextType = Other; - m_dynamicData->m_parentContext = 0; + m_dynamicData->m_parentContext = nullptr; d->m_anonymousInParent = anonymous; d->m_inSymbolTable = false; @@ -393,7 +393,7 @@ DUCHAIN_D_DYNAMIC(DUContext); d->m_contextType = Other; - m_dynamicData->m_parentContext = 0; + m_dynamicData->m_parentContext = nullptr; d->m_inSymbolTable = false; d->m_anonymousInParent = anonymous; if (parent) { @@ -420,7 +420,7 @@ DUCHAIN_D_DYNAMIC(DUContext); if(d->m_owner.declaration()) - d->m_owner.declaration()->setInternalContext(0); + d->m_owner.declaration()->setInternalContext(nullptr); while( d->m_importersSize() != 0 ) { if(d->m_importers()[0].data()) @@ -478,7 +478,7 @@ //Q_ASSERT(!oldOwner || oldOwner->internalContext() == this); if( oldOwner && oldOwner->internalContext() == this ) - oldOwner->setInternalContext(0); + oldOwner->setInternalContext(nullptr); //The context set as internal context should always be the last opened context @@ -901,7 +901,7 @@ } } - return 0; + return nullptr; } bool DUContext::parentContextOf(DUContext* context) const @@ -1036,7 +1036,7 @@ { auto copy = m_dynamicData->m_localDeclarations; foreach (Declaration* dec, copy) { - dec->setContext(0); + dec->setContext(nullptr); } return copy; } @@ -1160,7 +1160,7 @@ const TopDUContext* topContext, int /*upDistance*/) { if(!topContext) - return 0; + return nullptr; return this; } @@ -1220,7 +1220,7 @@ if( !identifier->isEmpty() && (identifier->hasNext() || canBeNamespace) ) { DeclarationList aliases; - findLocalDeclarationsInternal(identifier->identifier, position, AbstractType::Ptr(), imports, 0, DUContext::NoFiltering); + findLocalDeclarationsInternal(identifier->identifier, position, AbstractType::Ptr(), imports, nullptr, DUContext::NoFiltering); if(!aliases.isEmpty()) { //The first part of the identifier has been found as a namespace-alias. @@ -1347,7 +1347,7 @@ if (!range().contains(position) && (!includeRightBorder || range().end != position)) { // qCDebug(LANGUAGE) << "mismatch"; - return 0; + return nullptr; } const auto childContexts = m_dynamicData->m_childContexts; @@ -1365,7 +1365,7 @@ ENSURE_CAN_READ if (!range().contains(position)) - return 0; + return nullptr; foreach (Declaration* child, m_dynamicData->m_localDeclarations) { if (child->range().contains(position)) { @@ -1373,7 +1373,7 @@ } } - return 0; + return nullptr; } DUContext* DUContext::findContextIncluding(const RangeInRevision& range) const @@ -1381,7 +1381,7 @@ ENSURE_CAN_READ if (!this->range().contains(range)) - return 0; + return nullptr; foreach (DUContext* child, m_dynamicData->m_childContexts) { if (DUContext* specific = child->findContextIncluding(range)) { @@ -1423,7 +1423,7 @@ DUCHAIN_D_DYNAMIC(DUContext); while( d->m_importedContextsSize() != 0 ) { - DUContext* ctx = d->m_importedContexts()[0].context(0, false); + DUContext* ctx = d->m_importedContexts()[0].context(nullptr, false); if(ctx) ctx->m_dynamicData->removeImportedChildContext(this); @@ -1474,7 +1474,7 @@ widget->setContext(NavigationContextPointer(context)); return widget; } else { - return 0; + return nullptr; } } @@ -1647,7 +1647,7 @@ if(decl) return decl->logicalInternalContext(topContext); else - return 0; + return nullptr; }else{ return m_context.data(); } diff --git a/language/duchain/dumpdotgraph.cpp b/language/duchain/dumpdotgraph.cpp --- a/language/duchain/dumpdotgraph.cpp +++ b/language/duchain/dumpdotgraph.cpp @@ -70,7 +70,7 @@ m_hadObjects[dec] = true; - Declaration* declarationForDefinition = 0; + Declaration* declarationForDefinition = nullptr; if(dynamic_cast(dec)) declarationForDefinition = static_cast(dec)->declaration(m_topContext); diff --git a/language/duchain/forwarddeclaration.cpp b/language/duchain/forwarddeclaration.cpp --- a/language/duchain/forwarddeclaration.cpp +++ b/language/duchain/forwarddeclaration.cpp @@ -73,7 +73,7 @@ if(decl && !decl->isForwardDeclaration()) return decl; else - return 0; + return nullptr; } if(!topContext) @@ -83,14 +83,14 @@ globalIdentifier.setExplicitlyGlobal(true); //We've got to use DUContext::DirectQualifiedLookup so C++ works correctly. - QList declarations = topContext->findDeclarations(globalIdentifier, CursorInRevision::invalid(), AbstractType::Ptr(), 0, DUContext::DirectQualifiedLookup); + QList declarations = topContext->findDeclarations(globalIdentifier, CursorInRevision::invalid(), AbstractType::Ptr(), nullptr, DUContext::DirectQualifiedLookup); foreach(Declaration* decl, declarations) { if( !decl->isForwardDeclaration() ) return decl; } - return 0; + return nullptr; } DUContext * ForwardDeclaration::logicalInternalContext(const TopDUContext* topContext) const diff --git a/language/duchain/functiondefinition.cpp b/language/duchain/functiondefinition.cpp --- a/language/duchain/functiondefinition.cpp +++ b/language/duchain/functiondefinition.cpp @@ -55,7 +55,7 @@ return decl; } - return 0; + return nullptr; } bool FunctionDefinition::hasDeclaration() const @@ -90,7 +90,7 @@ if(decl.data()) ///@todo Find better ways of deciding which definition to use return dynamic_cast(decl.data()); } - return 0; + return nullptr; } Declaration* FunctionDefinition::clonePrivate() const diff --git a/language/duchain/identifier.cpp b/language/duchain/identifier.cpp --- a/language/duchain/identifier.cpp +++ b/language/duchain/identifier.cpp @@ -413,7 +413,7 @@ if(!m_index) delete dd; - dd = 0; + dd = nullptr; rhs.makeConstant(); cd = rhs.cd; @@ -441,7 +441,7 @@ if (!m_index) { delete dd; - dd = 0; + dd = nullptr; } m_index = rhs.m_index; diff --git a/language/duchain/indexeddeclaration.cpp b/language/duchain/indexeddeclaration.cpp --- a/language/duchain/indexeddeclaration.cpp +++ b/language/duchain/indexeddeclaration.cpp @@ -44,14 +44,14 @@ Declaration* IndexedDeclaration::declaration() const { if(isDummy()) - return 0; + return nullptr; // ENSURE_CHAIN_READ_LOCKED if(!m_topContext || !m_declarationIndex) - return 0; + return nullptr; TopDUContext* ctx = DUChain::self()->chainForIndex(m_topContext); if(!ctx) - return 0; + return nullptr; return ctx->m_dynamicData->getDeclarationForIndex(m_declarationIndex); } diff --git a/language/duchain/indexedducontext.cpp b/language/duchain/indexedducontext.cpp --- a/language/duchain/indexedducontext.cpp +++ b/language/duchain/indexedducontext.cpp @@ -56,14 +56,14 @@ DUContext* IndexedDUContext::context() const { if(isDummy()) - return 0; + return nullptr; // ENSURE_CHAIN_READ_LOCKED if(!m_topContext) - return 0; + return nullptr; TopDUContext* ctx = DUChain::self()->chainForIndex(m_topContext); if(!ctx) - return 0; + return nullptr; if(!m_contextIndex) return ctx; diff --git a/language/duchain/indexedtopducontext.cpp b/language/duchain/indexedtopducontext.cpp --- a/language/duchain/indexedtopducontext.cpp +++ b/language/duchain/indexedtopducontext.cpp @@ -48,5 +48,5 @@ if(index()) return DUChain::self()->chainForIndex(index()); else - return 0; + return nullptr; } diff --git a/language/duchain/localindexeddeclaration.cpp b/language/duchain/localindexeddeclaration.cpp --- a/language/duchain/localindexeddeclaration.cpp +++ b/language/duchain/localindexeddeclaration.cpp @@ -37,7 +37,7 @@ Declaration* LocalIndexedDeclaration::data(TopDUContext* top) const { if(!m_declarationIndex) - return 0; + return nullptr; Q_ASSERT(top); return top->m_dynamicData->getDeclarationForIndex(m_declarationIndex); } diff --git a/language/duchain/localindexedducontext.cpp b/language/duchain/localindexedducontext.cpp --- a/language/duchain/localindexedducontext.cpp +++ b/language/duchain/localindexedducontext.cpp @@ -52,7 +52,7 @@ DUContext* LocalIndexedDUContext::data(TopDUContext* top) const { if(!m_contextIndex) - return 0; + return nullptr; else return top->m_dynamicData->getContextForIndex(m_contextIndex); } diff --git a/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp b/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp --- a/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp +++ b/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp @@ -46,7 +46,7 @@ namespace KDevelop { AbstractDeclarationNavigationContext::AbstractDeclarationNavigationContext( DeclarationPointer decl, TopDUContextPointer topContext, AbstractNavigationContext* previousContext) - : AbstractNavigationContext((topContext ? topContext : TopDUContextPointer(decl ? decl->topContext() : 0)), previousContext), m_declaration(decl), m_fullBackwardSearch(false) + : AbstractNavigationContext((topContext ? topContext : TopDUContextPointer(decl ? decl->topContext() : nullptr)), previousContext), m_declaration(decl), m_fullBackwardSearch(false) { //Jump from definition to declaration if possible FunctionDefinition* definition = dynamic_cast(m_declaration.data()); diff --git a/language/duchain/navigation/abstractincludenavigationcontext.cpp b/language/duchain/navigation/abstractincludenavigationcontext.cpp --- a/language/duchain/navigation/abstractincludenavigationcontext.cpp +++ b/language/duchain/navigation/abstractincludenavigationcontext.cpp @@ -37,18 +37,18 @@ TopDUContext* pickContextWithData(QList duchains, uint maxDepth, const ParsingEnvironmentType& type, bool forcePick = true) { - TopDUContext* duchain = 0; + TopDUContext* duchain = nullptr; foreach(TopDUContext* ctx, duchains) { if(!ctx->parsingEnvironmentFile() || ctx->parsingEnvironmentFile()->type() != type) continue; if(ctx->childContexts().count() != 0 - && (duchain == 0 || ctx->childContexts().count() > duchain->childContexts().count())) { + && (duchain == nullptr || ctx->childContexts().count() > duchain->childContexts().count())) { duchain = ctx; } if(ctx->localDeclarations().count() != 0 - && (duchain == 0 || ctx->localDeclarations().count() > duchain->localDeclarations().count())) { + && (duchain == nullptr || ctx->localDeclarations().count() > duchain->localDeclarations().count())) { duchain = ctx; } } @@ -58,8 +58,8 @@ foreach(TopDUContext* ctx, duchains) { QList children; foreach(const DUContext::Import &import, ctx->importedParentContexts()) - if(import.context(0)) - children << import.context(0)->topContext(); + if(import.context(nullptr)) + children << import.context(nullptr)->topContext(); duchain = pickContextWithData(children, maxDepth-1, type, false); if(duchain) diff --git a/language/duchain/navigation/abstractnavigationcontext.cpp b/language/duchain/navigation/abstractnavigationcontext.cpp --- a/language/duchain/navigation/abstractnavigationcontext.cpp +++ b/language/duchain/navigation/abstractnavigationcontext.cpp @@ -436,7 +436,7 @@ } QWidget* AbstractNavigationContext::widget() const { - return 0; + return nullptr; } ///Splits the string by the given regular expression, but keeps the split-matches at the end of each line diff --git a/language/duchain/navigation/abstractnavigationwidget.cpp b/language/duchain/navigation/abstractnavigationwidget.cpp --- a/language/duchain/navigation/abstractnavigationwidget.cpp +++ b/language/duchain/navigation/abstractnavigationwidget.cpp @@ -33,7 +33,7 @@ namespace KDevelop { AbstractNavigationWidget::AbstractNavigationWidget() - : m_browser(0), m_currentWidget(0) + : m_browser(nullptr), m_currentWidget(nullptr) { setPalette( QApplication::palette() ); setFocusPolicy(Qt::NoFocus); @@ -97,7 +97,7 @@ void AbstractNavigationWidget::setContext(NavigationContextPointer context, int initBrows) { - if(m_browser == 0) + if(m_browser == nullptr) initBrowser(initBrows); if(!context) { @@ -184,7 +184,7 @@ if(m_currentWidget) { layout()->removeWidget(m_currentWidget); - m_currentWidget->setParent(0); + m_currentWidget->setParent(nullptr); } m_currentWidget = m_context->widget(); diff --git a/language/duchain/navigation/usescollector.cpp b/language/duchain/navigation/usescollector.cpp --- a/language/duchain/navigation/usescollector.cpp +++ b/language/duchain/navigation/usescollector.cpp @@ -164,7 +164,7 @@ allDeclarations.insert(d); if(m_collectConstructors && d.data() && d.data()->internalContext() && d.data()->internalContext()->type() == DUContext::Class) { - QList constructors = d.data()->internalContext()->findLocalDeclarations(d.data()->identifier(), CursorInRevision::invalid(), 0, AbstractType::Ptr(), DUContext::OnlyFunctions); + QList constructors = d.data()->internalContext()->findLocalDeclarations(d.data()->identifier(), CursorInRevision::invalid(), nullptr, AbstractType::Ptr(), DUContext::OnlyFunctions); foreach(Declaration* constructor, constructors) { ClassFunctionDeclaration* classFun = dynamic_cast(constructor); if(classFun && classFun->isConstructor()) @@ -173,7 +173,7 @@ Identifier destructorId = destructorForName(d.data()->identifier()); - QList destructors = d.data()->internalContext()->findLocalDeclarations(destructorId, CursorInRevision::invalid(), 0, AbstractType::Ptr(), DUContext::OnlyFunctions); + QList destructors = d.data()->internalContext()->findLocalDeclarations(destructorId, CursorInRevision::invalid(), nullptr, AbstractType::Ptr(), DUContext::OnlyFunctions); foreach(Declaration* destructor, destructors) { ClassFunctionDeclaration* classFun = dynamic_cast(destructor); if(classFun && classFun->isDestructor()) @@ -332,9 +332,9 @@ if(topContext->parsingEnvironmentFile() && topContext->parsingEnvironmentFile()->isProxyContext()) { ///Use the attached content-context instead foreach(const DUContext::Import &import, topContext->importedParentContexts()) { - if(import.context(0) && import.context(0)->topContext()->parsingEnvironmentFile() && !import.context(0)->topContext()->parsingEnvironmentFile()->isProxyContext()) { - if((import.context(0)->topContext()->features() & TopDUContext::AllDeclarationsContextsAndUses)) { - ReferencedTopDUContext newTop(import.context(0)->topContext()); + if(import.context(nullptr) && import.context(nullptr)->topContext()->parsingEnvironmentFile() && !import.context(nullptr)->topContext()->parsingEnvironmentFile()->isProxyContext()) { + if((import.context(nullptr)->topContext()->features() & TopDUContext::AllDeclarationsContextsAndUses)) { + ReferencedTopDUContext newTop(import.context(nullptr)->topContext()); topContext = newTop; break; } @@ -342,7 +342,7 @@ } if(topContext->parsingEnvironmentFile() && topContext->parsingEnvironmentFile()->isProxyContext()) { qCDebug(LANGUAGE) << "got bad proxy-context for" << url.str(); - topContext = 0; + topContext = nullptr; } } @@ -411,8 +411,8 @@ QList imports; foreach(const DUContext::Import &imported, topContext->importedParentContexts()) - if(imported.context(0) && imported.context(0)->topContext()) - imports << KDevelop::ReferencedTopDUContext(imported.context(0)->topContext()); + if(imported.context(nullptr) && imported.context(nullptr)->topContext()) + imports << KDevelop::ReferencedTopDUContext(imported.context(nullptr)->topContext()); foreach(const KDevelop::ReferencedTopDUContext &import, imports) { IndexedString url = import->url(); diff --git a/language/duchain/navigation/useswidget.cpp b/language/duchain/navigation/useswidget.cpp --- a/language/duchain/navigation/useswidget.cpp +++ b/language/duchain/navigation/useswidget.cpp @@ -195,7 +195,7 @@ if(show && !m_headerLayout->parent()) m_layout->insertLayout(0, m_headerLayout); else - m_headerLayout->setParent(0); + m_headerLayout->setParent(nullptr); } NavigatableWidgetList::~NavigatableWidgetList() { @@ -511,7 +511,7 @@ UsesWidget::~UsesWidget() { if (m_collector) { - m_collector->setWidget(0); + m_collector->setWidget(nullptr); } } @@ -587,7 +587,7 @@ } } -UsesWidget::UsesWidgetCollector::UsesWidgetCollector(IndexedDeclaration decl) : UsesCollector(decl), m_widget(0) { +UsesWidget::UsesWidgetCollector::UsesWidgetCollector(IndexedDeclaration decl) : UsesCollector(decl), m_widget(nullptr) { } @@ -623,7 +623,7 @@ if(processed == total) { m_widget->setUpdatesEnabled(false); delete m_widget->m_progressBar; - m_widget->m_progressBar = 0; + m_widget->m_progressBar = nullptr; m_widget->setShowHeader(false); m_widget->setUpdatesEnabled(true); } diff --git a/language/duchain/parsingenvironment.cpp b/language/duchain/parsingenvironment.cpp --- a/language/duchain/parsingenvironment.cpp +++ b/language/duchain/parsingenvironment.cpp @@ -32,7 +32,7 @@ namespace KDevelop { -StaticParsingEnvironmentData* ParsingEnvironmentFile::m_staticData = 0; +StaticParsingEnvironmentData* ParsingEnvironmentFile::m_staticData = nullptr; #if 0 ///Wrapper class around objects that are managed through the DUChain, and may contain arbitrary objects diff --git a/language/duchain/persistentsymboltable.cpp b/language/duchain/persistentsymboltable.cpp --- a/language/duchain/persistentsymboltable.cpp +++ b/language/duchain/persistentsymboltable.cpp @@ -42,7 +42,7 @@ namespace KDevelop { Utils::BasicSetRepository* RecursiveImportCacheRepository::repository() { - static Utils::BasicSetRepository recursiveImportCacheRepositoryObject(QStringLiteral("Recursive Imports Cache"), 0, false); + static Utils::BasicSetRepository recursiveImportCacheRepositoryObject(QStringLiteral("Recursive Imports Cache"), nullptr, false); return &recursiveImportCacheRepositoryObject; } @@ -346,7 +346,7 @@ declarationsTarget = repositoryItem->declarations(); }else{ countTarget = 0; - declarationsTarget = 0; + declarationsTarget = nullptr; } } diff --git a/language/duchain/problem.cpp b/language/duchain/problem.cpp --- a/language/duchain/problem.cpp +++ b/language/duchain/problem.cpp @@ -135,7 +135,7 @@ void Problem::addDiagnostic(const IProblem::Ptr &diagnostic) { Problem *problem = dynamic_cast(diagnostic.data()); - Q_ASSERT(problem != NULL); + Q_ASSERT(problem != nullptr); ProblemPointer ptr(problem); diff --git a/language/duchain/specializationstore.cpp b/language/duchain/specializationstore.cpp --- a/language/duchain/specializationstore.cpp +++ b/language/duchain/specializationstore.cpp @@ -69,7 +69,7 @@ bool recursive) { if(!declaration) - return 0; + return nullptr; IndexedInstantiationInformation specialization = get(declaration->id()); if(specialization.index()) @@ -98,7 +98,7 @@ bool recursive) { if(!context) - return 0; + return nullptr; if(Declaration* declaration = context->owner()) return applySpecialization(declaration, source, recursive)->internalContext(); diff --git a/language/duchain/topducontext.cpp b/language/duchain/topducontext.cpp --- a/language/duchain/topducontext.cpp +++ b/language/duchain/topducontext.cpp @@ -112,8 +112,8 @@ QMutexLocker lock(&importStructureMutex); foreach(const DUContext::Import& import, m_importedContexts) - if(DUChain::self()->isInMemory(import.topContextIndex()) && dynamic_cast(import.context(0))) - dynamic_cast(import.context(0))->m_local->m_directImporters.remove(m_ctxt); + if(DUChain::self()->isInMemory(import.topContextIndex()) && dynamic_cast(import.context(nullptr))) + dynamic_cast(import.context(nullptr))->m_local->m_directImporters.remove(m_ctxt); } ///@todo Make all this work consistently together with import-caching @@ -125,8 +125,8 @@ FOREACH_FUNCTION(const DUContext::Import& import, m_ctxt->d_func()->m_importedContexts) { if(DUChain::self()->isInMemory(import.topContextIndex())) { - Q_ASSERT(import.context(0)); - TopDUContext* top = import.context(0)->topContext(); + Q_ASSERT(import.context(nullptr)); + TopDUContext* top = import.context(nullptr)->topContext(); Q_ASSERT(top); addImportedContextRecursively(top, false, true); } @@ -166,7 +166,7 @@ QSet > rebuild; foreach(const DUContext::Import &import, m_importedContexts) { - TopDUContext* top = dynamic_cast(import.context(0)); + TopDUContext* top = dynamic_cast(import.context(nullptr)); if(top) { top->m_local->m_directImporters.remove(m_ctxt); @@ -475,7 +475,7 @@ return; for(QVector::const_iterator parentIt = m_importedContexts.constBegin(); parentIt != m_importedContexts.constEnd(); ++parentIt) { - TopDUContext* top = dynamic_cast(const_cast(parentIt->context(0))); //To avoid detaching, use const iterator + TopDUContext* top = dynamic_cast(const_cast(parentIt->context(nullptr))); //To avoid detaching, use const iterator if(top) { // top->m_local->needImportStructure(); if(top == imported) { @@ -491,7 +491,7 @@ } for(unsigned int a = 0; a < m_ctxt->d_func()->m_importedContextsSize(); ++a) { - TopDUContext* top = dynamic_cast(const_cast(m_ctxt->d_func()->m_importedContexts()[a].context(0))); //To avoid detaching, use const iterator + TopDUContext* top = dynamic_cast(const_cast(m_ctxt->d_func()->m_importedContexts()[a].context(nullptr))); //To avoid detaching, use const iterator if(top) { // top->m_local->needImportStructure(); if(top == imported) { @@ -512,7 +512,7 @@ } void TopDUContext::rebuildDynamicData(DUContext* parent, uint ownIndex) { - Q_ASSERT(parent == 0 && ownIndex != 0); + Q_ASSERT(parent == nullptr && ownIndex != 0); m_local->m_ownIndex = ownIndex; DUContext::rebuildDynamicData(parent, 0); @@ -688,7 +688,7 @@ target.append(decl); } - check.createVisibleCache = 0; + check.createVisibleCache = nullptr; return !top->foundEnough(target, flags); } @@ -723,7 +723,7 @@ struct TopDUContext::ApplyAliasesBuddyInfo { ApplyAliasesBuddyInfo(uint importChainType, ApplyAliasesBuddyInfo* predecessor, IndexedQualifiedIdentifier importId) : m_importChainType(importChainType), m_predecessor(predecessor), m_importId(importId) { if(m_predecessor && m_predecessor->m_importChainType != importChainType) - m_predecessor = 0; + m_predecessor = nullptr; } bool alreadyImporting(IndexedQualifiedIdentifier id) { @@ -776,7 +776,7 @@ PersistentSymbolTable::FilteredDeclarationIterator filter = PersistentSymbolTable::self().getFilteredDeclarations(aliasId, recursiveImportIndices()); if(filter) { - DeclarationChecker check(this, position, AbstractType::Ptr(), NoSearchFlags, 0); + DeclarationChecker check(this, position, AbstractType::Ptr(), NoSearchFlags, nullptr); //The first part of the identifier has been found as a namespace-alias. //In c++, we only need the first alias. However, just to be correct, follow them all for now. @@ -834,7 +834,7 @@ return false; } else { foreach (const SearchItem::Ptr& next, identifier->next) - if(!applyAliases(id, next, accept, position, canBeNamespace, 0, recursionDepth+1)) + if(!applyAliases(id, next, accept, position, canBeNamespace, nullptr, recursionDepth+1)) return false; } } @@ -857,7 +857,7 @@ PersistentSymbolTable::FilteredDeclarationIterator filter = PersistentSymbolTable::self().getFilteredDeclarations(importId, recursiveImportIndices()); if(filter) { - DeclarationChecker check(this, position, AbstractType::Ptr(), NoSearchFlags, 0); + DeclarationChecker check(this, position, AbstractType::Ptr(), NoSearchFlags, nullptr); for(; filter; ++filter) { @@ -905,7 +905,7 @@ QualifiedIdentifier emptyId; for (const SearchItem::Ptr& item : identifiers) - applyAliases(emptyId, item, acceptor, position, canBeNamespace, 0, 0); + applyAliases(emptyId, item, acceptor, position, canBeNamespace, nullptr, 0); } TopDUContext * TopDUContext::topContext() const @@ -1091,7 +1091,7 @@ }else if(declarationIndex < d_func()->m_usedDeclarationIdsSize()) return d_func()->m_usedDeclarationIds()[declarationIndex].getDeclaration(this); else - return 0; + return nullptr; } int TopDUContext::indexForUsedDeclaration(Declaration* declaration, bool create) { @@ -1157,7 +1157,7 @@ void TopDUContext::clearAst() { - setAst(QExplicitlySharedDataPointer(0)); + setAst(QExplicitlySharedDataPointer(nullptr)); } IndexedString TopDUContext::url() const { diff --git a/language/duchain/topducontextdynamicdata.cpp b/language/duchain/topducontextdynamicdata.cpp --- a/language/duchain/topducontextdynamicdata.cpp +++ b/language/duchain/topducontextdynamicdata.cpp @@ -136,7 +136,7 @@ totalOffset -= data[a].position; } Q_ASSERT_X(false, Q_FUNC_INFO, "Offset doesn't exist in the data."); - return 0; + return nullptr; } void verifyDataInfo(const TopDUContextDynamicData::ItemDataInfo& info, const QVector& data) @@ -468,8 +468,8 @@ , m_problems(this) , m_onDisk(false) , m_dataLoaded(true) - , m_mappedFile(0) - , m_mappedData(0) + , m_mappedFile(nullptr) + , m_mappedData(nullptr) , m_mappedDataSize(0) , m_itemRetrievalForbidden(false) { @@ -489,8 +489,8 @@ void KDevelop::TopDUContextDynamicData::unmap() { delete m_mappedFile; - m_mappedFile = 0; - m_mappedData = 0; + m_mappedFile = nullptr; + m_mappedData = nullptr; m_mappedDataSize = 0; } @@ -581,7 +581,7 @@ if(file.open(QIODevice::ReadOnly)) { if(file.size() == 0) { qCWarning(LANGUAGE) << "Top-context file is empty" << file.fileName(); - return 0; + return nullptr; } QVector contextDataOffsets; QVector declarationDataOffsets; @@ -595,7 +595,7 @@ TopDUContext* ret = dynamic_cast(DUChainItemSystem::self().create(topData)); if(!ret) { qCWarning(LANGUAGE) << "Cannot load a top-context from file" << file.fileName() << "- the required language-support for handling ID" << topData->classId << "is probably not loaded"; - return 0; + return nullptr; } TopDUContextDynamicData& target(*ret->m_dynamicData); @@ -603,11 +603,11 @@ target.m_data.clear(); target.m_dataLoaded = false; target.m_onDisk = true; - ret->rebuildDynamicData(0, topContextIndex); + ret->rebuildDynamicData(nullptr, topContextIndex); target.m_topContextData.append({topContextData, (uint)0}); return ret; }else{ - return 0; + return nullptr; } } diff --git a/language/duchain/types/identifiedtype.cpp b/language/duchain/types/identifiedtype.cpp --- a/language/duchain/types/identifiedtype.cpp +++ b/language/duchain/types/identifiedtype.cpp @@ -77,7 +77,7 @@ if(decl) return decl->internalContext(); else - return 0; + return nullptr; } void IdentifiedType::setDeclaration(Declaration* declaration) diff --git a/language/duchain/types/typeregister.cpp b/language/duchain/types/typeregister.cpp --- a/language/duchain/types/typeregister.cpp +++ b/language/duchain/types/typeregister.cpp @@ -22,7 +22,7 @@ AbstractType* TypeSystem::create(AbstractTypeData* data) const { if (!isFactoryLoaded(*data)) { - return 0; + return nullptr; } return m_factories.value(data->typeClassId)->create(data); } diff --git a/language/editor/persistentmovingrangeprivate.cpp b/language/editor/persistentmovingrangeprivate.cpp --- a/language/editor/persistentmovingrangeprivate.cpp +++ b/language/editor/persistentmovingrangeprivate.cpp @@ -27,8 +27,8 @@ void KDevelop::PersistentMovingRangePrivate::connectTracker() { - Q_ASSERT(m_tracker == 0); - Q_ASSERT(m_movingRange == 0); + Q_ASSERT(m_tracker == nullptr); + Q_ASSERT(m_movingRange == nullptr); m_tracker = ICore::self()->languageController()->backgroundParser()->trackerForUrl(m_document); @@ -57,7 +57,7 @@ delete m_movingRange; m_tracker.clear(); - m_movingRange = 0; + m_movingRange = nullptr; } void KDevelop::PersistentMovingRangePrivate::aboutToInvalidateMovingInterfaceContent() @@ -70,7 +70,7 @@ m_valid = false; /// @todo More precise tracking: Why is the document being invalidated? Try /// keeping the range alive. DocumentChangeTracker to the rescue. delete m_movingRange; - m_movingRange = 0; + m_movingRange = nullptr; m_range = KTextEditor::Range::invalid(); } } @@ -90,6 +90,6 @@ // No need to disconnect, as the document is being deleted. Simply set the referenes to zero. delete m_movingRange; - m_movingRange = 0; + m_movingRange = nullptr; m_tracker.clear(); } diff --git a/language/highlighting/codehighlighting.cpp b/language/highlighting/codehighlighting.cpp --- a/language/highlighting/codehighlighting.cpp +++ b/language/highlighting/codehighlighting.cpp @@ -137,7 +137,7 @@ } ColorMap emptyColorMap() { - ColorMap ret(ColorCache::self()->validColorCount()+1, 0); + ColorMap ret(ColorCache::self()->validColorCount()+1, nullptr); return ret; } @@ -331,7 +331,7 @@ KDevelop::Declaration* CodeHighlightingInstance::localClassFromCodeContext(KDevelop::DUContext* context) const { if(!context) - return 0; + return nullptr; if(m_contextClasses.contains(context)) return m_contextClasses[context]; @@ -349,7 +349,7 @@ } ///Step 1: Find the function-declaration for the function we are in - Declaration* functionDeclaration = 0; + Declaration* functionDeclaration = nullptr; if( FunctionDefinition* def = dynamic_cast(context->owner()) ) { @@ -364,8 +364,8 @@ if(!functionDeclaration) { if(m_useClassCache) - m_contextClasses[context] = 0; - return 0; + m_contextClasses[context] = nullptr; + return nullptr; } Declaration* decl = functionDeclaration->context()->owner(); @@ -462,7 +462,7 @@ { HighlightedRange h; h.range = declaration->range(); - h.attribute = m_highlighting->attributeForType(typeForDeclaration(declaration, 0), DeclarationContext, color); + h.attribute = m_highlighting->attributeForType(typeForDeclaration(declaration, nullptr), DeclarationContext, color); m_highlight.push_back(h); } diff --git a/language/highlighting/colorcache.cpp b/language/highlighting/colorcache.cpp --- a/language/highlighting/colorcache.cpp +++ b/language/highlighting/colorcache.cpp @@ -43,13 +43,13 @@ namespace KDevelop { -ColorCache* ColorCache::m_self = 0; +ColorCache* ColorCache::m_self = nullptr; ColorCache::ColorCache(QObject* parent) - : QObject(parent), m_defaultColors(0), m_validColorCount(0), m_colorOffset(0), + : QObject(parent), m_defaultColors(nullptr), m_validColorCount(0), m_colorOffset(0), m_localColorRatio(0), m_globalColorRatio(0), m_boldDeclarations(true) { - Q_ASSERT(m_self == 0); + Q_ASSERT(m_self == nullptr); updateColorsFromScheme(); // default / fallback updateColorsFromSettings(); @@ -84,9 +84,9 @@ ColorCache::~ColorCache() { - m_self = 0; + m_self = nullptr; delete m_defaultColors; - m_defaultColors = 0; + m_defaultColors = nullptr; } ColorCache* ColorCache::self() diff --git a/language/interfaces/ilanguagesupport.cpp b/language/interfaces/ilanguagesupport.cpp --- a/language/interfaces/ilanguagesupport.cpp +++ b/language/interfaces/ilanguagesupport.cpp @@ -63,11 +63,11 @@ QWidget* ILanguageSupport::specialLanguageObjectNavigationWidget(const QUrl& url, const KTextEditor::Cursor& position) { Q_UNUSED(url) Q_UNUSED(position) - return 0; + return nullptr; } ICodeHighlighting* ILanguageSupport::codeHighlighting() const { - return 0; + return nullptr; } BasicRefactoring* ILanguageSupport::refactoring() const @@ -76,7 +76,7 @@ } ICreateClassHelper* ILanguageSupport::createClassHelper() const { - return 0; + return nullptr; } SourceFormatterItemList ILanguageSupport::sourceFormatterItems() const diff --git a/language/interfaces/quickopendataprovider.cpp b/language/interfaces/quickopendataprovider.cpp --- a/language/interfaces/quickopendataprovider.cpp +++ b/language/interfaces/quickopendataprovider.cpp @@ -42,7 +42,7 @@ } QWidget* QuickOpenDataBase::expandingWidget() const { - return 0; + return nullptr; } QList QuickOpenDataBase::highlighting() const { diff --git a/language/util/setrepository.cpp b/language/util/setrepository.cpp --- a/language/util/setrepository.cpp +++ b/language/util/setrepository.cpp @@ -103,7 +103,7 @@ QString shortLabel(const SetNodeData& node) const; uint set_union(uint firstNode, uint secondNode, const SetNodeData* first, const SetNodeData* second, uchar splitBit = 31); - uint createSetFromNodes(uint leftNode, uint rightNode, const SetNodeData* left = 0, const SetNodeData* right = 0); + uint createSetFromNodes(uint leftNode, uint rightNode, const SetNodeData* left = nullptr, const SetNodeData* right = nullptr); uint computeSetFromNodes(uint leftNode, uint rightNode, const SetNodeData* left, const SetNodeData* right, uchar splitBit); uint set_intersect(uint firstNode, uint secondNode, const SetNodeData* first, const SetNodeData* second, uchar splitBit = 31); bool set_contains(const SetNodeData* node, Index index); @@ -225,7 +225,7 @@ private: }; -Set::Set() : m_tree(0), m_repository(0) { +Set::Set() : m_tree(0), m_repository(nullptr) { } Set::~Set() { @@ -341,7 +341,7 @@ class Set::Iterator::IteratorPrivate { public: - IteratorPrivate() : nodeStackSize(0), currentIndex(0), repository(0) { + IteratorPrivate() : nodeStackSize(0), currentIndex(0), repository(nullptr) { nodeStackData.resize(nodeStackAlloc); nodeStack = nodeStackData.data(); } @@ -531,7 +531,7 @@ //Create a new set from left + rightLeft, and from rightRight. That set will have the correct split-position. uint newLeftNode = computeSetFromNodes(leftNode, rightLeftNode, left, rightLeft, splitBit); - return createSetFromNodes(newLeftNode, rightRightNode, 0, rightRight); + return createSetFromNodes(newLeftNode, rightRightNode, nullptr, rightRight); }else{ return createSetFromNodes(leftNode, rightNode, left, right); } @@ -595,7 +595,7 @@ //So we only need to union that side of first with second. if(secondEnd <= splitPosition) { - return createSetFromNodes( set_union(firstLeftNode, secondNode, firstLeft, second, splitBit), firstRightNode, 0, firstRight ); + return createSetFromNodes( set_union(firstLeftNode, secondNode, firstLeft, second, splitBit), firstRightNode, nullptr, firstRight ); }else{ Q_ASSERT(secondStart >= splitPosition); return createSetFromNodes( firstLeftNode, set_union(firstRightNode, secondNode, firstRight, second, splitBit), firstLeft ); @@ -612,7 +612,7 @@ Q_ASSERT(splitPosition >= secondLeft->end() && splitPosition <= secondRight->start()); if(firstEnd <= splitPosition) { - return createSetFromNodes( set_union(secondLeftNode, firstNode, secondLeft, first, splitBit), secondRightNode, 0, secondRight ); + return createSetFromNodes( set_union(secondLeftNode, firstNode, secondLeft, first, splitBit), secondRightNode, nullptr, secondRight ); }else{ Q_ASSERT(firstStart >= splitPosition); return createSetFromNodes( secondLeftNode, set_union(secondRightNode, firstNode, secondRight, first, splitBit), secondLeft ); @@ -887,7 +887,7 @@ return createSetFromIndices(indicesVector); } -BasicSetRepository::BasicSetRepository(QString name, KDevelop::ItemRepositoryRegistry* registry, bool delayedDeletion) : d(new Private(name)), dataRepository(this, name, registry), m_mutex(0), m_delayedDeletion(delayedDeletion) { +BasicSetRepository::BasicSetRepository(QString name, KDevelop::ItemRepositoryRegistry* registry, bool delayedDeletion) : d(new Private(name)), dataRepository(this, name, registry), m_mutex(nullptr), m_delayedDeletion(delayedDeletion) { m_mutex = dataRepository.mutex(); } diff --git a/outputview/outputjob.cpp b/outputview/outputjob.cpp --- a/outputview/outputjob.cpp +++ b/outputview/outputjob.cpp @@ -36,7 +36,7 @@ , m_killJobOnOutputClose(true) , m_verbosity(verbosity) , m_outputId(-1) - , m_outputDelegate(0) + , m_outputDelegate(nullptr) { } @@ -61,14 +61,14 @@ m_outputId = view->registerOutputInToolView( tvid, m_title, m_behaviours ); if (!m_outputModel) { - m_outputModel = new QStandardItemModel(0); + m_outputModel = new QStandardItemModel(nullptr); } // Keep the item model around after the job is gone view->setModel(m_outputId, m_outputModel); if (!m_outputDelegate) { - m_outputDelegate = new QItemDelegate(0); + m_outputDelegate = new QItemDelegate(nullptr); } view->setDelegate(m_outputId, m_outputDelegate); diff --git a/outputview/outputmodel.cpp b/outputview/outputmodel.cpp --- a/outputview/outputmodel.cpp +++ b/outputview/outputmodel.cpp @@ -63,7 +63,7 @@ Q_OBJECT public: ParseWorker() - : QObject(0) + : QObject(nullptr) , m_filter(new NoFilterStrategy) , m_timer(new QTimer(this)) { @@ -408,7 +408,7 @@ void OutputModel::setFilteringStrategy(const OutputFilterStrategy& currentStrategy) { // TODO: Turn into factory, decouple from OutputModel - IFilterStrategy* filter = 0; + IFilterStrategy* filter = nullptr; switch( currentStrategy ) { case NoFilter: diff --git a/plugins/appwizard/appwizardplugin.cpp b/plugins/appwizard/appwizardplugin.cpp --- a/plugins/appwizard/appwizardplugin.cpp +++ b/plugins/appwizard/appwizardplugin.cpp @@ -65,7 +65,7 @@ AppWizardPlugin::AppWizardPlugin(QObject *parent, const QVariantList &) : KDevelop::IPlugin(QStringLiteral("kdevappwizard"), parent) - , m_templatesModel(0) + , m_templatesModel(nullptr) { KDEV_USE_EXTENSION_INTERFACE(KDevelop::ITemplateProvider); setXMLFile(QStringLiteral("kdevappwizard.rc")); @@ -134,7 +134,7 @@ { displayDetails = i18n("Please see the Version Control toolview"); } - KMessageBox::detailedError(0, errorMsg, displayDetails, i18n("Version Control System Error")); + KMessageBox::detailedError(nullptr, errorMsg, displayDetails, i18n("Version Control System Error")); KIO::del(dest)->exec(); tmpdir.remove(); } @@ -244,7 +244,7 @@ m_variables[QStringLiteral("PROJECTDIRNAME")] = dest.fileName(); m_variables[QStringLiteral("VERSIONCONTROLPLUGIN")] = info.vcsPluginName; - KArchive* arch = 0; + KArchive* arch = nullptr; if( templateArchive.endsWith(QLatin1String(".zip")) ) { arch = new KZip(templateArchive); @@ -306,7 +306,7 @@ else { if (KMessageBox::Continue == - KMessageBox::warningContinueCancel(0, + KMessageBox::warningContinueCancel(nullptr, QStringLiteral("Failed to initialize version control system, " "plugin is neither VCS nor DVCS."))) success = true; @@ -400,7 +400,7 @@ if (!copyFileAndExpandMacros(QDir::cleanPath(tdir.path()+'/'+file->name()), KMacroExpander::expandMacros(destName, m_variables))) { - KMessageBox::sorry(0, i18n("The file %1 cannot be created.", dest)); + KMessageBox::sorry(nullptr, i18n("The file %1 cannot be created.", dest)); return false; } } diff --git a/plugins/classbrowser/classbrowserplugin.cpp b/plugins/classbrowser/classbrowserplugin.cpp --- a/plugins/classbrowser/classbrowserplugin.cpp +++ b/plugins/classbrowser/classbrowserplugin.cpp @@ -61,7 +61,7 @@ public: ClassBrowserFactory(ClassBrowserPlugin *plugin): m_plugin(plugin) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { return new ClassWidget(parent, m_plugin); } @@ -83,7 +83,7 @@ ClassBrowserPlugin::ClassBrowserPlugin(QObject *parent, const QVariantList&) : KDevelop::IPlugin(QStringLiteral("kdevclassbrowser"), parent) , m_factory(new ClassBrowserFactory(this)) - , m_activeClassTree(0) + , m_activeClassTree(nullptr) { core()->uiController()->addToolView(i18n("Classes"), m_factory); setXMLFile( QStringLiteral("kdevclassbrowser.rc") ); @@ -106,7 +106,7 @@ KDevelop::ContextMenuExtension menuExt = KDevelop::IPlugin::contextMenuExtension( context ); // No context menu if we don't have a class browser at hand. - if ( m_activeClassTree == 0 ) + if ( m_activeClassTree == nullptr ) return menuExt; KDevelop::DeclarationContext *codeContext = dynamic_cast(context); @@ -139,7 +139,7 @@ Q_ASSERT(qobject_cast(sender())); - if ( m_activeClassTree == 0 ) + if ( m_activeClassTree == nullptr ) return; DUChainReadLocker readLock(DUChain::lock()); @@ -165,7 +165,7 @@ if ( decl && decl->isFunctionDeclaration() ) { FunctionDefinition* funcDefinition = dynamic_cast(decl); - if ( funcDefinition == 0 ) + if ( funcDefinition == nullptr ) funcDefinition = FunctionDefinition::definition(decl); if ( funcDefinition ) decl = funcDefinition; diff --git a/plugins/classbrowser/classtree.cpp b/plugins/classbrowser/classtree.cpp --- a/plugins/classbrowser/classtree.cpp +++ b/plugins/classbrowser/classtree.cpp @@ -48,7 +48,7 @@ ClassTree::ClassTree( QWidget* parent, ClassBrowserPlugin* plugin ) : QTreeView( parent ) - , m_plugin( plugin ), m_tooltip( 0 ) + , m_plugin( plugin ), m_tooltip( nullptr ) { header()->hide(); diff --git a/plugins/contextbrowser/browsemanager.cpp b/plugins/contextbrowser/browsemanager.cpp --- a/plugins/contextbrowser/browsemanager.cpp +++ b/plugins/contextbrowser/browsemanager.cpp @@ -117,7 +117,7 @@ KTextEditor::View* viewFromWidget(QWidget* widget) { if(!widget) - return 0; + return nullptr; KTextEditor::View* view = qobject_cast(widget); if(view) return view; diff --git a/plugins/contextbrowser/contextbrowser.cpp b/plugins/contextbrowser/contextbrowser.cpp --- a/plugins/contextbrowser/contextbrowser.cpp +++ b/plugins/contextbrowser/contextbrowser.cpp @@ -113,7 +113,7 @@ DUContext* getContextAt(const QUrl& url, KTextEditor::Cursor cursor) { TopDUContext* topContext = DUChainUtils::standardContextForUrl(url); - if (!topContext) return 0; + if (!topContext) return nullptr; return contextForHighlightingAt(KTextEditor::Cursor(cursor), topContext); } @@ -137,7 +137,7 @@ public: ContextBrowserViewFactory(ContextBrowserPlugin *plugin): m_plugin(plugin) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { ContextBrowserView* ret = new ContextBrowserView(m_plugin, parent); return ret; @@ -435,8 +435,8 @@ void ContextBrowserPlugin::hideToolTip() { if(m_currentToolTip) { m_currentToolTip->deleteLater(); - m_currentToolTip = 0; - m_currentNavigationWidget = 0; + m_currentToolTip = nullptr; + m_currentNavigationWidget = nullptr; m_currentToolTipProblem = {}; m_currentToolTipDeclaration = {}; } @@ -583,8 +583,8 @@ if(m_currentToolTip) { m_currentToolTip->deleteLater(); - m_currentToolTip = 0; - m_currentNavigationWidget = 0; + m_currentToolTip = nullptr; + m_currentNavigationWidget = nullptr; } KDevelop::NavigationToolTip* tooltip = new KDevelop::NavigationToolTip(view, view->mapToGlobal(view->cursorToCoordinate(position)) + QPoint(20, 40), navigationWidget); @@ -684,7 +684,7 @@ Declaration* ContextBrowserPlugin::findDeclaration(View* view, const KTextEditor::Cursor& position, bool mouseHighlight) { Q_UNUSED(mouseHighlight); - Declaration* foundDeclaration = 0; + Declaration* foundDeclaration = nullptr; if(m_useDeclaration.data()) { foundDeclaration = m_useDeclaration.data(); }else{ @@ -708,7 +708,7 @@ } } - return 0; + return nullptr; } void ContextBrowserPlugin::updateForView(View* view) @@ -759,7 +759,7 @@ ///Check whether there is a special language object to highlight (for example a macro) KTextEditor::Range specialRange = language->specialLanguageObjectRange(url, highlightPosition); - ContextBrowserView* updateBrowserView = shouldUpdateBrowser ? browserViewForWidget(view) : 0; + ContextBrowserView* updateBrowserView = shouldUpdateBrowser ? browserViewForWidget(view) : nullptr; if(specialRange.isValid()) { @@ -886,7 +886,7 @@ if(view->document() == m_lastInsertionDocument && newPosition == m_lastInsertionPos) { //Do not update the highlighting while typing - m_lastInsertionDocument = 0; + m_lastInsertionDocument = nullptr; m_lastInsertionPos = KTextEditor::Cursor(); if(m_highlightedRanges.contains(view)) m_highlightedRanges[view].keep = true; @@ -954,7 +954,7 @@ KTextEditor::Cursor cCurrent(view->cursorPosition()); KDevelop::CursorInRevision c = chosen->transformToLocalRevision(cCurrent); - Declaration* decl = 0; + Declaration* decl = nullptr; //If we have a locked declaration, use that for jumping foreach(ContextBrowserView* view, m_views) { decl = view->lockedDeclaration().data(); ///@todo Somehow match the correct context-browser view if there is multiple @@ -974,7 +974,7 @@ if(decl) { - Declaration* target = 0; + Declaration* target = nullptr; if(forward) //Try jumping from definition to declaration target = DUChainUtils::declarationForDefinition(decl, chosen); diff --git a/plugins/contextbrowser/contextbrowserview.cpp b/plugins/contextbrowser/contextbrowserview.cpp --- a/plugins/contextbrowser/contextbrowserview.cpp +++ b/plugins/contextbrowser/contextbrowserview.cpp @@ -62,7 +62,7 @@ if(m_context.data()) { return m_context.data()->createNavigationWidget(nullptr, nullptr, {}, {}, AbstractNavigationWidget::EmbeddableWidget); } - return 0; + return nullptr; } KDevelop::IndexedDeclaration ContextBrowserView::declaration() const { @@ -79,7 +79,7 @@ { if (m_navigationWidget) { delete m_navigationWidget; - m_navigationWidget = 0; + m_navigationWidget = nullptr; } } diff --git a/plugins/cvs/cvsplugin.cpp b/plugins/cvs/cvsplugin.cpp --- a/plugins/cvs/cvsplugin.cpp +++ b/plugins/cvs/cvsplugin.cpp @@ -57,7 +57,7 @@ { public: KDevCvsViewFactory(CvsPlugin *plugin): m_plugin(plugin) {} - QWidget* create(QWidget *parent = 0) override { + QWidget* create(QWidget *parent = nullptr) override { return new CvsMainView(m_plugin, parent); } Qt::DockWidgetArea defaultPosition() override { @@ -282,7 +282,7 @@ KDevelop::VcsJob * CvsPlugin::repositoryLocation(const QUrl & localLocation) { Q_UNUSED(localLocation); - return NULL; + return nullptr; } KDevelop::VcsJob * CvsPlugin::add(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) @@ -303,7 +303,7 @@ KDevelop::VcsJob * CvsPlugin::localRevision(const QUrl & localLocation, KDevelop::VcsRevision::RevisionType) { Q_UNUSED(localLocation) - return NULL; + return nullptr; } KDevelop::VcsJob * CvsPlugin::status(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) @@ -332,7 +332,7 @@ { bool ok = QFile::copy(localLocationSrc.toLocalFile(), localLocationDstn.path()); if (!ok) { - return NULL; + return nullptr; } QList listDstn; @@ -346,7 +346,7 @@ KDevelop::VcsJob * CvsPlugin::move(const QUrl &, const QUrl &) { - return NULL; + return nullptr; } KDevelop::VcsJob * CvsPlugin::revert(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) @@ -419,7 +419,7 @@ { Q_UNUSED(localLocations); Q_UNUSED(recursion); - return NULL; + return nullptr; } KDevelop::VcsJob * CvsPlugin::import(const QString& commitMessage, const QUrl& sourceDirectory, const KDevelop::VcsLocation& destinationRepository) @@ -428,7 +428,7 @@ || !sourceDirectory.isLocalFile() || !destinationRepository.isValid() || destinationRepository.type() != KDevelop::VcsLocation::RepositoryLocation) { - return 0; + return nullptr; } qCDebug(PLUGIN_CVS) << "CVS Import requested " @@ -451,7 +451,7 @@ if (!destinationDirectory.isLocalFile() || !sourceRepository.isValid() || sourceRepository.type() != KDevelop::VcsLocation::RepositoryLocation) { - return 0; + return nullptr; } qCDebug(PLUGIN_CVS) << "CVS Checkout requested " diff --git a/plugins/cvs/cvsproxy.cpp b/plugins/cvs/cvsproxy.cpp --- a/plugins/cvs/cvsproxy.cpp +++ b/plugins/cvs/cvsproxy.cpp @@ -186,7 +186,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob* CvsProxy::diff(const QUrl& url, @@ -230,7 +230,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob * CvsProxy::annotate(const QUrl& url, const KDevelop::VcsRevision& rev) @@ -251,7 +251,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob* CvsProxy::edit(const QString& repo, const QList& files) @@ -266,7 +266,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } @@ -282,7 +282,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob* CvsProxy::editors(const QString& repo, const QList& files) @@ -297,7 +297,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob* CvsProxy::commit(const QString& repo, const QList& files, const QString& message) @@ -315,7 +315,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob* CvsProxy::add(const QString& repo, const QList& files, @@ -337,7 +337,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob * CvsProxy::remove(const QString& repo, const QList& files) @@ -354,7 +354,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob * CvsProxy::update(const QString& repo, const QList& files, @@ -387,7 +387,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob * CvsProxy::import(const QUrl& directory, @@ -413,7 +413,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob * CvsProxy::checkout(const QUrl& targetDir, @@ -452,7 +452,7 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } CvsJob * CvsProxy::status(const QString & repo, const QList & files, bool recursive, bool taginfo) @@ -475,6 +475,6 @@ return job; } if (job) delete job; - return NULL; + return nullptr; } diff --git a/plugins/documentswitcher/documentswitcherplugin.cpp b/plugins/documentswitcher/documentswitcherplugin.cpp --- a/plugins/documentswitcher/documentswitcherplugin.cpp +++ b/plugins/documentswitcher/documentswitcherplugin.cpp @@ -52,7 +52,7 @@ //TODO: Make the widget transparent DocumentSwitcherPlugin::DocumentSwitcherPlugin(QObject *parent, const QVariantList &/*args*/) - :KDevelop::IPlugin(QStringLiteral("kdevdocumentswitcher"), parent), view(0) + :KDevelop::IPlugin(QStringLiteral("kdevdocumentswitcher"), parent), view(nullptr) { setXMLFile(QStringLiteral("kdevdocumentswitcher.rc")); qCDebug(PLUGIN_DOCUMENTSWITCHER) << "Adding active mainwindow from constructor" << KDevelop::ICore::self()->uiController()->activeMainWindow(); @@ -217,7 +217,7 @@ int row = view->selectionModel()->selectedRows().first().row(); Sublime::MainWindow* window = qobject_cast( KDevelop::ICore::self()->uiController()->activeMainWindow() ); - Sublime::View* activatedView = 0; + Sublime::View* activatedView = nullptr; if( window && documentLists.contains( window ) && documentLists[window].contains( window->area() ) ) { const QList l = documentLists[window][window->area()]; @@ -325,7 +325,7 @@ return; } obj->removeEventFilter( this ); - disconnect( obj, 0, this, 0 ); + disconnect( obj, nullptr, this, nullptr ); documentLists.remove( obj ); } diff --git a/plugins/documentview/kdevdocumentmodel.cpp b/plugins/documentview/kdevdocumentmodel.cpp --- a/plugins/documentview/kdevdocumentmodel.cpp +++ b/plugins/documentview/kdevdocumentmodel.cpp @@ -111,7 +111,7 @@ return item; } - return 0; + return nullptr; } KDevFileItem::KDevFileItem( const QUrl &url ) @@ -161,6 +161,6 @@ return item; } - return 0; + return nullptr; } diff --git a/plugins/documentview/kdevdocumentviewplugin.cpp b/plugins/documentview/kdevdocumentviewplugin.cpp --- a/plugins/documentview/kdevdocumentviewplugin.cpp +++ b/plugins/documentview/kdevdocumentviewplugin.cpp @@ -42,7 +42,7 @@ public: KDevDocumentViewPluginFactory( KDevDocumentViewPlugin *plugin ): m_plugin( plugin ) {} - QWidget* create( QWidget *parent = 0 ) override + QWidget* create( QWidget *parent = nullptr ) override { KDevDocumentView* view = new KDevDocumentView( m_plugin, parent ); KDevelop::IDocumentController* docController = m_plugin->core()->documentController(); diff --git a/plugins/execute/executeplugin.cpp b/plugins/execute/executeplugin.cpp --- a/plugins/execute/executeplugin.cpp +++ b/plugins/execute/executeplugin.cpp @@ -80,7 +80,7 @@ { core()->runController()->removeConfigurationType( m_configType ); delete m_configType; - m_configType = 0; + m_configType = nullptr; } QStringList ExecutePlugin::arguments( KDevelop::ILaunchConfiguration* cfg, QString& err_ ) const @@ -145,7 +145,7 @@ job->updateJobName(); return job; } - return 0; + return nullptr; } diff --git a/plugins/execute/nativeappconfig.cpp b/plugins/execute/nativeappconfig.cpp --- a/plugins/execute/nativeappconfig.cpp +++ b/plugins/execute/nativeappconfig.cpp @@ -70,7 +70,7 @@ void NativeAppConfigPage::loadFromConfiguration(const KConfigGroup& cfg, KDevelop::IProject* project ) { bool b = blockSignals( true ); - projectTarget->setBaseItem( project ? project->projectItem() : 0, true); + projectTarget->setBaseItem( project ? project->projectItem() : nullptr, true); projectTarget->setCurrentItemPath( cfg.readEntry( ExecutePlugin::projectTargetEntry, QStringList() ) ); QUrl exe = cfg.readEntry( ExecutePlugin::executableEntry, QUrl()); @@ -191,7 +191,7 @@ Q_ASSERT(cfg); if( !cfg ) { - return 0; + return nullptr; } if( launchMode == QLatin1String("execute") ) { @@ -208,7 +208,7 @@ } qWarning() << "Unknown launch mode " << launchMode << "for config:" << cfg->name(); - return 0; + return nullptr; } QStringList NativeAppLauncher::supportedModes() const diff --git a/plugins/executescript/executescriptplugin.cpp b/plugins/executescript/executescriptplugin.cpp --- a/plugins/executescript/executescriptplugin.cpp +++ b/plugins/executescript/executescriptplugin.cpp @@ -78,7 +78,7 @@ { core()->runController()->removeConfigurationType( m_configType ); delete m_configType; - m_configType = 0; + m_configType = nullptr; } QUrl ExecuteScriptPlugin::script( KDevelop::ILaunchConfiguration* cfg, QString& err_ ) const diff --git a/plugins/executescript/scriptappconfig.cpp b/plugins/executescript/scriptappconfig.cpp --- a/plugins/executescript/scriptappconfig.cpp +++ b/plugins/executescript/scriptappconfig.cpp @@ -167,14 +167,14 @@ Q_ASSERT(cfg); if( !cfg ) { - return 0; + return nullptr; } if( launchMode == QLatin1String("execute") ) { return new ScriptAppJob( m_plugin, cfg); } qWarning() << "Unknown launch mode " << launchMode << "for config:" << cfg->name(); - return 0; + return nullptr; } QStringList ScriptAppLauncher::supportedModes() const diff --git a/plugins/externalscript/externalscriptjob.cpp b/plugins/externalscript/externalscriptjob.cpp --- a/plugins/externalscript/externalscriptjob.cpp +++ b/plugins/externalscript/externalscriptjob.cpp @@ -52,10 +52,10 @@ ExternalScriptJob::ExternalScriptJob( ExternalScriptItem* item, const QUrl& url, ExternalScriptPlugin* parent ) : KDevelop::OutputJob( parent ), - m_proc( 0 ), m_lineMaker( 0 ), + m_proc( nullptr ), m_lineMaker( nullptr ), m_outputMode( item->outputMode() ), m_inputMode( item->inputMode() ), m_errorMode( item->errorMode() ), m_filterMode( item->filterMode() ), - m_document( 0 ), m_url( url ), m_selectionRange( KTextEditor::Range::invalid() ), + m_document( nullptr ), m_url( url ), m_selectionRange( KTextEditor::Range::invalid() ), m_showOutput( item->showOutput() ) { qCDebug(PLUGIN_EXTERNALSCRIPT) << "creating external script job"; @@ -127,7 +127,7 @@ if ( !m_url.isEmpty() ) { const QUrl url = m_url; - KDevelop::ProjectFolderItem* folder = 0; + KDevelop::ProjectFolderItem* folder = nullptr; if ( KDevelop::ICore::self()->projectController()->findProjectForUrl( url ) ) { QList folders = KDevelop::ICore::self()->projectController()->findProjectForUrl(url)->foldersForPath(KDevelop::IndexedString(url)); if ( !folders.isEmpty() ) { diff --git a/plugins/externalscript/externalscriptplugin.cpp b/plugins/externalscript/externalscriptplugin.cpp --- a/plugins/externalscript/externalscriptplugin.cpp +++ b/plugins/externalscript/externalscriptplugin.cpp @@ -60,7 +60,7 @@ public: ExternalScriptViewFactory( ExternalScriptPlugin *plugin ): m_plugin( plugin ) {} - QWidget* create( QWidget *parent = 0 ) override { + QWidget* create( QWidget *parent = nullptr ) override { return new ExternalScriptView( m_plugin, parent ); } @@ -76,7 +76,7 @@ ExternalScriptPlugin *m_plugin; }; -ExternalScriptPlugin* ExternalScriptPlugin::m_self = 0; +ExternalScriptPlugin* ExternalScriptPlugin::m_self = nullptr; ExternalScriptPlugin::ExternalScriptPlugin( QObject* parent, const QVariantList& /*args*/ ) : IPlugin( QStringLiteral("kdevexternalscript"), parent ), @@ -150,7 +150,7 @@ ExternalScriptPlugin::~ExternalScriptPlugin() { - m_self = 0; + m_self = nullptr; } KDevelop::ContextMenuExtension ExternalScriptPlugin::contextMenuExtension( KDevelop::Context* context ) diff --git a/plugins/externalscript/externalscriptview.cpp b/plugins/externalscript/externalscriptview.cpp --- a/plugins/externalscript/externalscriptview.cpp +++ b/plugins/externalscript/externalscriptview.cpp @@ -84,7 +84,7 @@ ExternalScriptItem* ExternalScriptView::itemForIndex( const QModelIndex& index ) const { if ( !index.isValid() ) { - return 0; + return nullptr; } const QModelIndex mappedIndex = m_model->mapToSource( index ); diff --git a/plugins/filemanager/kdevfilemanagerplugin.cpp b/plugins/filemanager/kdevfilemanagerplugin.cpp --- a/plugins/filemanager/kdevfilemanagerplugin.cpp +++ b/plugins/filemanager/kdevfilemanagerplugin.cpp @@ -34,7 +34,7 @@ class KDevFileManagerViewFactory: public KDevelop::IToolViewFactory{ public: KDevFileManagerViewFactory(KDevFileManagerPlugin *plugin): m_plugin(plugin) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { Q_UNUSED(parent) return new FileManager(m_plugin,parent); diff --git a/plugins/filetemplates/classidentifierpage.cpp b/plugins/filetemplates/classidentifierpage.cpp --- a/plugins/filetemplates/classidentifierpage.cpp +++ b/plugins/filetemplates/classidentifierpage.cpp @@ -25,7 +25,7 @@ struct ClassIdentifierPagePrivate { ClassIdentifierPagePrivate() - : classid(0) + : classid(nullptr) { } diff --git a/plugins/filetemplates/filetemplatesplugin.cpp b/plugins/filetemplates/filetemplatesplugin.cpp --- a/plugins/filetemplates/filetemplatesplugin.cpp +++ b/plugins/filetemplates/filetemplatesplugin.cpp @@ -37,7 +37,7 @@ } - QWidget* create(QWidget* parent = 0) override + QWidget* create(QWidget* parent = nullptr) override { return new TemplatePreviewToolView(m_plugin, parent); } @@ -58,7 +58,7 @@ FileTemplatesPlugin::FileTemplatesPlugin(QObject* parent, const QVariantList& args) : IPlugin(QStringLiteral("kdevfiletemplates"), parent) - , m_model(0) + , m_model(nullptr) { Q_UNUSED(args); KDEV_USE_EXTENSION_INTERFACE(ITemplateProvider) diff --git a/plugins/filetemplates/licensepage.cpp b/plugins/filetemplates/licensepage.cpp --- a/plugins/filetemplates/licensepage.cpp +++ b/plugins/filetemplates/licensepage.cpp @@ -47,7 +47,7 @@ LicensePagePrivate(LicensePage* page_) - : license(0) + : license(nullptr) , page(page_) { } diff --git a/plugins/filetemplates/outputpage.cpp b/plugins/filetemplates/outputpage.cpp --- a/plugins/filetemplates/outputpage.cpp +++ b/plugins/filetemplates/outputpage.cpp @@ -37,7 +37,7 @@ { OutputPagePrivate(OutputPage* page_) : page(page_) - , output(0) + , output(nullptr) { } OutputPage* page; Ui::OutputLocationDialog* output; diff --git a/plugins/filetemplates/overridespage.cpp b/plugins/filetemplates/overridespage.cpp --- a/plugins/filetemplates/overridespage.cpp +++ b/plugins/filetemplates/overridespage.cpp @@ -79,7 +79,7 @@ struct KDevelop::OverridesPagePrivate { OverridesPagePrivate() - : overrides(0) + : overrides(nullptr) { } Ui::OverridesDialog* overrides; diff --git a/plugins/filetemplates/templateclassassistant.cpp b/plugins/filetemplates/templateclassassistant.cpp --- a/plugins/filetemplates/templateclassassistant.cpp +++ b/plugins/filetemplates/templateclassassistant.cpp @@ -111,9 +111,9 @@ TemplateClassAssistantPrivate::TemplateClassAssistantPrivate(const QUrl& baseUrl) : baseUrl(baseUrl) -, helper(0) -, generator(0) -, renderer(0) +, helper(nullptr) +, generator(nullptr) +, renderer(nullptr) { } @@ -162,7 +162,7 @@ } QList targets; - ProjectTargetItem* target = 0; + ProjectTargetItem* target = nullptr; foreach (ProjectBaseItem* item, items) { @@ -315,7 +315,7 @@ d->fileTemplate.setTemplateDescription(templateDescription); d->type = d->fileTemplate.type(); - d->generator = 0; + d->generator = nullptr; if (!d->fileTemplate.isValid()) { @@ -354,7 +354,7 @@ d->membersPage->setIcon(QIcon::fromTheme(QStringLiteral("field"))); setValid(d->membersPage, true); - d->helper = 0; + d->helper = nullptr; QString languageName = d->fileTemplate.languageName(); auto language = ICore::self()->languageController()->language(languageName); if (language) @@ -515,7 +515,7 @@ REMOVE_PAGE(license) delete d->helper; - d->helper = 0; + d->helper = nullptr; if (d->generator) { @@ -525,8 +525,8 @@ { delete d->renderer; } - d->generator = 0; - d->renderer = 0; + d->generator = nullptr; + d->renderer = nullptr; if (d->baseUrl.isValid()) { diff --git a/plugins/filetemplates/templateoptionspage.cpp b/plugins/filetemplates/templateoptionspage.cpp --- a/plugins/filetemplates/templateoptionspage.cpp +++ b/plugins/filetemplates/templateoptionspage.cpp @@ -76,7 +76,7 @@ foreach (const SourceFileTemplate::ConfigOption& entry, it.value()) { QLabel* label = new QLabel(entry.label, box); - QWidget* control = 0; + QWidget* control = nullptr; const QString type = entry.type; if (type == QLatin1String("String")) { diff --git a/plugins/filetemplates/templatepreviewtoolview.cpp b/plugins/filetemplates/templatepreviewtoolview.cpp --- a/plugins/filetemplates/templatepreviewtoolview.cpp +++ b/plugins/filetemplates/templatepreviewtoolview.cpp @@ -40,7 +40,7 @@ TemplatePreviewToolView::TemplatePreviewToolView(FileTemplatesPlugin* plugin, QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f) , ui(new Ui::TemplatePreviewToolView) -, m_original(0) +, m_original(nullptr) , m_plugin(plugin) { ui->setupUi(this); @@ -127,7 +127,7 @@ void TemplatePreviewToolView::showEvent(QShowEvent*) { IDocument* doc = ICore::self()->documentController()->activeDocument(); - documentChanged(doc ? doc->textDocument() : 0); + documentChanged(doc ? doc->textDocument() : nullptr); } void TemplatePreviewToolView::documentClosed(IDocument* document) diff --git a/plugins/filetemplates/templateselectionpage.cpp b/plugins/filetemplates/templateselectionpage.cpp --- a/plugins/filetemplates/templateselectionpage.cpp +++ b/plugins/filetemplates/templateselectionpage.cpp @@ -116,7 +116,7 @@ int idx = 0; foreach(const SourceFileTemplate::OutputFile& out, fileTemplate.outputFiles()) { - TemplatePreview* preview = 0; + TemplatePreview* preview = nullptr; if (ui->tabWidget->count() > idx) { // reuse existing tab preview = qobject_cast(ui->tabWidget->widget(idx)); diff --git a/plugins/git/gitplugin.cpp b/plugins/git/gitplugin.cpp --- a/plugins/git/gitplugin.cpp +++ b/plugins/git/gitplugin.cpp @@ -254,7 +254,7 @@ void GitPlugin::ctxStashManager() { - QPointer d = new StashManagerDialog(urlDir(m_urls), this, 0); + QPointer d = new StashManagerDialog(urlDir(m_urls), this, nullptr); d->exec(); delete d; @@ -536,7 +536,7 @@ } } - if (files_.isEmpty()) return 0; + if (files_.isEmpty()) return nullptr; DVcsJob* job = new GitJob(dotGitDir, this); job->setType(VcsJob::Remove); @@ -591,7 +591,7 @@ void GitPlugin::parseGitBlameOutput(DVcsJob *job) { QVariantList results; - VcsAnnotationLine* annotation = 0; + VcsAnnotationLine* annotation = nullptr; const auto output = job->output(); const auto lines = output.splitRef('\n'); @@ -676,7 +676,7 @@ { QDir d=urlDir(repository); - if(hasModifications(d) && KMessageBox::questionYesNo(0, i18n("There are pending changes, do you want to stash them first?"))==KMessageBox::Yes) { + if(hasModifications(d) && KMessageBox::questionYesNo(nullptr, i18n("There are pending changes, do you want to stash them first?"))==KMessageBox::Yes) { QScopedPointer stash(gitStash(d, QStringList(), KDevelop::OutputJob::Verbose)); stash->exec(); } @@ -1442,7 +1442,7 @@ { Q_OBJECT public: - GitVcsLocationWidget(QWidget* parent = 0, Qt::WindowFlags f = 0) + GitVcsLocationWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr) : StandardVcsLocationWidget(parent, f) {} bool isCorrect() const override diff --git a/plugins/git/gitplugincheckinrepositoryjob.cpp b/plugins/git/gitplugincheckinrepositoryjob.cpp --- a/plugins/git/gitplugincheckinrepositoryjob.cpp +++ b/plugins/git/gitplugincheckinrepositoryjob.cpp @@ -29,8 +29,8 @@ GitPluginCheckInRepositoryJob::GitPluginCheckInRepositoryJob(KTextEditor::Document* document, const QString& rootDirectory) : CheckInRepositoryJob(document) - , m_hashjob(0) - , m_findjob(0) + , m_hashjob(nullptr) + , m_findjob(nullptr) , m_rootDirectory(rootDirectory) {} diff --git a/plugins/grepview/grepoutputdelegate.cpp b/plugins/grepview/grepoutputdelegate.cpp --- a/plugins/grepview/grepoutputdelegate.cpp +++ b/plugins/grepview/grepoutputdelegate.cpp @@ -33,7 +33,7 @@ #include #include -GrepOutputDelegate* GrepOutputDelegate::m_self = 0; +GrepOutputDelegate* GrepOutputDelegate::m_self = nullptr; GrepOutputDelegate* GrepOutputDelegate::self() { @@ -50,7 +50,7 @@ GrepOutputDelegate::~GrepOutputDelegate() { - m_self = 0; + m_self = nullptr; } QColor GrepOutputDelegate::blendColor(QColor color1, QColor color2, double blend) const diff --git a/plugins/grepview/grepoutputmodel.cpp b/plugins/grepview/grepoutputmodel.cpp --- a/plugins/grepview/grepoutputmodel.cpp +++ b/plugins/grepview/grepoutputmodel.cpp @@ -162,7 +162,7 @@ GrepOutputModel::GrepOutputModel( QObject *parent ) : QStandardItemModel( parent ), m_regExp(), m_replacement(), m_replacementTemplate(), m_finalReplacement(), - m_finalUpToDate(false), m_rootItem(0), m_fileCount(0), m_matchCount(0), m_itemsCheckable(false) + m_finalUpToDate(false), m_rootItem(nullptr), m_fileCount(0), m_matchCount(0), m_itemsCheckable(false) { connect(this, &GrepOutputModel::itemChanged, this, &GrepOutputModel::updateCheckState); @@ -175,7 +175,7 @@ { QStandardItemModel::clear(); // the above clear() also destroys the root item, so invalidate the pointer - m_rootItem = 0; + m_rootItem = nullptr; m_fileCount = 0; m_matchCount = 0; @@ -241,7 +241,7 @@ QModelIndex GrepOutputModel::previousItemIndex(const QModelIndex ¤tIdx) const { - GrepOutputItem* current_item = 0; + GrepOutputItem* current_item = nullptr; if (!currentIdx.isValid()) { // no item selected, search recursively for the last item in search results @@ -256,7 +256,7 @@ else current_item = dynamic_cast(itemFromIndex(currentIdx)); - if (current_item->parent() != 0) { + if (current_item->parent() != nullptr) { int row = currentIdx.row(); if(!current_item->isText()) // the item is a file @@ -288,7 +288,7 @@ QModelIndex GrepOutputModel::nextItemIndex(const QModelIndex ¤tIdx) const { - GrepOutputItem* current_item = 0; + GrepOutputItem* current_item = nullptr; if (!currentIdx.isValid()) { QStandardItem *it = item(0,0); @@ -298,7 +298,7 @@ else current_item = dynamic_cast(itemFromIndex(currentIdx)); - if (current_item->parent() == 0) { + if (current_item->parent() == nullptr) { // root item with overview of search results if (current_item->rowCount() > 0) return nextItemIndex(current_item->child(0)->index()); diff --git a/plugins/grepview/grepoutputview.cpp b/plugins/grepview/grepoutputview.cpp --- a/plugins/grepview/grepoutputview.cpp +++ b/plugins/grepview/grepoutputview.cpp @@ -59,12 +59,12 @@ GrepOutputView::GrepOutputView(QWidget* parent, GrepViewPlugin* plugin) : QWidget(parent) - , m_next(0) - , m_prev(0) - , m_collapseAll(0) - , m_expandAll(0) - , m_clearSearchHistory(0) - , m_statusLabel(0) + , m_next(nullptr) + , m_prev(nullptr) + , m_collapseAll(nullptr) + , m_expandAll(nullptr) + , m_clearSearchHistory(nullptr) + , m_statusLabel(nullptr) , m_plugin(plugin) { Ui::GrepOutputView::setupUi(this); diff --git a/plugins/grepview/grepviewplugin.cpp b/plugins/grepview/grepviewplugin.cpp --- a/plugins/grepview/grepviewplugin.cpp +++ b/plugins/grepview/grepviewplugin.cpp @@ -75,7 +75,7 @@ } GrepViewPlugin::GrepViewPlugin( QObject *parent, const QVariantList & ) - : KDevelop::IPlugin( QStringLiteral("kdevgrepview"), parent ), m_currentJob(0) + : KDevelop::IPlugin( QStringLiteral("kdevgrepview"), parent ), m_currentJob(nullptr) { setXMLFile(QStringLiteral("kdevgrepview.rc")); @@ -208,7 +208,7 @@ GrepJob* GrepViewPlugin::newGrepJob() { - if(m_currentJob != 0) + if(m_currentJob != nullptr) { m_currentJob->kill(); } @@ -227,6 +227,6 @@ if(job == m_currentJob) { emit grepJobFinished(); - m_currentJob = 0; + m_currentJob = nullptr; } } diff --git a/plugins/konsole/kdevkonsoleview.cpp b/plugins/konsole/kdevkonsoleview.cpp --- a/plugins/konsole/kdevkonsoleview.cpp +++ b/plugins/konsole/kdevkonsoleview.cpp @@ -43,9 +43,9 @@ void init( KPluginFactory* factory ) { - Q_ASSERT( konsolepart == 0 ); + Q_ASSERT( konsolepart == nullptr ); - Q_ASSERT( factory != 0 ); + Q_ASSERT( factory != nullptr ); if ( ( konsolepart = factory->create( m_view ) ) ) { @@ -84,7 +84,7 @@ void KDevKonsoleViewPrivate::_k_slotTerminalClosed() { - konsolepart = 0; + konsolepart = nullptr; init( mplugin->konsoleFactory() ); } @@ -94,7 +94,7 @@ { d->mplugin = plugin; d->m_view = this; - d->konsolepart = 0; + d->konsolepart = nullptr; setObjectName( i18n( "Konsole" ) ); setWindowIcon( QIcon::fromTheme( QStringLiteral( "utilities-terminal" ), windowIcon() ) ); diff --git a/plugins/konsole/kdevkonsoleviewplugin.cpp b/plugins/konsole/kdevkonsoleviewplugin.cpp --- a/plugins/konsole/kdevkonsoleviewplugin.cpp +++ b/plugins/konsole/kdevkonsoleviewplugin.cpp @@ -41,7 +41,7 @@ public: KDevKonsoleViewFactory(KDevKonsoleViewPlugin *plugin): mplugin(plugin) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { return new KDevKonsoleView(mplugin, parent); } diff --git a/plugins/openwith/openwithplugin.cpp b/plugins/openwith/openwithplugin.cpp --- a/plugins/openwith/openwithplugin.cpp +++ b/plugins/openwith/openwithplugin.cpp @@ -89,7 +89,7 @@ OpenWithPlugin::OpenWithPlugin ( QObject* parent, const QVariantList& ) : IPlugin ( QStringLiteral("kdevopenwith"), parent ), - m_actionMap( 0 ) + m_actionMap( nullptr ) { KDEV_USE_EXTENSION_INTERFACE( IOpenWith ) } @@ -192,7 +192,7 @@ m_services += list; QList actions; - QAction* standardAction = 0; + QAction* standardAction = nullptr; const QString defaultId = defaultForMimeType(m_mimeType); foreach( KService::Ptr svc, list ) { QAction* act = new QAction( isTextEditor(svc) ? i18n("Default Editor") : svc->name(), this ); diff --git a/plugins/outlineview/outlineviewplugin.cpp b/plugins/outlineview/outlineviewplugin.cpp --- a/plugins/outlineview/outlineviewplugin.cpp +++ b/plugins/outlineview/outlineviewplugin.cpp @@ -38,7 +38,7 @@ public: OutlineViewFactory(OutlineViewPlugin *plugin) : m_plugin(plugin) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { return new OutlineWidget(parent, m_plugin); } diff --git a/plugins/patchreview/localpatchsource.cpp b/plugins/patchreview/localpatchsource.cpp --- a/plugins/patchreview/localpatchsource.cpp +++ b/plugins/patchreview/localpatchsource.cpp @@ -28,7 +28,7 @@ LocalPatchSource::LocalPatchSource() : m_applied(false) - , m_widget(0) + , m_widget(nullptr) { } @@ -89,7 +89,7 @@ void LocalPatchSource::createWidget() { delete m_widget; - m_widget = new LocalPatchWidget(this, 0); + m_widget = new LocalPatchWidget(this, nullptr); } QWidget* LocalPatchSource::customWidget() const diff --git a/plugins/patchreview/patchhighlighter.cpp b/plugins/patchreview/patchhighlighter.cpp --- a/plugins/patchreview/patchhighlighter.cpp +++ b/plugins/patchreview/patchhighlighter.cpp @@ -244,7 +244,7 @@ } } - return 0; + return nullptr; } void PatchHighlighter::markToolTipRequested( KTextEditor::Document*, const KTextEditor::Mark& mark, QPoint pos, bool& handled ) { diff --git a/plugins/patchreview/patchreview.cpp b/plugins/patchreview/patchreview.cpp --- a/plugins/patchreview/patchreview.cpp +++ b/plugins/patchreview/patchreview.cpp @@ -254,7 +254,7 @@ if (!patchFile.isEmpty()) //only try to construct the model if we have a patch to load try { - m_diffSettings = new DiffSettings( 0 ); + m_diffSettings = new DiffSettings( nullptr ); m_kompareInfo.reset( new Kompare::Info() ); m_kompareInfo->localDestination = patchFile; m_kompareInfo->localSource = m_patch->baseDir().toLocalFile(); @@ -297,9 +297,9 @@ return; } catch ( const QString & str ) { - KMessageBox::error( 0, str, i18n( "Kompare Model Update" ) ); + KMessageBox::error( nullptr, str, i18n( "Kompare Model Update" ) ); } catch ( const char * str ) { - KMessageBox::error( 0, str, i18n( "Kompare Model Update" ) ); + KMessageBox::error( nullptr, str, i18n( "Kompare Model Update" ) ); } removeHighlighting(); m_modelList.reset( nullptr ); @@ -317,7 +317,7 @@ public: PatchReviewToolViewFactory( PatchReviewPlugin *plugin ) : m_plugin( plugin ) {} - QWidget* create( QWidget *parent = 0 ) override { + QWidget* create( QWidget *parent = nullptr ) override { return new PatchReviewToolView( parent, m_plugin ); } @@ -340,7 +340,7 @@ // Tweak to work around a crash on OS X; see https://bugs.kde.org/show_bug.cgi?id=338829 // and http://qt-project.org/forums/viewthread/38406/#162801 // modified tweak: use setPatch() and deleteLater in that method. - setPatch(0); + setPatch(nullptr); } void PatchReviewPlugin::clearPatch( QObject* _patch ) { @@ -366,7 +366,7 @@ } removeHighlighting(); - m_modelList.reset( 0 ); + m_modelList.reset( nullptr ); m_depth = 0; if( !dynamic_cast( m_patch.data() ) ) { @@ -465,7 +465,7 @@ for( int a = 0; a < m_modelList->modelCount(); ++a ) { QUrl absoluteUrl = urlForFileModel( m_modelList->modelAt( a ) ); if (absoluteUrl.isRelative()) { - KMessageBox::error( 0, i18n("The base directory of the patch must be an absolute directory"), i18n( "Patch Review" ) ); + KMessageBox::error( nullptr, i18n("The base directory of the patch must be an absolute directory"), i18n( "Patch Review" ) ); break; } @@ -511,7 +511,7 @@ PatchReviewPlugin::PatchReviewPlugin( QObject *parent, const QVariantList & ) : KDevelop::IPlugin( QStringLiteral("kdevpatchreview"), parent ), - m_patch( 0 ), m_factory( new PatchReviewToolViewFactory( this ) ) { + m_patch( nullptr ), m_factory( new PatchReviewToolViewFactory( this ) ) { KDEV_USE_EXTENSION_INTERFACE( KDevelop::IPatchReview ) KDEV_USE_EXTENSION_INTERFACE( KDevelop::ILanguageSupport ) qRegisterMetaType( "const Diff2::DiffModel*" ); diff --git a/plugins/patchreview/patchreviewtoolview.cpp b/plugins/patchreview/patchreviewtoolview.cpp --- a/plugins/patchreview/patchreviewtoolview.cpp +++ b/plugins/patchreview/patchreviewtoolview.cpp @@ -149,7 +149,7 @@ IPatchSource::Ptr ips = m_plugin->patch(); if ( !ips ) - return 0; + return nullptr; return dynamic_cast( ips.data() ); } @@ -176,7 +176,7 @@ } bool showTests = false; - IProject* project = 0; + IProject* project = nullptr; QMap files = ipatch->additionalSelectableFiles(); QMap::const_iterator it = files.constBegin(); @@ -227,7 +227,7 @@ m_exportMenu = new Purpose::Menu(this); connect(m_exportMenu, &Purpose::Menu::finished, this, [](const QJsonObject &output, int error, const QString &message) { if (error==0) { - KMessageBox::information(0, i18n("You can find the new request at:
%1
", output["url"].toString()), + KMessageBox::information(nullptr, i18n("You can find the new request at:
%1
", output["url"].toString()), QString(), QString(), KMessageBox::AllowLink); } else { QMessageBox::warning(nullptr, i18n("Error exporting"), i18n("Couldn't export the patch.\n%1", message)); @@ -399,7 +399,7 @@ IDocument* newDoc = ICore::self()->documentController()->openDocument(url, KTextEditor::Range::invalid(), activate ? IDocumentController::DefaultMode : IDocumentController::DoNotActivate, QLatin1String(""), buddyDoc); - KTextEditor::View* view = 0; + KTextEditor::View* view = nullptr; if(newDoc) view = newDoc->activeTextView(); @@ -539,7 +539,7 @@ return; } - IProject* project = 0; + IProject* project = nullptr; QMap files = ipatch->additionalSelectableFiles(); QMap::const_iterator it = files.constBegin(); diff --git a/plugins/problemreporter/problemreportermodel.cpp b/plugins/problemreporter/problemreportermodel.cpp --- a/plugins/problemreporter/problemreportermodel.cpp +++ b/plugins/problemreporter/problemreportermodel.cpp @@ -128,7 +128,7 @@ foreach (const KDevelop::DUContext::Import& ctx, context->importedParentContexts()) { if (!ctx.indexedContext().indexedTopContext().isLoaded()) continue; - KDevelop::TopDUContext* topCtx = dynamic_cast(ctx.context(0)); + KDevelop::TopDUContext* topCtx = dynamic_cast(ctx.context(nullptr)); if (topCtx) { /// If we are starting at a proxy-context, only recurse into other proxy-contexts, because those contain the problems. if (!isProxy diff --git a/plugins/problemreporter/problemreporterplugin.cpp b/plugins/problemreporter/problemreporterplugin.cpp --- a/plugins/problemreporter/problemreporterplugin.cpp +++ b/plugins/problemreporter/problemreporterplugin.cpp @@ -66,7 +66,7 @@ class ProblemReporterFactory : public KDevelop::IToolViewFactory { public: - QWidget* create(QWidget* parent = 0) override + QWidget* create(QWidget* parent = nullptr) override { Q_UNUSED(parent); @@ -196,8 +196,8 @@ text = i18n("Solve: %1", KDevelop::htmlToPlainText(title)); } - QAction* menuAction = new QAction(text, 0); - QMenu* menu(new QMenu(text, 0)); + QAction* menuAction = new QAction(text, nullptr); + QMenu* menu(new QMenu(text, nullptr)); menuAction->setMenu(menu); foreach (QAction* action, actions) menu->addAction(action); diff --git a/plugins/problemreporter/problemsview.cpp b/plugins/problemreporter/problemsview.cpp --- a/plugins/problemreporter/problemsview.cpp +++ b/plugins/problemreporter/problemsview.cpp @@ -399,7 +399,7 @@ void ProblemsView::addModel(const ModelData& data) { - ProblemTreeView* view = new ProblemTreeView(NULL, data.model); + ProblemTreeView* view = new ProblemTreeView(nullptr, data.model); connect(view, &ProblemTreeView::changed, this, &ProblemsView::onViewChanged); int idx = m_tabWidget->addTab(view, data.name); int rows = view->model()->rowCount(); diff --git a/plugins/projectmanagerview/projectbuildsetwidget.cpp b/plugins/projectmanagerview/projectbuildsetwidget.cpp --- a/plugins/projectmanagerview/projectbuildsetwidget.cpp +++ b/plugins/projectmanagerview/projectbuildsetwidget.cpp @@ -51,7 +51,7 @@ #include ProjectBuildSetWidget::ProjectBuildSetWidget( QWidget* parent ) - : QWidget( parent ), m_view( 0 ), + : QWidget( parent ), m_view( nullptr ), m_ui( new Ui::ProjectBuildSetWidget ) { m_ui->setupUi( this ); diff --git a/plugins/projectmanagerview/projectmanagerview.cpp b/plugins/projectmanagerview/projectmanagerview.cpp --- a/plugins/projectmanagerview/projectmanagerview.cpp +++ b/plugins/projectmanagerview/projectmanagerview.cpp @@ -172,7 +172,7 @@ { selected << ICore::self()->projectController()->projectModel()->itemFromIndex(indexFromView( idx )); } - selected.removeAll(0); + selected.removeAll(nullptr); KDevelop::ICore::self()->selectionController()->updateSelection( new ProjectManagerViewItemContext( selected, this ) ); } diff --git a/plugins/projectmanagerview/projectmanagerviewplugin.cpp b/plugins/projectmanagerview/projectmanagerviewplugin.cpp --- a/plugins/projectmanagerview/projectmanagerviewplugin.cpp +++ b/plugins/projectmanagerview/projectmanagerviewplugin.cpp @@ -63,7 +63,7 @@ public: KDevProjectManagerViewFactory( ProjectManagerViewPlugin *plugin ): mplugin( plugin ) {} - QWidget* create( QWidget *parent = 0 ) override + QWidget* create( QWidget *parent = nullptr ) override { return new ProjectManagerView( mplugin, parent ); } @@ -629,7 +629,7 @@ QString name = QInputDialog::getText(window, i18n("Create File in %1", item->path().pathOrUrl()), i18n("File name:")); if(name.isEmpty()) - return 0; + return nullptr; ProjectFileItem* ret = item->project()->projectFileManager()->addFile( Path(item->path(), name), item->folder() ); if (ret) { diff --git a/plugins/projectmanagerview/projectmodelsaver.cpp b/plugins/projectmanagerview/projectmodelsaver.cpp --- a/plugins/projectmanagerview/projectmodelsaver.cpp +++ b/plugins/projectmanagerview/projectmodelsaver.cpp @@ -31,7 +31,7 @@ { ProjectModelSaver::ProjectModelSaver() -: m_project(0) +: m_project(nullptr) { } diff --git a/plugins/projectmanagerview/projecttreeview.cpp b/plugins/projectmanagerview/projecttreeview.cpp --- a/plugins/projectmanagerview/projecttreeview.cpp +++ b/plugins/projectmanagerview/projecttreeview.cpp @@ -113,7 +113,7 @@ } ProjectTreeView::ProjectTreeView( QWidget *parent ) - : QTreeView( parent ), m_ctxProject( 0 ) + : QTreeView( parent ), m_ctxProject( nullptr ) { header()->hide(); @@ -183,7 +183,7 @@ cancel->setIcon(QIcon::fromTheme(QStringLiteral("process-stop"))); dropMenu.addAction(cancel); - QAction *executedAction = 0; + QAction *executedAction = nullptr; Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); if (modifiers == Qt::ControlModifier) { @@ -242,7 +242,7 @@ cancel->setIcon(QIcon::fromTheme(QStringLiteral("process-stop"))); dropMenu.addAction(cancel); - QAction *executedAction = 0; + QAction *executedAction = nullptr; Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); if (modifiers == Qt::ControlModifier) { @@ -313,7 +313,7 @@ m_ctxProject = itemlist.at(0)->project(); } else { - m_ctxProject = 0; + m_ctxProject = nullptr; } QMenu menu( this ); diff --git a/plugins/quickopen/duchainitemquickopen.cpp b/plugins/quickopen/duchainitemquickopen.cpp --- a/plugins/quickopen/duchainitemquickopen.cpp +++ b/plugins/quickopen/duchainitemquickopen.cpp @@ -193,7 +193,7 @@ Declaration* decl = dynamic_cast(m_item.m_item.data()); if( !decl || !decl->context() ) { - return 0; + return nullptr; } return decl->context()->createNavigationWidget( decl, decl->topContext(), diff --git a/plugins/quickopen/expandingtree/expandingwidgetmodel.cpp b/plugins/quickopen/expandingtree/expandingwidgetmodel.cpp --- a/plugins/quickopen/expandingtree/expandingwidgetmodel.cpp +++ b/plugins/quickopen/expandingtree/expandingwidgetmodel.cpp @@ -340,7 +340,7 @@ edit->resize(200, 50); //Make the widget small so it embeds nicely. m_expandingWidgets[idx] = edit; } else { - m_expandingWidgets[idx] = 0; + m_expandingWidgets[idx] = nullptr; } } @@ -372,7 +372,7 @@ { QModelIndex idx(firstColumn(idx_)); - QWidget* w = 0; + QWidget* w = nullptr; if( m_expandingWidgets.contains(idx) ) w = m_expandingWidgets[idx]; @@ -436,7 +436,7 @@ if( m_expandingWidgets.contains(idx) ) return m_expandingWidgets[idx]; else - return 0; + return nullptr; } void ExpandingWidgetModel::cacheIcons() const { diff --git a/plugins/quickopen/projectfilequickopen.cpp b/plugins/quickopen/projectfilequickopen.cpp --- a/plugins/quickopen/projectfilequickopen.cpp +++ b/plugins/quickopen/projectfilequickopen.cpp @@ -137,7 +137,7 @@ QList contexts = DUChain::self()->chainsForDocument(url); ///Pick a non-proxy context - TopDUContext* chosen = 0; + TopDUContext* chosen = nullptr; foreach( TopDUContext* ctx, contexts ) { if( !(ctx->parsingEnvironmentFile() && ctx->parsingEnvironmentFile()->isProxyContext()) ) { chosen = ctx; @@ -145,7 +145,7 @@ } if( chosen ) { - return chosen->createNavigationWidget(0, 0, + return chosen->createNavigationWidget(nullptr, nullptr, "" + i18nc("%1: project name", "Project %1", project()) + "
"); @@ -159,7 +159,7 @@ return ret; } - return 0; + return nullptr; } QIcon ProjectFileData::icon() const diff --git a/plugins/quickopen/projectitemquickopen.cpp b/plugins/quickopen/projectitemquickopen.cpp --- a/plugins/quickopen/projectitemquickopen.cpp +++ b/plugins/quickopen/projectitemquickopen.cpp @@ -235,7 +235,7 @@ KDevelop::DUChainReadLocker lock( DUChain::lock() ); TopDUContext* ctx = DUChainUtils::standardContextForUrl(filteredItem.m_file.toUrl()); if(ctx) { - QList decls = ctx->findDeclarations(filteredItem.m_id, CursorInRevision::invalid(), AbstractType::Ptr(), 0, DUContext::DirectQualifiedLookup); + QList decls = ctx->findDeclarations(filteredItem.m_id, CursorInRevision::invalid(), AbstractType::Ptr(), nullptr, DUContext::DirectQualifiedLookup); //Filter out forward-declarations or duplicate imported declarations foreach(Declaration* decl, decls) { diff --git a/plugins/quickopen/quickopenmodel.cpp b/plugins/quickopen/quickopenmodel.cpp --- a/plugins/quickopen/quickopenmodel.cpp +++ b/plugins/quickopen/quickopenmodel.cpp @@ -34,7 +34,7 @@ using namespace KDevelop; -QuickOpenModel::QuickOpenModel( QWidget* parent ) : ExpandingWidgetModel( parent ), m_treeView(0), m_expandingWidgetHeightIncrease(0), m_resetBehindRow(0) +QuickOpenModel::QuickOpenModel( QWidget* parent ) : ExpandingWidgetModel( parent ), m_treeView(nullptr), m_expandingWidgetHeightIncrease(0), m_resetBehindRow(0) { m_resetTimer = new QTimer(this); m_resetTimer->setSingleShot(true); diff --git a/plugins/quickopen/quickopenplugin.cpp b/plugins/quickopen/quickopenplugin.cpp --- a/plugins/quickopen/quickopenplugin.cpp +++ b/plugins/quickopen/quickopenplugin.cpp @@ -167,7 +167,7 @@ KTextEditor::View* view = ICore::self()->documentController()->activeTextDocumentView(); if(!view) - return 0; + return nullptr; KDevelop::DUChainReadLocker lock( DUChain::lock() ); @@ -178,13 +178,13 @@ Declaration* cursorContextDeclaration() { KTextEditor::View* view = ICore::self()->documentController()->activeTextDocumentView(); if(!view) - return 0; + return nullptr; KDevelop::DUChainReadLocker lock( DUChain::lock() ); TopDUContext* ctx = DUChainUtils::standardContextForUrl(view->document()->url()); if(!ctx) - return 0; + return nullptr; KTextEditor::Cursor cursor(view->cursorPosition()); @@ -193,7 +193,7 @@ while(subCtx && !subCtx->owner()) subCtx = subCtx->parentContext(); - Declaration* definition = 0; + Declaration* definition = nullptr; if(!subCtx || !subCtx->owner()) definition = DUChainUtils::declarationInLine(cursor, ctx); @@ -201,7 +201,7 @@ definition = subCtx->owner(); if(!definition) - return 0; + return nullptr; return definition; } @@ -250,10 +250,10 @@ } } - return 0; + return nullptr; } -static QuickOpenPlugin* staticQuickOpenPlugin = 0; +static QuickOpenPlugin* staticQuickOpenPlugin = nullptr; QuickOpenPlugin* QuickOpenPlugin::self() { @@ -345,7 +345,7 @@ { staticQuickOpenPlugin = this; KDEV_USE_EXTENSION_INTERFACE( KDevelop::IQuickOpen ) - m_model = new QuickOpenModel( 0 ); + m_model = new QuickOpenModel( nullptr ); KConfigGroup quickopengrp = KSharedConfig::openConfig()->group("QuickOpen"); lastUsedScopes = quickopengrp.readEntry("SelectedScopes", QStringList() << i18n("Project") << i18n("Includes") << i18n("Includers") << i18n("Currently Open") ); @@ -595,7 +595,7 @@ { KTextEditor::View* view = ICore::self()->documentController()->activeTextDocumentView(); if( !view ) - return 0; + return nullptr; QUrl url = ICore::self()->documentController()->activeDocument()->url(); @@ -606,7 +606,7 @@ return w; } - return 0; + return nullptr; } QPair QuickOpenPlugin::specialObjectJumpPosition() const @@ -679,7 +679,7 @@ { if(m_currentWidgetHandler) delete m_currentWidgetHandler; - m_currentWidgetHandler = 0; + m_currentWidgetHandler = nullptr; return true; } @@ -719,9 +719,9 @@ if (!cursor.isValid()) return; - Declaration *nearestDeclBefore = 0; + Declaration *nearestDeclBefore = nullptr; int distanceBefore = INT_MIN; - Declaration *nearestDeclAfter = 0; + Declaration *nearestDeclAfter = nullptr; int distanceAfter = INT_MAX; for (int i = 0; i < items.count(); ++i) { @@ -756,7 +756,7 @@ struct CreateOutlineDialog { - CreateOutlineDialog() : dialog(0), cursorDecl(0), model(0) { + CreateOutlineDialog() : dialog(nullptr), cursorDecl(nullptr), model(nullptr) { } void start() { @@ -778,7 +778,7 @@ return; } - model = new QuickOpenModel(0); + model = new QuickOpenModel(nullptr); OutlineFilter filter(items); @@ -823,7 +823,7 @@ class OutlineQuickopenWidgetCreator : public QuickOpenWidgetCreator { public: - OutlineQuickopenWidgetCreator(QStringList /*scopes*/, QStringList /*items*/) : m_creator(0) { + OutlineQuickopenWidgetCreator(QStringList /*scopes*/, QStringList /*items*/) : m_creator(nullptr) { } ~OutlineQuickopenWidgetCreator() override { @@ -836,7 +836,7 @@ m_creator->start(); if(!m_creator->dialog) - return 0; + return nullptr; m_creator->dialog->deleteLater(); return m_creator->dialog->widget(); @@ -846,7 +846,7 @@ if(m_creator) { m_creator->finish(); delete m_creator; - m_creator = 0; + m_creator = nullptr; } } @@ -880,7 +880,7 @@ create.finish(); } -QuickOpenLineEdit::QuickOpenLineEdit(QuickOpenWidgetCreator* creator) : m_widget(0), m_forceUpdate(false), m_widgetCreator(creator) { +QuickOpenLineEdit::QuickOpenLineEdit(QuickOpenWidgetCreator* creator) : m_widget(nullptr), m_forceUpdate(false), m_widgetCreator(creator) { setMinimumWidth(200); setMaximumWidth(400); @@ -963,7 +963,7 @@ m_widget->showStandardButtons(false); m_widget->showSearchField(false); - m_widget->setParent(0, Qt::ToolTip); + m_widget->setParent(nullptr, Qt::ToolTip); m_widget->setFocusPolicy(Qt::NoFocus); m_widget->setAlternativeSearchField(this); @@ -1069,7 +1069,7 @@ if (m_widget) m_widget->deleteLater(); - m_widget = 0; + m_widget = nullptr; qApp->removeEventFilter(this); } diff --git a/plugins/quickopen/quickopenwidget.cpp b/plugins/quickopen/quickopenwidget.cpp --- a/plugins/quickopen/quickopenwidget.cpp +++ b/plugins/quickopen/quickopenwidget.cpp @@ -42,7 +42,7 @@ class QuickOpenDelegate : public ExpandingDelegate { Q_OBJECT public: - QuickOpenDelegate(ExpandingWidgetModel* model, QObject* parent = 0L) : ExpandingDelegate(model, parent) { + QuickOpenDelegate(ExpandingWidgetModel* model, QObject* parent = nullptr) : ExpandingDelegate(model, parent) { } QList createHighlighting(const QModelIndex& index, QStyleOptionViewItem& option) const override { QList highlighting = index.data(KTextEditor::CodeCompletionModel::CustomHighlight).toList(); @@ -195,7 +195,7 @@ void QuickOpenWidget::prepareShow() { - ui.list->setModel( 0 ); + ui.list->setModel( nullptr ); ui.list->setVerticalScrollMode(QAbstractItemView::ScrollPerItem); m_model->setTreeView( ui.list ); ui.list->setModel( m_model ); @@ -223,7 +223,7 @@ } QuickOpenWidget::~QuickOpenWidget() { - m_model->setTreeView( 0 ); + m_model->setTreeView( nullptr ); } diff --git a/plugins/quickopen/tests/quickopentestbase.cpp b/plugins/quickopen/tests/quickopentestbase.cpp --- a/plugins/quickopen/tests/quickopentestbase.cpp +++ b/plugins/quickopen/tests/quickopentestbase.cpp @@ -31,9 +31,9 @@ QuickOpenTestBase::QuickOpenTestBase(Core::Setup setup_, QObject* parent) : QObject(parent) -, core(0) +, core(nullptr) , setup(setup_) -, projectController(0) +, projectController(nullptr) { qRegisterMetaType("QModelIndex"); } diff --git a/plugins/standardoutputview/outputwidget.cpp b/plugins/standardoutputview/outputwidget.cpp --- a/plugins/standardoutputview/outputwidget.cpp +++ b/plugins/standardoutputview/outputwidget.cpp @@ -53,17 +53,17 @@ OutputWidget::OutputWidget(QWidget* parent, const ToolViewData* tvdata) : QWidget( parent ) - , tabwidget(0) - , stackwidget(0) + , tabwidget(nullptr) + , stackwidget(nullptr) , data(tvdata) - , m_closeButton(0) - , m_closeOthersAction(0) - , nextAction(0) - , previousAction(0) - , activateOnSelect(0) - , focusOnSelect(0) - , filterInput(0) - , filterAction(0) + , m_closeButton(nullptr) + , m_closeOthersAction(nullptr) + , nextAction(nullptr) + , previousAction(nullptr) + , activateOnSelect(nullptr) + , focusOnSelect(nullptr) + , filterInput(nullptr) + , filterAction(nullptr) { setWindowTitle(i18n("Output View")); setWindowIcon(tvdata->icon); @@ -264,8 +264,8 @@ delete view; } else { - views.value( id )->setModel( 0 ); - views.value( id )->setItemDelegate( 0 ); + views.value( id )->setModel( nullptr ); + views.value( id )->setItemDelegate( nullptr ); if( proxyModels.contains( 0 ) ) { delete proxyModels.take( 0 ); filters.remove( 0 ); @@ -481,7 +481,7 @@ return listview; }; - QTreeView* listview = 0; + QTreeView* listview = nullptr; if( !views.contains(id) ) { bool newView = true; diff --git a/plugins/standardoutputview/standardoutputview.cpp b/plugins/standardoutputview/standardoutputview.cpp --- a/plugins/standardoutputview/standardoutputview.cpp +++ b/plugins/standardoutputview/standardoutputview.cpp @@ -42,7 +42,7 @@ class OutputViewFactory : public KDevelop::IToolViewFactory{ public: OutputViewFactory(const ToolViewData* data): m_data(data) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { return new OutputWidget( parent, m_data ); } @@ -283,7 +283,7 @@ } } } - return 0; + return nullptr; } void StandardOutputView::scrollOutputTo( int outputId, const QModelIndex& idx ) diff --git a/plugins/standardoutputview/tests/test_standardoutputview.cpp b/plugins/standardoutputview/tests/test_standardoutputview.cpp --- a/plugins/standardoutputview/tests/test_standardoutputview.cpp +++ b/plugins/standardoutputview/tests/test_standardoutputview.cpp @@ -61,7 +61,7 @@ QTest::qWait(500); // makes sure that everything is loaded (don't know if it's required) - m_stdOutputView = 0; + m_stdOutputView = nullptr; KDevelop::IPluginController* plugin_controller = m_testCore->pluginController(); @@ -90,7 +90,7 @@ } } } - return 0; + return nullptr; } void StandardOutputViewTest::testRegisterAndRemoveToolView() @@ -118,8 +118,8 @@ QVERIFY(!toolviewPointer(toolviewTitle)); QList addedActions; - addedActions.append(new QAction(QStringLiteral("Action1"), 0)); - addedActions.append(new QAction(QStringLiteral("Action2"), 0)); + addedActions.append(new QAction(QStringLiteral("Action1"), nullptr)); + addedActions.append(new QAction(QStringLiteral("Action2"), nullptr)); toolviewId = m_stdOutputView->registerToolView(toolviewTitle, KDevelop::IOutputView::HistoryView, QIcon(), KDevelop::IOutputView::ShowItemsButton | KDevelop::IOutputView::AddFilterAction, diff --git a/plugins/standardoutputview/toolviewdata.cpp b/plugins/standardoutputview/toolviewdata.cpp --- a/plugins/standardoutputview/toolviewdata.cpp +++ b/plugins/standardoutputview/toolviewdata.cpp @@ -26,8 +26,8 @@ OutputData::OutputData( ToolViewData* tv ) : QObject( tv ) -, delegate(0) -, model(0) +, delegate(nullptr) +, model(nullptr) , toolView(tv) , id(-1) { @@ -56,7 +56,7 @@ } ToolViewData::ToolViewData( QObject* parent ) - : QObject( parent ), plugin(0), toolViewId(-1) + : QObject( parent ), plugin(nullptr), toolViewId(-1) { } diff --git a/plugins/subversion/kdevsvncpp/client_annotate.cpp b/plugins/subversion/kdevsvncpp/client_annotate.cpp --- a/plugins/subversion/kdevsvncpp/client_annotate.cpp +++ b/plugins/subversion/kdevsvncpp/client_annotate.cpp @@ -50,7 +50,7 @@ date?date:"unknown date", line?line:"???")); - return NULL; + return nullptr; } AnnotatedFile * @@ -70,7 +70,7 @@ *m_context, // client ctx pool); - if (error != NULL) + if (error != nullptr) { delete entries; throw ClientException(error); diff --git a/plugins/subversion/kdevsvncpp/client_cat.cpp b/plugins/subversion/kdevsvncpp/client_cat.cpp --- a/plugins/subversion/kdevsvncpp/client_cat.cpp +++ b/plugins/subversion/kdevsvncpp/client_cat.cpp @@ -58,7 +58,7 @@ *m_context, pool); - if (error != 0) + if (error != nullptr) throw ClientException(error); return std::string(stringbuf->data, stringbuf->len); @@ -84,7 +84,7 @@ const Revision & revision, Pool & pool) throw(ClientException) { - apr_file_t * file = 0; + apr_file_t * file = nullptr; if (dstPath.length() > 0) { @@ -125,7 +125,7 @@ 0, // dont delete on close pool); - if (error != 0) + if (error != nullptr) throw ClientException(error); dstPath = unique_name; @@ -150,7 +150,7 @@ // now create a stream and let svn_client_cat write to the // stream svn_stream_t * stream = svn_stream_from_aprfile(file, pool); - if (stream != 0) + if (stream != nullptr) { svn_error_t * error = svn_client_cat2( stream, @@ -160,7 +160,7 @@ *m_context, pool); - if (error != 0) + if (error != nullptr) throw ClientException(error); svn_stream_close(stream); diff --git a/plugins/subversion/kdevsvncpp/client_diff.cpp b/plugins/subversion/kdevsvncpp/client_diff.cpp --- a/plugins/subversion/kdevsvncpp/client_diff.cpp +++ b/plugins/subversion/kdevsvncpp/client_diff.cpp @@ -51,7 +51,7 @@ msg = apr_pvsprintf(pool, fmt, ap); va_end(ap); - error = svn_error_create(status, NULL, msg); + error = svn_error_create(status, nullptr, msg); throw ClientException(error); } @@ -63,16 +63,16 @@ apr_file_t * errfile, const char * errfileName, apr_pool_t *pool) { - if (outfile != NULL) + if (outfile != nullptr) apr_file_close(outfile); - if (errfile != NULL) + if (errfile != nullptr) apr_file_close(errfile); - if (outfileName != NULL) + if (outfileName != nullptr) svn_error_clear(svn_io_remove_file(outfileName, pool)); - if (errfileName != NULL) + if (errfileName != nullptr) svn_error_clear(svn_io_remove_file(errfileName, pool)); } @@ -85,10 +85,10 @@ Pool pool; svn_error_t * error; apr_status_t status; - apr_file_t * outfile = NULL; - const char * outfileName = NULL; - apr_file_t * errfile = NULL; - const char * errfileName = NULL; + apr_file_t * outfile = nullptr; + const char * outfileName = nullptr; + apr_file_t * errfile = nullptr; + const char * errfileName = nullptr; apr_array_header_t * options; svn_stringbuf_t * stringbuf; @@ -100,7 +100,7 @@ tmpPath.c_str(), ".tmp", false, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -111,7 +111,7 @@ tmpPath.c_str(), ".tmp", false, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -126,7 +126,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -150,7 +150,7 @@ // now we can read the diff output from outfile and return that error = svn_stringbuf_from_aprfile(&stringbuf, outfile, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -170,10 +170,10 @@ Pool pool; svn_error_t * error; apr_status_t status; - apr_file_t * outfile = NULL; - const char * outfileName = NULL; - apr_file_t * errfile = NULL; - const char * errfileName = NULL; + apr_file_t * outfile = nullptr; + const char * outfileName = nullptr; + apr_file_t * errfile = nullptr; + const char * errfileName = nullptr; apr_array_header_t * options; svn_stringbuf_t * stringbuf; @@ -185,7 +185,7 @@ tmpPath.c_str(), ".tmp", false, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -196,7 +196,7 @@ tmpPath.c_str(), ".tmp", false, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -211,7 +211,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -235,7 +235,7 @@ // now we can read the diff output from outfile and return that error = svn_stringbuf_from_aprfile(&stringbuf, outfile, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -255,10 +255,10 @@ Pool pool; svn_error_t * error; apr_status_t status; - apr_file_t * outfile = NULL; - const char * outfileName = NULL; - apr_file_t * errfile = NULL; - const char * errfileName = NULL; + apr_file_t * outfile = nullptr; + const char * outfileName = nullptr; + apr_file_t * errfile = nullptr; + const char * errfileName = nullptr; apr_array_header_t * options; svn_stringbuf_t * stringbuf; @@ -270,7 +270,7 @@ tmpPath.c_str(), ".tmp", false, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -281,7 +281,7 @@ tmpPath.c_str(), ".tmp", false, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -296,7 +296,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); @@ -320,7 +320,7 @@ // now we can read the diff output from outfile and return that error = svn_stringbuf_from_aprfile(&stringbuf, outfile, pool); - if (error != NULL) + if (error != nullptr) { diffCleanup(outfile, outfileName, errfile, errfileName, pool); throw ClientException(error); diff --git a/plugins/subversion/kdevsvncpp/client_modify.cpp b/plugins/subversion/kdevsvncpp/client_modify.cpp --- a/plugins/subversion/kdevsvncpp/client_modify.cpp +++ b/plugins/subversion/kdevsvncpp/client_modify.cpp @@ -60,7 +60,7 @@ *m_context, apr_pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); return revnum; @@ -72,7 +72,7 @@ { Pool pool; Targets targets(path.c_str()); - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_delete(&commit_info, @@ -80,7 +80,7 @@ force, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -89,7 +89,7 @@ bool force) throw(ClientException) { Pool pool; - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_delete(&commit_info, @@ -97,7 +97,7 @@ force, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -113,7 +113,7 @@ force, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -127,7 +127,7 @@ force, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -143,7 +143,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -163,7 +163,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -184,7 +184,7 @@ ignore_externals, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); std::vector revnums; @@ -220,7 +220,7 @@ m_context->setLogMessage(message); - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_commit2(&commit_info, @@ -229,7 +229,7 @@ keep_locks, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); if (commit_info && SVN_IS_VALID_REVNUM(commit_info->revision)) @@ -245,7 +245,7 @@ const Path & destPath) throw(ClientException) { Pool pool; - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_copy(&commit_info, srcPath.c_str(), @@ -254,7 +254,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -265,7 +265,7 @@ bool force) throw(ClientException) { Pool pool; - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_move2(&commit_info, @@ -275,7 +275,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -285,14 +285,14 @@ Pool pool; Targets targets(path.c_str()); - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_mkdir(&commit_info, const_cast (targets.array(pool)), *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -301,14 +301,14 @@ { Pool pool; - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; svn_error_t * error = svn_client_mkdir(&commit_info, const_cast (targets.array(pool)), *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -321,7 +321,7 @@ svn_error_t * error = svn_client_cleanup(path.c_str(), *m_context, apr_pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -336,7 +336,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -366,7 +366,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -387,7 +387,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); return revnum; } @@ -399,7 +399,7 @@ bool recurse) throw(ClientException) { Pool pool; - svn_client_commit_info_t *commit_info = NULL; + svn_client_commit_info_t *commit_info = nullptr; m_context->setLogMessage(message); @@ -411,7 +411,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -446,7 +446,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -465,7 +465,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -488,7 +488,7 @@ false, // recursive *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); PathPropertiesMapList path_prop_map_list; @@ -502,7 +502,7 @@ const void *key; void *val; - apr_hash_this(hi, &key, NULL, &val); + apr_hash_this(hi, &key, nullptr, &val); prop_map [std::string(s_svnIgnore)] = std::string(((const svn_string_t *)val)->data); @@ -531,7 +531,7 @@ false, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } diff --git a/plugins/subversion/kdevsvncpp/client_property.cpp b/plugins/subversion/kdevsvncpp/client_property.cpp --- a/plugins/subversion/kdevsvncpp/client_property.cpp +++ b/plugins/subversion/kdevsvncpp/client_property.cpp @@ -62,7 +62,7 @@ recurse, *m_context, pool); - if (error != NULL) + if (error != nullptr) { throw ClientException(error); } @@ -82,7 +82,7 @@ const void *key; void *val; - apr_hash_this(hi, &key, NULL, &val); + apr_hash_this(hi, &key, nullptr, &val); prop_map [std::string((const char *)key)] = std::string(((const svn_string_t *)val)->data); @@ -121,7 +121,7 @@ recurse, *m_context, pool); - if (error != NULL) + if (error != nullptr) { throw ClientException(error); } @@ -138,7 +138,7 @@ const void *key; void *val; - apr_hash_this(hi, &key, NULL, &val); + apr_hash_this(hi, &key, nullptr, &val); prop_map [std::string(propName)] = std::string(((const svn_string_t *)val)->data); @@ -180,7 +180,7 @@ skip_checks, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -205,11 +205,11 @@ svn_error_t * error = svn_client_propset(propName, - NULL, // value = NULL + nullptr, // value = NULL path.c_str(), recurse, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -242,7 +242,7 @@ &revnum, *m_context, pool); - if (error != NULL) + if (error != nullptr) { throw ClientException(error); } @@ -256,7 +256,7 @@ const void *key; void *val; - apr_hash_this(hi, &key, NULL, &val); + apr_hash_this(hi, &key, nullptr, &val); prop_map [std::string((const char *)key)] = std::string(((const svn_string_t *)val)->data); @@ -292,13 +292,13 @@ &revnum, *m_context, pool); - if (error != NULL) + if (error != nullptr) { throw ClientException(error); } // if the property does not exist NULL is returned - if (propval == NULL) + if (propval == nullptr) return std::pair (0, std::string()); return std::pair (revnum, std::string(propval->data)); @@ -338,7 +338,7 @@ force, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); return revnum; @@ -367,14 +367,14 @@ svn_revnum_t revnum; svn_error_t * error = svn_client_revprop_set(propName, - NULL, // value = NULL + nullptr, // value = NULL path.c_str(), revision.revision(), &revnum, force, *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); return revnum; diff --git a/plugins/subversion/kdevsvncpp/client_status.cpp b/plugins/subversion/kdevsvncpp/client_status.cpp --- a/plugins/subversion/kdevsvncpp/client_status.cpp +++ b/plugins/subversion/kdevsvncpp/client_status.cpp @@ -57,17 +57,17 @@ LogEntries * entries = (LogEntries *) baton; entries->insert(entries->begin(), LogEntry(rev, author, date, msg)); - if (changedPaths != NULL) + if (changedPaths != nullptr) { LogEntry &entry = entries->front(); for (apr_hash_index_t *hi = apr_hash_first(pool, changedPaths); - hi != NULL; + hi != nullptr; hi = apr_hash_next(hi)) { char *path; void *val; - apr_hash_this(hi, (const void **)&path, NULL, &val); + apr_hash_this(hi, (const void **)&path, nullptr, &val); svn_log_changed_path_t *log_item = reinterpret_cast(val); @@ -79,7 +79,7 @@ } } - return NULL; + return nullptr; } static void @@ -121,7 +121,7 @@ *context, // client ctx pool); - if (error!=NULL) + if (error!=nullptr) throw ClientException(error); return entries; @@ -234,12 +234,12 @@ StatusBaton * baton = static_cast(baton_); // now we have to decide whether to return the entry or not - if (0 == status) + if (nullptr == status) return; bool useStatus = false; - bool isUnversioned = 0 == status->entry; + bool isUnversioned = nullptr == status->entry; if (isUnversioned) { // unversioned if (baton->filter.showUnversioned) @@ -302,7 +302,7 @@ *context, // client ctx pool); - if (error!=NULL) + if (error!=nullptr) throw ClientException(error); return revnum; @@ -356,7 +356,7 @@ *m_context, // client ctx pool); - if (error != NULL) + if (error != nullptr) { delete entries; throw ClientException(error); @@ -380,7 +380,7 @@ infoVector->push_back(Info(path, info)); - return 0; + return nullptr; } @@ -403,7 +403,7 @@ *m_context, pool); - if (error != 0) + if (error != nullptr) throw ClientException(error); return infoVector; diff --git a/plugins/subversion/kdevsvncpp/context.cpp b/plugins/subversion/kdevsvncpp/context.cpp --- a/plugins/subversion/kdevsvncpp/context.cpp +++ b/plugins/subversion/kdevsvncpp/context.cpp @@ -111,14 +111,14 @@ static svn_error_t * getData(void * baton, Data ** data) { - if (baton == NULL) - return svn_error_create(SVN_ERR_CANCELLED, NULL, + if (baton == nullptr) + return svn_error_create(SVN_ERR_CANCELLED, nullptr, "invalid baton"); Data * data_ = static_cast (baton); - if (data_->listener == 0) - return svn_error_create(SVN_ERR_CANCELLED, NULL, + if (data_->listener == nullptr) + return svn_error_create(SVN_ERR_CANCELLED, nullptr, "invalid listener"); *data = data_; @@ -126,10 +126,10 @@ } Data(const std::string & configDir_) - : listener(0), logIsSet(false), + : listener(nullptr), logIsSet(false), promptCounter(0), configDir(configDir_) { - const char * c_configDir = 0; + const char * c_configDir = nullptr; if (configDir.length() > 0) c_configDir = configDir.c_str(); @@ -214,9 +214,9 @@ svn_config_t *config = (svn_config_t *)apr_hash_get( ctx->config, SVN_CONFIG_CATEGORY_CONFIG, APR_HASH_KEY_STRING); svn_config_set(config, SVN_CONFIG_SECTION_HELPERS, - SVN_CONFIG_OPTION_DIFF_CMD, NULL); + SVN_CONFIG_OPTION_DIFF_CMD, nullptr); svn_config_set(config, SVN_CONFIG_SECTION_HELPERS, - SVN_CONFIG_OPTION_DIFF3_CMD, NULL); + SVN_CONFIG_OPTION_DIFF3_CMD, nullptr); // tell the auth functions where the config is svn_auth_set_parameter(ab, SVN_AUTH_PARAM_CONFIG_DIR, @@ -236,7 +236,7 @@ void setAuthCache(bool value) { - void *param = 0; + void *param = nullptr; if (!value) param = (void *)"1"; @@ -278,7 +278,7 @@ void *baton, apr_pool_t * pool) { - Data * data = NULL; + Data * data = nullptr; SVN_ERR(getData(baton, &data)); std::string msg; @@ -287,12 +287,12 @@ else { if (!data->retrieveLogMessage(msg)) - return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); + return svn_error_create(SVN_ERR_CANCELLED, nullptr, ""); } *log_msg = apr_pstrdup(pool, msg.c_str()); - *tmp_file = NULL; + *tmp_file = nullptr; return SVN_NO_ERROR; } @@ -311,7 +311,7 @@ svn_wc_notify_state_t prop_state, svn_revnum_t revision) { - if (baton == 0) + if (baton == nullptr) return; Data * data = static_cast (baton); @@ -349,13 +349,13 @@ static svn_error_t * onCancel(void * baton) { - if (baton == 0) + if (baton == nullptr) return SVN_NO_ERROR; Data * data = static_cast (baton); if (data->cancel()) - return svn_error_create(SVN_ERR_CANCELLED, NULL, "cancelled by user"); + return svn_error_create(SVN_ERR_CANCELLED, nullptr, "cancelled by user"); else return SVN_NO_ERROR; } @@ -371,12 +371,12 @@ svn_boolean_t _may_save, apr_pool_t *pool) { - Data * data = NULL; + Data * data = nullptr; SVN_ERR(getData(baton, &data)); bool may_save = _may_save != 0; if (!data->retrieveLogin(username, realm, may_save)) - return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); + return svn_error_create(SVN_ERR_CANCELLED, nullptr, ""); svn_auth_cred_simple_t* lcred = (svn_auth_cred_simple_t*) apr_palloc(pool, sizeof(svn_auth_cred_simple_t)); @@ -408,11 +408,11 @@ svn_boolean_t may_save, apr_pool_t *pool) { - Data * data = NULL; + Data * data = nullptr; SVN_ERR(getData(baton, &data)); ContextListener::SslServerTrustData trustData(failures); - if (realm != NULL) + if (realm != nullptr) trustData.realm = realm; trustData.hostname = info->hostname; trustData.fingerprint = info->fingerprint; @@ -427,7 +427,7 @@ trustData, acceptedFailures); if (answer == ContextListener::DONT_ACCEPT) - *cred = NULL; + *cred = nullptr; else { svn_auth_cred_ssl_server_trust_t *cred_ = @@ -453,12 +453,12 @@ void *baton, apr_pool_t *pool) { - Data * data = NULL; + Data * data = nullptr; SVN_ERR(getData(baton, &data)); std::string certFile; if (!data->listener->contextSslClientCertPrompt(certFile)) - return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); + return svn_error_create(SVN_ERR_CANCELLED, nullptr, ""); svn_auth_cred_ssl_client_cert_t *cred_ = (svn_auth_cred_ssl_client_cert_t*) @@ -486,13 +486,13 @@ svn_boolean_t maySave, apr_pool_t *pool) { - Data * data = NULL; + Data * data = nullptr; SVN_ERR(getData(baton, &data)); std::string password; bool may_save = maySave != 0; if (!data->listener->contextSslClientCertPwPrompt(password, realm, may_save)) - return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); + return svn_error_create(SVN_ERR_CANCELLED, nullptr, ""); svn_auth_cred_ssl_client_cert_pw_t *cred_ = (svn_auth_cred_ssl_client_cert_pw_t *) @@ -545,7 +545,7 @@ { bool ok; - if (listener == 0) + if (listener == nullptr) return false; ok = listener->contextGetLogMessage(logMessage); @@ -575,10 +575,10 @@ { bool ok; - if (listener == 0) + if (listener == nullptr) return false; - if (username_ == NULL) + if (username_ == nullptr) username = ""; else username = username_; @@ -601,7 +601,7 @@ svn_wc_notify_state_t prop_state, svn_revnum_t revision) { - if (listener != 0) + if (listener != nullptr) { listener->contextNotify(path, action, kind, mime_type, content_state, prop_state, revision); @@ -615,7 +615,7 @@ bool cancel() { - if (listener != 0) + if (listener != nullptr) { return listener->contextCancel(); } diff --git a/plugins/subversion/kdevsvncpp/dirent.cpp b/plugins/subversion/kdevsvncpp/dirent.cpp --- a/plugins/subversion/kdevsvncpp/dirent.cpp +++ b/plugins/subversion/kdevsvncpp/dirent.cpp @@ -52,7 +52,7 @@ hasProps(dirEntry->has_props != 0), createdRev(dirEntry->created_rev), time(dirEntry->time) { - lastAuthor = dirEntry->last_author == 0 ? "" : dirEntry->last_author; + lastAuthor = dirEntry->last_author == nullptr ? "" : dirEntry->last_author; } Data(const DirEntry & src) diff --git a/plugins/subversion/kdevsvncpp/entry.cpp b/plugins/subversion/kdevsvncpp/entry.cpp --- a/plugins/subversion/kdevsvncpp/entry.cpp +++ b/plugins/subversion/kdevsvncpp/entry.cpp @@ -29,13 +29,13 @@ namespace svn { Entry::Entry(const svn_wc_entry_t * src) - : m_entry(0), m_pool(0), m_valid(false) + : m_entry(nullptr), m_pool(nullptr), m_valid(false) { init(src); } Entry::Entry(const Entry & src) - : m_entry(0), m_pool(0), m_valid(false) + : m_entry(nullptr), m_pool(nullptr), m_valid(false) { init(src); } diff --git a/plugins/subversion/kdevsvncpp/exception.cpp b/plugins/subversion/kdevsvncpp/exception.cpp --- a/plugins/subversion/kdevsvncpp/exception.cpp +++ b/plugins/subversion/kdevsvncpp/exception.cpp @@ -82,7 +82,7 @@ ClientException::ClientException(svn_error_t * error) throw() : Exception("") { - if (error == 0) + if (error == nullptr) return; m->apr_err = error->apr_err; @@ -103,7 +103,7 @@ message += num.str(); } } - while (next != NULL && next->message != NULL) + while (next != nullptr && next->message != nullptr) { message = message + '\n' + next->message; diff --git a/plugins/subversion/kdevsvncpp/info.cpp b/plugins/subversion/kdevsvncpp/info.cpp --- a/plugins/subversion/kdevsvncpp/info.cpp +++ b/plugins/subversion/kdevsvncpp/info.cpp @@ -39,18 +39,18 @@ Pool pool; /** constructor (because of optional param */ - Data(const Path & path_, const svn_info_t * info_ = 0) - : info(0), path(path_) + Data(const Path & path_, const svn_info_t * info_ = nullptr) + : info(nullptr), path(path_) { - if (info_ != 0) + if (info_ != nullptr) info = svn_info_dup(info_, pool); } /** copy constructor */ Data(const Data * src) - : info(0), path(src->path) + : info(nullptr), path(src->path) { - if (src->info != 0) + if (src->info != nullptr) info = svn_info_dup(src->info, pool); } }; @@ -95,7 +95,7 @@ bool Info::isValid() const { - return m->info != 0; + return m->info != nullptr; } @@ -103,7 +103,7 @@ Info::url() const { if (isValid()) - return 0; + return nullptr; else return m->info->URL; } @@ -127,7 +127,7 @@ Info::repos () const { if (isValid()) - return 0; + return nullptr; else return m->info->repos_root_URL; } @@ -135,7 +135,7 @@ const char * Info::uuid () const { if (isValid()) - return 0; + return nullptr; else return m->info->repos_UUID; } @@ -162,7 +162,7 @@ Info::lastChangedAuthor () const { if (isValid()) - return 0; + return nullptr; else return m->info->last_changed_author; } @@ -185,7 +185,7 @@ const char* Info::copyFromUrl () const { if (isValid()) - return 0; + return nullptr; else return m->info->copyfrom_url; } @@ -217,7 +217,7 @@ const char* Info::oldConflictFile () const { if (isValid()) - return 0; + return nullptr; else return m->info->conflict_old; } @@ -225,7 +225,7 @@ const char* Info::newConflictFile () const { if (isValid()) - return 0; + return nullptr; else return m->info->conflict_new; } @@ -233,7 +233,7 @@ const char* Info::workingConflictFile () const { if (isValid()) - return 0; + return nullptr; else return m->info->conflict_wrk; } @@ -241,7 +241,7 @@ const char* Info::propertyRejectFile () const { if (isValid()) - return 0; + return nullptr; else return m->info->prejfile; } diff --git a/plugins/subversion/kdevsvncpp/log_entry.cpp b/plugins/subversion/kdevsvncpp/log_entry.cpp --- a/plugins/subversion/kdevsvncpp/log_entry.cpp +++ b/plugins/subversion/kdevsvncpp/log_entry.cpp @@ -41,7 +41,7 @@ const char *copyFromPath_, const svn_revnum_t copyFromRevision_) : path(path_), action(action_), - copyFromPath(copyFromPath_ != NULL ? copyFromPath_ : ""), + copyFromPath(copyFromPath_ != nullptr ? copyFromPath_ : ""), copyFromRevision(copyFromRevision_) { } @@ -60,17 +60,17 @@ { date = 0; - if (date_ != 0) + if (date_ != nullptr) { Pool pool; - if (svn_time_from_cstring(&date, date_, pool) != 0) + if (svn_time_from_cstring(&date, date_, pool) != nullptr) date = 0; } revision = revision_; - author = author_ == 0 ? "" : author_; - message = message_ == 0 ? "" : message_; + author = author_ == nullptr ? "" : author_; + message = message_ == nullptr ? "" : message_; } } diff --git a/plugins/subversion/kdevsvncpp/path.cpp b/plugins/subversion/kdevsvncpp/path.cpp --- a/plugins/subversion/kdevsvncpp/path.cpp +++ b/plugins/subversion/kdevsvncpp/path.cpp @@ -60,7 +60,7 @@ m_pathIsUrl = false; - if (path == 0) + if (path == nullptr) m_path = ""; else { @@ -120,7 +120,7 @@ static bool isAbsolute(const char * path) { - if (0 == path) + if (nullptr == path) return false; std::string p(path); @@ -146,7 +146,7 @@ { Pool pool; - if (0 == component) + if (nullptr == component) return; // in case of an empty string, return @@ -362,12 +362,12 @@ Path Path::getTempDir() { - const char * tempdir = NULL; + const char * tempdir = nullptr; Pool pool; if (apr_temp_dir_get(&tempdir, pool) != APR_SUCCESS) { - tempdir = NULL; + tempdir = nullptr; } return tempdir; diff --git a/plugins/subversion/kdevsvncpp/property.cpp b/plugins/subversion/kdevsvncpp/property.cpp --- a/plugins/subversion/kdevsvncpp/property.cpp +++ b/plugins/subversion/kdevsvncpp/property.cpp @@ -67,7 +67,7 @@ false, /* recurse */ *m_context, pool); - if (error != NULL) + if (error != nullptr) { throw ClientException(error); } @@ -85,7 +85,7 @@ const void *key; void *val; - apr_hash_this(hi, &key, NULL, &val); + apr_hash_this(hi, &key, nullptr, &val); m_entries.push_back(PropertyEntry( (const char *)key, getValue((const char *)key).c_str())); @@ -118,7 +118,7 @@ const void *key; void *val; const svn_string_t *propval; - apr_hash_this(hi, &key, NULL, &val); + apr_hash_this(hi, &key, nullptr, &val); propval = (const svn_string_t *)val; return propval->data; @@ -144,7 +144,7 @@ *m_context, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -155,11 +155,11 @@ svn_error_t * error = svn_client_propset(name, - NULL, // value = NULL + nullptr, // value = NULL m_path.c_str(), false, //dont recurse pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } diff --git a/plugins/subversion/kdevsvncpp/status.cpp b/plugins/subversion/kdevsvncpp/status.cpp --- a/plugins/subversion/kdevsvncpp/status.cpp +++ b/plugins/subversion/kdevsvncpp/status.cpp @@ -38,12 +38,12 @@ bool isVersioned; Data(const char * path_, const svn_wc_status2_t * status_) - : status(0), path("") + : status(nullptr), path("") { - if (path_ != 0) + if (path_ != nullptr) path = path_; - if (status_ != 0) + if (status_ != nullptr) { status = svn_wc_dup_status2( const_cast(status_), pool); @@ -52,9 +52,9 @@ } Data(const Data * src) - : status(0), path(src->path) + : status(nullptr), path(src->path) { - if (src->status != 0) + if (src->status != nullptr) { status = svn_wc_dup_status2(src->status, pool); @@ -99,7 +99,7 @@ const Entry Status::entry() const { - if (0 == m->status) + if (nullptr == m->status) return Entry(); return Entry(m->status->entry); @@ -150,10 +150,10 @@ bool Status::isLocked() const { - if (m->status->repos_lock && (m->status->repos_lock->token != 0)) + if (m->status->repos_lock && (m->status->repos_lock->token != nullptr)) return true; else if (m->status->entry) - return m->status->entry->lock_token != 0; + return m->status->entry->lock_token != nullptr; else return false; } @@ -161,9 +161,9 @@ bool Status::isRepLock() const { - if (m->status->entry && (m->status->entry->lock_token != 0)) + if (m->status->entry && (m->status->entry->lock_token != nullptr)) return false; - else if (m->status->repos_lock && (m->status->repos_lock->token != 0)) + else if (m->status->repos_lock && (m->status->repos_lock->token != nullptr)) return true; else return false; @@ -172,7 +172,7 @@ const char * Status::lockToken() const { - if (m->status->repos_lock && m->status->repos_lock->token != 0) + if (m->status->repos_lock && m->status->repos_lock->token != nullptr) return m->status->repos_lock->token; else if (m->status->entry) return m->status->entry->lock_token; @@ -183,7 +183,7 @@ const char * Status::lockOwner() const { - if (m->status->repos_lock && m->status->repos_lock->token != 0) + if (m->status->repos_lock && m->status->repos_lock->token != nullptr) return m->status->repos_lock->owner; else if (m->status->entry) return m->status->entry->lock_owner; @@ -194,7 +194,7 @@ const char * Status::lockComment() const { - if (m->status->repos_lock && m->status->repos_lock->token != 0) + if (m->status->repos_lock && m->status->repos_lock->token != nullptr) return m->status->repos_lock->comment; else if (m->status->entry) return m->status->entry->lock_comment; @@ -205,7 +205,7 @@ apr_time_t Status::lockCreationDate() const { - if (m->status->repos_lock && m->status->repos_lock->token != 0) + if (m->status->repos_lock && m->status->repos_lock->token != nullptr) return m->status->repos_lock->creation_date; else if (m->status->entry) return m->status->entry->lock_creation_date; diff --git a/plugins/subversion/kdevsvncpp/targets.cpp b/plugins/subversion/kdevsvncpp/targets.cpp --- a/plugins/subversion/kdevsvncpp/targets.cpp +++ b/plugins/subversion/kdevsvncpp/targets.cpp @@ -64,7 +64,7 @@ Targets::Targets(const char * target) { - if (target != 0) + if (target != nullptr) { m_targets.push_back(target); } diff --git a/plugins/subversion/kdevsvncpp/wc.cpp b/plugins/subversion/kdevsvncpp/wc.cpp --- a/plugins/subversion/kdevsvncpp/wc.cpp +++ b/plugins/subversion/kdevsvncpp/wc.cpp @@ -50,7 +50,7 @@ svn_error_t * error = svn_wc_check_wc(dir.c_str(), &wc, pool); - if ((error != NULL) || (wc == 0)) + if ((error != nullptr) || (wc == 0)) { return false; } @@ -73,7 +73,7 @@ revision.revnum(), // revision pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } @@ -85,7 +85,7 @@ svn_error_t * error = svn_wc_set_adm_dir(dir, pool); - if (error != NULL) + if (error != nullptr) throw ClientException(error); } diff --git a/plugins/subversion/kdevsvnplugin.cpp b/plugins/subversion/kdevsvnplugin.cpp --- a/plugins/subversion/kdevsvnplugin.cpp +++ b/plugins/subversion/kdevsvnplugin.cpp @@ -74,8 +74,8 @@ KDevSvnPlugin::KDevSvnPlugin(QObject *parent, const QVariantList &) : KDevelop::IPlugin(QStringLiteral("kdevsubversion"), parent) , m_common(new KDevelop::VcsPluginHelper(this, this)) - , copy_action( 0 ) - , move_action( 0 ) + , copy_action( nullptr ) + , move_action( nullptr ) , m_jobQueue(new ThreadWeaver::Queue(this)) { KDEV_USE_EXTENSION_INTERFACE(KDevelop::IBasicVersionControl) @@ -155,12 +155,12 @@ KDevelop::VcsJob* KDevSvnPlugin::edit(const QUrl& /*localLocation*/) { - return 0; + return nullptr; } KDevelop::VcsJob* KDevSvnPlugin::unedit(const QUrl& /*localLocation*/) { - return 0; + return nullptr; } KDevelop::VcsJob* KDevSvnPlugin::localRevision(const QUrl &localLocation, KDevelop::VcsRevision::RevisionType type) @@ -288,13 +288,13 @@ Q_UNUSED(srcRevision) Q_UNUSED(dstRevision) Q_UNUSED(localLocation) - return 0; + return nullptr; } KDevelop::VcsJob* KDevSvnPlugin::resolve(const QList& /*localLocations*/, KDevelop::IBasicVersionControl::RecursionMode /*recursion*/) { - return 0; + return nullptr; } KDevelop::VcsJob* KDevSvnPlugin::import(const QString & commitMessage, const QUrl &sourceDirectory, const KDevelop::VcsLocation & destinationRepository) @@ -360,7 +360,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() != 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } } @@ -369,7 +369,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() > 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } } @@ -378,7 +378,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() > 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } @@ -392,7 +392,7 @@ dir = dir.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash); } - KUrlRequesterDialog dlg(dir, i18n("Destination file/directory"), 0); + KUrlRequesterDialog dlg(dir, i18n("Destination file/directory"), nullptr); if (isFile) { dlg.urlRequester()->setMode(KFile::File | KFile::Directory | KFile::LocalOnly); @@ -404,7 +404,7 @@ KDevelop::ICore::self()->runController()->registerJob(copy(source, dlg.selectedUrl())); } } else { - KMessageBox::error(0, i18n("Copying only works on local files")); + KMessageBox::error(nullptr, i18n("Copying only works on local files")); return; } @@ -414,7 +414,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() != 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } @@ -428,7 +428,7 @@ dir = source.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash); } - KUrlRequesterDialog dlg(dir, i18n("Destination file/directory"), 0); + KUrlRequesterDialog dlg(dir, i18n("Destination file/directory"), nullptr); if (isFile) { dlg.urlRequester()->setMode(KFile::File | KFile::Directory | KFile::LocalOnly); @@ -440,7 +440,7 @@ KDevelop::ICore::self()->runController()->registerJob(move(source, dlg.selectedUrl())); } } else { - KMessageBox::error(0, i18n("Moving only works on local files/dirs")); + KMessageBox::error(nullptr, i18n("Moving only works on local files/dirs")); return; } } @@ -449,7 +449,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() != 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } } @@ -468,7 +468,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() != 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } @@ -495,7 +495,7 @@ { QList const & ctxUrlList = m_common->contextUrlList(); if (ctxUrlList.count() != 1) { - KMessageBox::error(0, i18n("Please select only one item for this operation")); + KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); return; } diff --git a/plugins/subversion/svnclient.cpp b/plugins/subversion/svnclient.cpp --- a/plugins/subversion/svnclient.cpp +++ b/plugins/subversion/svnclient.cpp @@ -47,29 +47,29 @@ msg = apr_pvsprintf (pool, fmt, ap); va_end (ap); - error = svn_error_create (status, NULL, msg); + error = svn_error_create (status, nullptr, msg); throw svn::ClientException (error); } void cleanup( apr_file_t* outfile, const char* outfileName, apr_file_t* errfile, const char* errfileName, const svn::Pool& pool ) { - if( outfile != 0 ) + if( outfile != nullptr ) { apr_file_close( outfile ); } - if( errfile != 0 ) + if( errfile != nullptr ) { apr_file_close( outfile ); } - if( outfileName != 0 ) + if( outfileName != nullptr ) { svn_error_clear( svn_io_remove_file ( outfileName, pool ) ); } - if( errfileName != 0 ) + if( errfileName != nullptr ) { svn_error_clear( svn_io_remove_file ( errfileName, pool ) ); } @@ -77,7 +77,7 @@ } SvnClient::SvnClient( svn::Context* ctx ) - : QObject(0), svn::Client( ctx ), m_ctxt( ctx ) + : QObject(nullptr), svn::Client( ctx ), m_ctxt( ctx ) { } @@ -93,16 +93,16 @@ svn_error_t* error; - const char* outfileName = 0; - apr_file_t* outfile = 0; - const char* errfileName = 0; - apr_file_t* errfile = 0; + const char* outfileName = nullptr; + apr_file_t* outfile = nullptr; + const char* errfileName = nullptr; + apr_file_t* errfile = nullptr; QByteArray ba = QString(QStandardPaths::writableLocation(QStandardPaths::TempLocation)+"/kdevelop_svn_diff" ).toUtf8(); error = svn_io_open_unique_file( &outfile, &outfileName, ba.data(), ".tmp", false, pool ); - if( error != 0 ) + if( error != nullptr ) { ::cleanup( outfile, outfileName, errfile, errfileName, pool ); throw svn::ClientException( error ); @@ -110,7 +110,7 @@ error = svn_io_open_unique_file( &errfile, &errfileName, ba.data(), ".tmp", false, pool ); - if( error != 0 ) + if( error != nullptr ) { ::cleanup( outfile, outfileName, errfile, errfileName, pool ); throw svn::ClientException( error ); @@ -148,7 +148,7 @@ // now we can read the diff output from outfile and return that error = svn_stringbuf_from_aprfile (&stringbuf, outfile, pool); - if (error != NULL) + if (error != nullptr) { ::cleanup (outfile, outfileName, errfile, errfileName, pool); throw svn::ClientException (error); @@ -171,16 +171,16 @@ svn_error_t* error; - const char* outfileName = 0; - apr_file_t* outfile = 0; - const char* errfileName = 0; - apr_file_t* errfile = 0; + const char* outfileName = nullptr; + apr_file_t* outfile = nullptr; + const char* errfileName = nullptr; + apr_file_t* errfile = nullptr; QByteArray ba = QStandardPaths::writableLocation(QStandardPaths::TempLocation).toUtf8(); error = svn_io_open_unique_file( &outfile, &outfileName, ba.data(), ".tmp", false, pool ); - if( error != 0 ) + if( error != nullptr ) { ::cleanup( outfile, outfileName, errfile, errfileName, pool ); throw svn::ClientException( error ); @@ -188,7 +188,7 @@ error = svn_io_open_unique_file( &errfile, &errfileName, ba.data(), ".tmp", false, pool ); - if( error != 0 ) + if( error != nullptr ) { ::cleanup( outfile, outfileName, errfile, errfileName, pool ); throw svn::ClientException( error ); @@ -226,7 +226,7 @@ // now we can read the diff output from outfile and return that error = svn_stringbuf_from_aprfile (&stringbuf, outfile, pool); - if (error != NULL) + if (error != nullptr) { ::cleanup (outfile, outfileName, errfile, errfileName, pool); throw svn::ClientException(error); @@ -255,15 +255,15 @@ vcsrev.setRevisionValue( QVariant( qlonglong( rev ) ), KDevelop::VcsRevision::GlobalNumber ); ev.setRevision( vcsrev ); - if (changedPaths != NULL) + if (changedPaths != nullptr) { for (apr_hash_index_t *hi = apr_hash_first (pool, changedPaths); - hi != NULL; + hi != nullptr; hi = apr_hash_next (hi)) { char *path; void *val; - apr_hash_this (hi, (const void **)&path, NULL, &val); + apr_hash_this (hi, (const void **)&path, nullptr, &val); svn_log_changed_path_t *log_item = reinterpret_cast (val); KDevelop::VcsItemEvent iev; @@ -296,7 +296,7 @@ } client->emitLogEventReceived( ev ); - return NULL; + return nullptr; } void SvnClient::log( const char* path, @@ -323,7 +323,7 @@ m_ctxt->ctx(), // client ctx pool); - if (error != NULL) + if (error != nullptr) { throw svn::ClientException (error); } diff --git a/plugins/subversion/svninternaljobbase.cpp b/plugins/subversion/svninternaljobbase.cpp --- a/plugins/subversion/svninternaljobbase.cpp +++ b/plugins/subversion/svninternaljobbase.cpp @@ -55,9 +55,9 @@ SvnInternalJobBase::~SvnInternalJobBase() { - m_ctxt->setListener(0); + m_ctxt->setListener(nullptr); delete m_ctxt; - m_ctxt = 0; + m_ctxt = nullptr; } void SvnInternalJobBase::defaultBegin(const ThreadWeaver::JobPointer& self, ThreadWeaver::Thread *thread) diff --git a/plugins/subversion/svnjobbase.cpp b/plugins/subversion/svnjobbase.cpp --- a/plugins/subversion/svnjobbase.cpp +++ b/plugins/subversion/svnjobbase.cpp @@ -67,7 +67,7 @@ void SvnJobBase::askForLogin( const QString& realm ) { qCDebug(PLUGIN_SVN) << "login"; - KPasswordDialog dlg( 0, KPasswordDialog::ShowUsernameLine | KPasswordDialog::ShowKeepPassword ); + KPasswordDialog dlg( nullptr, KPasswordDialog::ShowUsernameLine | KPasswordDialog::ShowKeepPassword ); dlg.setPrompt( i18n("Enter Login for: %1", realm ) ); dlg.exec(); internalJob()->m_login_username = dlg.username(); @@ -117,7 +117,7 @@ void SvnJobBase::askForSslClientCert( const QString& realm ) { - KMessageBox::information( 0, realm ); + KMessageBox::information( nullptr, realm ); qCDebug(PLUGIN_SVN) << "clientrust"; internalJob()->m_guiSemaphore.release( 1 ); } diff --git a/plugins/subversion/tests/svnrecursiveadd.cpp b/plugins/subversion/tests/svnrecursiveadd.cpp --- a/plugins/subversion/tests/svnrecursiveadd.cpp +++ b/plugins/subversion/tests/svnrecursiveadd.cpp @@ -127,7 +127,7 @@ cmd << QStringLiteral("svnadmin") << QStringLiteral("create") << reposDir.path(); QCOMPARE(cmd.execute(10000), 0); QList plugins = Core::self()->pluginController()->allPluginsForExtension(QStringLiteral("org.kdevelop.IBasicVersionControl")); - IBasicVersionControl* vcs = NULL; + IBasicVersionControl* vcs = nullptr; foreach(IPlugin* p, plugins) { qDebug() << "checking plugin" << p; ICentralizedVersionControl* icentr = p->extension(); diff --git a/plugins/switchtobuddy/switchtobuddyplugin.cpp b/plugins/switchtobuddy/switchtobuddyplugin.cpp --- a/plugins/switchtobuddy/switchtobuddyplugin.cpp +++ b/plugins/switchtobuddy/switchtobuddyplugin.cpp @@ -69,7 +69,7 @@ return definition; } } - return 0; + return nullptr; } QString findSwitchCandidate(const QUrl& docUrl) @@ -95,7 +95,7 @@ SwitchToBuddyPlugin::SwitchToBuddyPlugin ( QObject* parent, const QVariantList& ) : IPlugin ( QStringLiteral("kdevswitchtobuddy"), parent ) - , m_signalMapper(0) + , m_signalMapper(nullptr) { setXMLFile(QStringLiteral("kdevswitchtobuddy.rc")); } @@ -224,7 +224,7 @@ bool wasSignal = false; if (standardCtx) { - Declaration* definition = 0; + Declaration* definition = nullptr; DUContext* ctx = standardCtx->findContext(standardCtx->transformToLocalRevision(cursor)); if (!ctx) { @@ -247,7 +247,7 @@ if (ClassFunctionDeclaration* cDef = dynamic_cast(definition)) { if (cDef->isSignal()) { qCDebug(PLUGIN_SWITCHTOBUDDY) << "found definition is a signal, not switching to .moc implementation"; - definition = 0; + definition = nullptr; wasSignal = true; } } @@ -277,7 +277,7 @@ qCDebug(PLUGIN_SWITCHTOBUDDY) << "Got no context for the current document"; } - Declaration* def = 0; + Declaration* def = nullptr; if (!wasSignal) { def = definitionForCursorDeclaration(cursor, docUrl); } diff --git a/plugins/testview/testview.cpp b/plugins/testview/testview.cpp --- a/plugins/testview/testview.cpp +++ b/plugins/testview/testview.cpp @@ -232,7 +232,7 @@ return item; } } - return 0; + return nullptr; } QStandardItem* TestView::itemForProject(IProject* project) @@ -278,7 +278,7 @@ continue; } QStandardItem* item = m_model->itemFromIndex(index); - if (item->parent() == 0) + if (item->parent() == nullptr) { // A project was selected IProject* project = ICore::self()->projectController()->findProjectByName(item->data(ProjectRole).toString()); @@ -287,7 +287,7 @@ jobs << suite->launchAllCases(ITestSuite::Silent); } } - else if (item->parent()->parent() == 0) + else if (item->parent()->parent() == nullptr) { // A suite was selected IProject* project = ICore::self()->projectController()->findProjectByName(item->parent()->data(ProjectRole).toString()); @@ -326,12 +326,12 @@ QModelIndex index = m_filter->mapToSource(indexes.first()); QStandardItem* item = m_model->itemFromIndex(index); - if (item->parent() == 0) + if (item->parent() == nullptr) { // No sense in finding source code for projects. return; } - else if (item->parent()->parent() == 0) + else if (item->parent()->parent() == nullptr) { IProject* project = ICore::self()->projectController()->findProjectByName(item->parent()->data(ProjectRole).toString()); ITestSuite* suite = tc->findTestSuite(project, item->data(SuiteRole).toString()); diff --git a/plugins/testview/testviewplugin.cpp b/plugins/testview/testviewplugin.cpp --- a/plugins/testview/testviewplugin.cpp +++ b/plugins/testview/testviewplugin.cpp @@ -48,7 +48,7 @@ public: TestToolViewFactory( TestViewPlugin *plugin ): mplugin( plugin ) {} - QWidget* create( QWidget *parent = 0 ) override + QWidget* create( QWidget *parent = nullptr ) override { return new TestView( mplugin, parent ); } diff --git a/plugins/vcschangesview/vcschangesviewplugin.cpp b/plugins/vcschangesview/vcschangesviewplugin.cpp --- a/plugins/vcschangesview/vcschangesviewplugin.cpp +++ b/plugins/vcschangesview/vcschangesviewplugin.cpp @@ -48,7 +48,7 @@ public: VCSProjectToolViewFactory(VcsProjectIntegrationPlugin *plugin): m_plugin(plugin) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { VcsChangesView* modif = new VcsChangesView(m_plugin, parent); modif->setModel(m_plugin->model()); @@ -74,7 +74,7 @@ VcsProjectIntegrationPlugin::VcsProjectIntegrationPlugin(QObject* parent, const QVariantList&) : KDevelop::IPlugin(QStringLiteral("kdevvcsprojectintegration"), parent) - , m_model(0) + , m_model(nullptr) { ICore::self()->uiController()->addToolView(i18n("Project Changes"), new VCSProjectToolViewFactory(this)); diff --git a/plugins/welcomepage/uihelper.cpp b/plugins/welcomepage/uihelper.cpp --- a/plugins/welcomepage/uihelper.cpp +++ b/plugins/welcomepage/uihelper.cpp @@ -50,7 +50,7 @@ } qWarning() << "error: action path not found: " << path; - return 0; + return nullptr; } QAction* UiHelper::retrieveMenuAction(const QString& menuPath) diff --git a/project/abstractfilemanagerplugin.cpp b/project/abstractfilemanagerplugin.cpp --- a/project/abstractfilemanagerplugin.cpp +++ b/project/abstractfilemanagerplugin.cpp @@ -464,7 +464,7 @@ ProjectFolderItem *AbstractFileManagerPlugin::import( IProject *project ) { - ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), 0 ); + ProjectFolderItem *projectRoot = createFolderItem( project, project->path(), nullptr ); emit folderAdded( projectRoot ); qCDebug(FILEMANAGER) << "imported new project" << project->name() << "at" << projectRoot->path(); @@ -502,7 +502,7 @@ ProjectFolderItem * parent ) { qCDebug(FILEMANAGER) << "adding folder" << folder << "to" << parent->path(); - ProjectFolderItem* created = 0; + ProjectFolderItem* created = nullptr; d->stopWatcher(parent); if ( createFolder(folder.toUrl()) ) { created = createFolderItem( parent->project(), folder, parent ); @@ -519,7 +519,7 @@ ProjectFolderItem * parent ) { qCDebug(FILEMANAGER) << "adding file" << file << "to" << parent->path(); - ProjectFileItem* created = 0; + ProjectFileItem* created = nullptr; d->stopWatcher(parent); if ( createFile(file.toUrl()) ) { created = createFileItem( parent->project(), file, parent ); @@ -651,7 +651,7 @@ KDirWatch* AbstractFileManagerPlugin::projectWatcher( IProject* project ) const { - return d->m_watchers.value( project, 0 ); + return d->m_watchers.value( project, nullptr ); } //END Plugin diff --git a/project/builderjob.cpp b/project/builderjob.cpp --- a/project/builderjob.cpp +++ b/project/builderjob.cpp @@ -116,7 +116,7 @@ } qCDebug(PROJECT) << "got build system manager"; Q_ASSERT(item->project()->buildSystemManager()->builder()); - KJob* j = 0; + KJob* j = nullptr; switch( t ) { case BuilderJob::Build: diff --git a/project/importprojectjob.cpp b/project/importprojectjob.cpp --- a/project/importprojectjob.cpp +++ b/project/importprojectjob.cpp @@ -57,7 +57,7 @@ }; ImportProjectJob::ImportProjectJob(ProjectFolderItem *folder, IProjectFileManager *importer) - : KJob(0), d(new ImportProjectJobPrivate ) + : KJob(nullptr), d(new ImportProjectJobPrivate ) { d->m_importer = importer; d->m_folder = folder; diff --git a/project/interfaces/iprojectbuilder.cpp b/project/interfaces/iprojectbuilder.cpp --- a/project/interfaces/iprojectbuilder.cpp +++ b/project/interfaces/iprojectbuilder.cpp @@ -28,12 +28,12 @@ KJob* IProjectBuilder::configure(IProject*) { - return 0; + return nullptr; } KJob* IProjectBuilder::prune(IProject*) { - return 0; + return nullptr; } QList< IProjectBuilder* > IProjectBuilder::additionalBuilderPlugins( IProject* project ) const diff --git a/project/projectchangesmodel.cpp b/project/projectchangesmodel.cpp --- a/project/projectchangesmodel.cpp +++ b/project/projectchangesmodel.cpp @@ -108,7 +108,7 @@ if(curr->data(role) == value) return curr; } - return 0; + return nullptr; } QStandardItem* ProjectChangesModel::projectItem(IProject* p) const @@ -127,7 +127,7 @@ void ProjectChangesModel::changes(IProject* project, const QList& urls, IBasicVersionControl::RecursionMode mode) { IPlugin* vcsplugin=project->versionControlPlugin(); - IBasicVersionControl* vcs = vcsplugin ? vcsplugin->extension() : 0; + IBasicVersionControl* vcs = vcsplugin ? vcsplugin->extension() : nullptr; if(vcs && vcs->isVersionControlled(urls.first())) { //TODO: filter? VcsJob* job=vcs->status(urls, mode); diff --git a/project/projectitemlineedit.cpp b/project/projectitemlineedit.cpp --- a/project/projectitemlineedit.cpp +++ b/project/projectitemlineedit.cpp @@ -48,7 +48,7 @@ { Q_OBJECT public: - ProjectItemCompleter(QObject* parent=0); + ProjectItemCompleter(QObject* parent=nullptr); QString separator() const { return sep; } QStringList splitPath(const QString &path) const override; @@ -65,7 +65,7 @@ { Q_OBJECT public: - ProjectItemValidator(QObject* parent = 0 ); + ProjectItemValidator(QObject* parent = nullptr ); QValidator::State validate( QString& input, int& pos ) const override; void setBaseItem( KDevelop::ProjectBaseItem* item ) { mBase = item; } @@ -77,7 +77,7 @@ ProjectItemCompleter::ProjectItemCompleter(QObject* parent) : QCompleter(parent) , mModel(KDevelop::ICore::self()->projectController()->projectModel()) - , mBase( 0 ) + , mBase( nullptr ) { setModel(mModel); setCaseSensitivity( Qt::CaseInsensitive ); @@ -98,7 +98,7 @@ } -ProjectItemValidator::ProjectItemValidator(QObject* parent): QValidator(parent), mBase(0) +ProjectItemValidator::ProjectItemValidator(QObject* parent): QValidator(parent), mBase(nullptr) { } @@ -147,10 +147,10 @@ ProjectItemLineEdit::ProjectItemLineEdit(QWidget* parent) : QLineEdit(parent), - m_base(0), + m_base(nullptr), m_completer( new ProjectItemCompleter( this ) ), m_validator( new ProjectItemValidator( this ) ), - m_suggestion( 0 ) + m_suggestion( nullptr ) { setCompleter( m_completer ); setValidator( m_validator ); diff --git a/project/projectmodel.cpp b/project/projectmodel.cpp --- a/project/projectmodel.cpp +++ b/project/projectmodel.cpp @@ -88,7 +88,7 @@ return rootItem; } if( idx.model() != model ) { - return 0; + return nullptr; } return model->itemFromIndex( idx ); } @@ -100,7 +100,7 @@ class ProjectBaseItemPrivate { public: - ProjectBaseItemPrivate() : project(0), parent(0), row(-1), model(0), m_pathIndex(0) {} + ProjectBaseItemPrivate() : project(nullptr), parent(nullptr), row(-1), model(nullptr), m_pathIndex(0) {} IProject* project; ProjectBaseItem* parent; int row; @@ -194,7 +194,7 @@ { Q_D(const ProjectBaseItem); if( row < 0 || row >= d->children.length() ) { - return 0; + return nullptr; } return d->children.at( row ); } @@ -214,9 +214,9 @@ model()->beginRemoveRows(index(), row, row); } ProjectBaseItem* olditem = d->children.takeAt( row ); - olditem->d_func()->parent = 0; + olditem->d_func()->parent = nullptr; olditem->d_func()->row = -1; - olditem->setModel( 0 ); + olditem->setModel( nullptr ); for(int i=row; id_func()->row--; @@ -251,18 +251,18 @@ if (row == 0 && count == d->children.size()) { // optimize if we want to delete all foreach(ProjectBaseItem* item, d->children) { - item->d_func()->parent = 0; + item->d_func()->parent = nullptr; item->d_func()->row = -1; - item->setModel( 0 ); + item->setModel( nullptr ); delete item; } d->children.clear(); } else { for (int i = row; i < count; ++i) { ProjectBaseItem* item = d->children.at(i); - item->d_func()->parent = 0; + item->d_func()->parent = nullptr; item->d_func()->row = -1; - item->setModel( 0 ); + item->setModel( nullptr ); delete d->children.takeAt( row ); } for(int i = row; i < d->children.size(); ++i) { @@ -305,7 +305,7 @@ { Q_D(const ProjectBaseItem); if( model() && model()->d->rootItem == d->parent ) { - return 0; + return nullptr; } return d->parent; } @@ -499,22 +499,22 @@ ProjectFolderItem *ProjectBaseItem::folder() const { - return 0; + return nullptr; } ProjectTargetItem *ProjectBaseItem::target() const { - return 0; + return nullptr; } ProjectExecutableTargetItem *ProjectBaseItem::executable() const { - return 0; + return nullptr; } ProjectFileItem *ProjectBaseItem::file() const { - return 0; + return nullptr; } QList ProjectBaseItem::folderList() const @@ -658,7 +658,7 @@ bool ProjectBaseItem::isProjectRoot() const { - return parent()==0; + return parent()==nullptr; } ProjectBuildFolderItem::ProjectBuildFolderItem(IProject* project, const Path& path, ProjectBaseItem *parent) @@ -971,7 +971,7 @@ return parent->child( index.row() ); } } - return 0; + return nullptr; } QVariant ProjectModel::data( const QModelIndex& index, int role ) const @@ -1009,7 +1009,7 @@ ProjectModel::ProjectModel( QObject *parent ) : QAbstractItemModel( parent ), d( new ProjectModelPrivate( this ) ) { - d->rootItem = new ProjectBaseItem( 0, QString(), 0 ); + d->rootItem = new ProjectBaseItem( nullptr, QString(), nullptr ); d->rootItem->setModel( this ); } @@ -1065,7 +1065,7 @@ if(item) return item->flags(); else - return 0; + return nullptr; } bool ProjectModel::insertColumns(int, int, const QModelIndex&) diff --git a/project/tests/projectmodelperformancetest.cpp b/project/tests/projectmodelperformancetest.cpp --- a/project/tests/projectmodelperformancetest.cpp +++ b/project/tests/projectmodelperformancetest.cpp @@ -107,7 +107,7 @@ timer.start(); for( int i = 0; i < INIT_WIDTH; i++ ) { - ProjectFolderItem* item = new ProjectFolderItem( 0, Path( QUrl::fromLocalFile( QStringLiteral( "/f%1" ).arg( i ) ) ) ); + ProjectFolderItem* item = new ProjectFolderItem( nullptr, Path( QUrl::fromLocalFile( QStringLiteral( "/f%1" ).arg( i ) ) ) ); generateChilds( item, INIT_WIDTH, INIT_DEPTH ); model->appendRow( item ); } @@ -132,7 +132,7 @@ QElapsedTimer timer; timer.start(); for( int i = 0; i < BIG_WIDTH; i++ ) { - ProjectFolderItem* item = new ProjectFolderItem( 0, Path( QUrl::fromLocalFile( QStringLiteral( "/f%1" ).arg( i ) ) ) ); + ProjectFolderItem* item = new ProjectFolderItem( nullptr, Path( QUrl::fromLocalFile( QStringLiteral( "/f%1" ).arg( i ) ) ) ); generateChilds( item, BIG_WIDTH, BIG_DEPTH ); model->appendRow( item ); } @@ -149,7 +149,7 @@ { QElapsedTimer timer; timer.start(); - ProjectBaseItem* parent = 0; + ProjectBaseItem* parent = nullptr; Path path; if( !currentParent.isEmpty() ) { parent = currentParent.top(); @@ -157,11 +157,11 @@ } else { path = Path(QUrl::fromLocalFile(QStringLiteral("/f%1").arg(model->rowCount()))); } - ProjectBaseItem* item = 0; + ProjectBaseItem* item = nullptr; if( currentParent.size() < BIG_DEPTH ) { - item = new ProjectFolderItem(0, path, parent); + item = new ProjectFolderItem(nullptr, path, parent); } else { - item = new ProjectFileItem( 0, path, parent ); + item = new ProjectFileItem( nullptr, path, parent ); } if( currentParent.isEmpty() ) { model->appendRow( item ); @@ -187,7 +187,7 @@ QElapsedTimer timer; timer.start(); for( int i = 0; i < SMALL_WIDTH; i++ ) { - ProjectFolderItem* item = new ProjectFolderItem( 0, Path(QUrl::fromLocalFile( QStringLiteral( "/f%1" ).arg( i ) )) ); + ProjectFolderItem* item = new ProjectFolderItem( nullptr, Path(QUrl::fromLocalFile( QStringLiteral( "/f%1" ).arg( i ) )) ); generateChilds( item, SMALL_WIDTH, SMALL_DEPTH ); model->appendRow( item ); } diff --git a/project/tests/test_projectmodel.cpp b/project/tests/test_projectmodel.cpp --- a/project/tests/test_projectmodel.cpp +++ b/project/tests/test_projectmodel.cpp @@ -78,16 +78,16 @@ QFETCH( QStringList, expectedRelativeItemPath ); QFETCH( int, expectedItemRow ); - ProjectBaseItem* newitem = 0; + ProjectBaseItem* newitem = nullptr; switch( itemType ) { case ProjectBaseItem::Folder: - newitem = new ProjectFolderItem( 0, itemPath ); + newitem = new ProjectFolderItem( nullptr, itemPath ); break; case ProjectBaseItem::BuildFolder: - newitem = new ProjectBuildFolderItem( 0, itemPath ); + newitem = new ProjectBuildFolderItem( nullptr, itemPath ); break; case ProjectBaseItem::File: - newitem = new ProjectFileItem( 0, itemPath ); + newitem = new ProjectFileItem( nullptr, itemPath ); break; } int origRowCount = model->rowCount(); @@ -155,13 +155,13 @@ QFETCH( QStringList, expectedItemPath ); QFETCH( int, expectedItemRow ); - ProjectBaseItem* newitem = 0; + ProjectBaseItem* newitem = nullptr; switch( itemType ) { case ProjectBaseItem::Target: - newitem = new ProjectTargetItem( 0, itemText ); + newitem = new ProjectTargetItem( nullptr, itemText ); break; case ProjectBaseItem::LibraryTarget: - newitem = new ProjectLibraryTargetItem( 0, itemText ); + newitem = new ProjectLibraryTargetItem( nullptr, itemText ); break; } int origRowCount = model->rowCount(); @@ -206,8 +206,8 @@ { QSortFilterProxyModel* proxy = new QSortFilterProxyModel( this ); proxy->setSourceModel( model ); - ProjectFolderItem* root = new ProjectFolderItem( 0, Path(QUrl::fromLocalFile(QStringLiteral("/folder1"))) ); - root->appendRow( new ProjectFileItem( 0, Path(QUrl::fromLocalFile(QStringLiteral("/folder1/file1"))) ) ); + ProjectFolderItem* root = new ProjectFolderItem( nullptr, Path(QUrl::fromLocalFile(QStringLiteral("/folder1"))) ); + root->appendRow( new ProjectFileItem( nullptr, Path(QUrl::fromLocalFile(QStringLiteral("/folder1/file1"))) ) ); model->appendRow( root ); QCOMPARE( model->rowCount(), 1 ); @@ -225,13 +225,13 @@ QString fileName = QStringLiteral("file"); QString targetName = QStringLiteral("testtarged"); QString cppFileName = QStringLiteral("file.cpp"); - ProjectFolderItem* rootFolder = new ProjectFolderItem( 0, Path(QUrl::fromLocalFile("/"+folderName)) ); + ProjectFolderItem* rootFolder = new ProjectFolderItem( nullptr, Path(QUrl::fromLocalFile("/"+folderName)) ); QCOMPARE(rootFolder->baseName(), folderName); ProjectFileItem* file = new ProjectFileItem( fileName, rootFolder ); QCOMPARE(file->baseName(), fileName); - ProjectTargetItem* target = new ProjectTargetItem( 0, targetName ); + ProjectTargetItem* target = new ProjectTargetItem( nullptr, targetName ); rootFolder->appendRow( target ); - ProjectFileItem* targetfile = new ProjectFileItem( 0, Path(rootFolder->path(), cppFileName), target ); + ProjectFileItem* targetfile = new ProjectFileItem( nullptr, Path(rootFolder->path(), cppFileName), target ); model->appendRow( rootFolder ); @@ -260,7 +260,7 @@ rootFolder->removeRow( 1 ); QCOMPARE( model->rowCount( folderIdx ), 1 ); delete file; - file = 0; + file = nullptr; // Check that we also find a folder with the fileName new ProjectFolderItem( fileName, rootFolder ); @@ -272,11 +272,11 @@ void TestProjectModel::testItemSanity() { - ProjectBaseItem* parent = new ProjectBaseItem( 0, QStringLiteral("test") ); - ProjectBaseItem* child = new ProjectBaseItem( 0, QStringLiteral("test"), parent ); - ProjectBaseItem* child2 = new ProjectBaseItem( 0, QStringLiteral("ztest"), parent ); - ProjectFileItem* child3 = new ProjectFileItem( 0, Path(QUrl(QStringLiteral("file:///bcd"))), parent ); - ProjectFileItem* child4 = new ProjectFileItem( 0, Path(QUrl(QStringLiteral("file:///abcd"))), parent ); + ProjectBaseItem* parent = new ProjectBaseItem( nullptr, QStringLiteral("test") ); + ProjectBaseItem* child = new ProjectBaseItem( nullptr, QStringLiteral("test"), parent ); + ProjectBaseItem* child2 = new ProjectBaseItem( nullptr, QStringLiteral("ztest"), parent ); + ProjectFileItem* child3 = new ProjectFileItem( nullptr, Path(QUrl(QStringLiteral("file:///bcd"))), parent ); + ProjectFileItem* child4 = new ProjectFileItem( nullptr, Path(QUrl(QStringLiteral("file:///abcd"))), parent ); // Just some basic santiy checks on the API QCOMPARE( parent->child( 0 ), child ); @@ -307,9 +307,9 @@ void TestProjectModel::testTakeRow() { - ProjectBaseItem* parent = new ProjectBaseItem( 0, QStringLiteral("test") ); - ProjectBaseItem* child = new ProjectBaseItem( 0, QStringLiteral("test"), parent ); - ProjectBaseItem* subchild = new ProjectBaseItem( 0, QStringLiteral("subtest"), child ); + ProjectBaseItem* parent = new ProjectBaseItem( nullptr, QStringLiteral("test") ); + ProjectBaseItem* child = new ProjectBaseItem( nullptr, QStringLiteral("test"), parent ); + ProjectBaseItem* subchild = new ProjectBaseItem( nullptr, QStringLiteral("subtest"), child ); model->appendRow( parent ); @@ -319,8 +319,8 @@ parent->takeRow( child->row() ); - QCOMPARE( child->model(), static_cast(0) ); - QCOMPARE( subchild->model(), static_cast(0) ); + QCOMPARE( child->model(), static_cast(nullptr) ); + QCOMPARE( subchild->model(), static_cast(nullptr) ); } void TestProjectModel::testRename() @@ -334,12 +334,12 @@ const Path projectFolder = Path(QUrl::fromLocalFile(QStringLiteral("/dummyprojectfolder"))); TestProject* proj = new TestProject; - ProjectFolderItem* rootItem = new ProjectFolderItem( proj, projectFolder, 0); + ProjectFolderItem* rootItem = new ProjectFolderItem( proj, projectFolder, nullptr); proj->setProjectItem( rootItem ); new ProjectFileItem(QStringLiteral("existing"), rootItem); - ProjectBaseItem* item = 0; + ProjectBaseItem* item = nullptr; if( itemType == ProjectBaseItem::Target ) { item = new ProjectTargetItem( proj, itemText, rootItem ); } else if( itemType == ProjectBaseItem::File ) { @@ -449,7 +449,7 @@ void TestProjectModel::testWithProject() { TestProject* proj = new TestProject(); - ProjectFolderItem* rootItem = new ProjectFolderItem( proj, Path(QUrl::fromLocalFile(QStringLiteral("/dummyprojectfolder"))), 0); + ProjectFolderItem* rootItem = new ProjectFolderItem( proj, Path(QUrl::fromLocalFile(QStringLiteral("/dummyprojectfolder"))), nullptr); proj->setProjectItem( rootItem ); ProjectBaseItem* item = model->itemFromIndex( model->index( 0, 0 ) ); QCOMPARE( item, rootItem ); @@ -481,17 +481,17 @@ QTest::addColumn("matches"); { - ProjectFolderItem* root = new ProjectFolderItem(0, Path(QUrl::fromLocalFile(QStringLiteral("/tmp/")))); + ProjectFolderItem* root = new ProjectFolderItem(nullptr, Path(QUrl::fromLocalFile(QStringLiteral("/tmp/")))); ProjectFileItem* file = new ProjectFileItem(QStringLiteral("a"), root); QTest::newRow("find one") << file->path() << static_cast(root) << 1; } { - ProjectFolderItem* root = new ProjectFolderItem(0, Path(QUrl::fromLocalFile(QStringLiteral("/tmp/")))); + ProjectFolderItem* root = new ProjectFolderItem(nullptr, Path(QUrl::fromLocalFile(QStringLiteral("/tmp/")))); ProjectFolderItem* folder = new ProjectFolderItem(QStringLiteral("a"), root); ProjectFileItem* file = new ProjectFileItem(QStringLiteral("foo"), folder); - ProjectTargetItem* target = new ProjectTargetItem(0, QStringLiteral("b"), root); - ProjectFileItem* file2 = new ProjectFileItem(0, file->path(), target); + ProjectTargetItem* target = new ProjectTargetItem(nullptr, QStringLiteral("b"), root); + ProjectFileItem* file2 = new ProjectFileItem(nullptr, file->path(), target); Q_UNUSED(file2); QTest::newRow("find two") << file->path() << static_cast(root) << 2; } @@ -499,7 +499,7 @@ void TestProjectModel::testProjectProxyModel() { - ProjectFolderItem* root = new ProjectFolderItem(0, Path(QUrl::fromLocalFile(QStringLiteral("/tmp/")))); + ProjectFolderItem* root = new ProjectFolderItem(nullptr, Path(QUrl::fromLocalFile(QStringLiteral("/tmp/")))); new ProjectFileItem(QStringLiteral("b1"), root); new ProjectFileItem(QStringLiteral("a1"), root); new ProjectFileItem(QStringLiteral("d1"), root); @@ -535,7 +535,7 @@ { QMimeDatabase db; - ProjectFileItem* item = new ProjectFileItem(0, Path(QStringLiteral("/tmp/foo.txt"))); + ProjectFileItem* item = new ProjectFileItem(nullptr, Path(QStringLiteral("/tmp/foo.txt"))); const QString txtIcon = db.mimeTypeForUrl(item->path().toUrl()).iconName(); QCOMPARE(item->iconName(), txtIcon); item->setPath(Path(QStringLiteral("/tmp/bar.cpp"))); diff --git a/serialization/abstractitemrepository.cpp b/serialization/abstractitemrepository.cpp --- a/serialization/abstractitemrepository.cpp +++ b/serialization/abstractitemrepository.cpp @@ -31,7 +31,7 @@ { } -AbstractRepositoryManager::AbstractRepositoryManager() : m_repository(0) +AbstractRepositoryManager::AbstractRepositoryManager() : m_repository(nullptr) { } @@ -42,7 +42,7 @@ void AbstractRepositoryManager::deleteRepository() { delete m_repository; - m_repository = 0; + m_repository = nullptr; } } diff --git a/serialization/indexedstring.cpp b/serialization/indexedstring.cpp --- a/serialization/indexedstring.cpp +++ b/serialization/indexedstring.cpp @@ -339,7 +339,7 @@ const char* IndexedString::c_str() const { if (!m_index) { - return 0; + return nullptr; } else if (isSingleCharIndex(m_index)) { #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN const uint offset = 0; diff --git a/serialization/itemrepositoryregistry.cpp b/serialization/itemrepositoryregistry.cpp --- a/serialization/itemrepositoryregistry.cpp +++ b/serialization/itemrepositoryregistry.cpp @@ -148,7 +148,7 @@ }; //The global item-reposity registry -ItemRepositoryRegistry* ItemRepositoryRegistry::m_self = 0; +ItemRepositoryRegistry* ItemRepositoryRegistry::m_self = nullptr; ItemRepositoryRegistry::ItemRepositoryRegistry(const ISessionLock::Ptr& session) : d(new ItemRepositoryRegistryPrivate(this)) diff --git a/serialization/referencecounting.cpp b/serialization/referencecounting.cpp --- a/serialization/referencecounting.cpp +++ b/serialization/referencecounting.cpp @@ -37,7 +37,7 @@ //Speedup: In most cases there is only exactly one reference-counted range active, //so the first reference-counting range can be marked here. - void* refCountingFirstRangeStart = 0; + void* refCountingFirstRangeStart = nullptr; QPair refCountingFirstRangeExtent = qMakePair(0u, 0u); } @@ -51,7 +51,7 @@ --refCountingFirstRangeExtent.second; if(refCountingFirstRangeExtent.second == 0) { refCountingFirstRangeExtent = qMakePair(0, 0); - refCountingFirstRangeStart = 0; + refCountingFirstRangeStart = nullptr; } } else if(refCountingHasAdditionalRanges) diff --git a/serialization/tests/test_itemrepository.cpp b/serialization/tests/test_itemrepository.cpp --- a/serialization/tests/test_itemrepository.cpp +++ b/serialization/tests/test_itemrepository.cpp @@ -114,7 +114,7 @@ uint totalInsertions = 0, totalDeletions = 0; uint maxSize = 0; uint totalSize = 0; - srand(time(NULL)); + srand(time(nullptr)); uint highestSeenIndex = 0; for(uint a = 0; a < cycles; ++a) { diff --git a/shell/core.cpp b/shell/core.cpp --- a/shell/core.cpp +++ b/shell/core.cpp @@ -92,7 +92,7 @@ namespace KDevelop { -Core *Core::m_self = 0; +Core *Core::m_self = nullptr; KAboutData createAboutData() { @@ -396,7 +396,7 @@ //Cleanup already called before mass destruction of GUI delete d; - m_self = 0; + m_self = nullptr; } Core::Setup Core::setupFlags() const diff --git a/shell/debugcontroller.cpp b/shell/debugcontroller.cpp --- a/shell/debugcontroller.cpp +++ b/shell/debugcontroller.cpp @@ -61,7 +61,7 @@ DebuggerToolFactory(DebugController* controller, const QString &id, Qt::DockWidgetArea defaultArea) : m_controller(controller), m_id(id), m_defaultArea(defaultArea) {} - QWidget* create(QWidget *parent = 0) override + QWidget* create(QWidget *parent = nullptr) override { return new T(m_controller, parent); } @@ -98,12 +98,12 @@ DebugController::DebugController(QObject *parent) : IDebugController(parent), KXMLGUIClient(), - m_continueDebugger(0), m_stopDebugger(0), - m_interruptDebugger(0), m_runToCursor(0), - m_jumpToCursor(0), m_stepOver(0), - m_stepIntoInstruction(0), m_stepInto(0), - m_stepOverInstruction(0), m_stepOut(0), - m_toggleBreakpoint(0), + m_continueDebugger(nullptr), m_stopDebugger(nullptr), + m_interruptDebugger(nullptr), m_runToCursor(nullptr), + m_jumpToCursor(nullptr), m_stepOver(nullptr), + m_stepIntoInstruction(nullptr), m_stepInto(nullptr), + m_stepOverInstruction(nullptr), m_stepOut(nullptr), + m_toggleBreakpoint(nullptr), m_breakpointModel(new BreakpointModel(this)), m_variableCollection(new VariableCollection(this)), m_uiInitialized(false) @@ -376,7 +376,7 @@ if (state == IDebugSession::EndedState) { if (session == m_currentSession.data()) { m_currentSession.clear(); - emit currentSessionChanged(0); + emit currentSessionChanged(nullptr); if (!Core::self()->shuttingDown()) { Sublime::MainWindow* mainWindow = Core::self()->uiControllerInternal()->activeSublimeWindow(); if (mainWindow && mainWindow->area()->objectName() != QLatin1String("code")) { @@ -384,7 +384,7 @@ ICore::self()->uiController()->switchToArea(QStringLiteral("code"), IUiController::ThisWindow); mainWindow->area()->setWorkingSet(workingSet); } - ICore::self()->uiController()->findToolView(i18n("Debug"), 0, IUiController::Raise); + ICore::self()->uiController()->findToolView(i18n("Debug"), nullptr, IUiController::Raise); } } session->deleteLater(); diff --git a/shell/documentationcontroller.cpp b/shell/documentationcontroller.cpp --- a/shell/documentationcontroller.cpp +++ b/shell/documentationcontroller.cpp @@ -76,7 +76,7 @@ if (decl->kind() == Declaration::Instance) { AbstractType::Ptr type = TypeUtils::targetTypeKeepAliases(decl->abstractType(), decl->topContext()); IdentifiedType* idType = dynamic_cast(type.data()); - Declaration* idDecl = idType ? idType->declaration(decl->topContext()) : 0; + Declaration* idDecl = idType ? idType->declaration(decl->topContext()) : nullptr; if (idDecl) { decl = idDecl; } diff --git a/shell/documentcontroller.cpp b/shell/documentcontroller.cpp --- a/shell/documentcontroller.cpp +++ b/shell/documentcontroller.cpp @@ -85,8 +85,8 @@ DocumentControllerPrivate(DocumentController* c) : controller(c) - , fileOpenRecent(0) - , globalTextEditorInstance(0) + , fileOpenRecent(nullptr) + , globalTextEditorInstance(nullptr) { } @@ -203,7 +203,7 @@ return doc; } } - return 0; + return nullptr; } static bool fileExists(const QUrl& url) @@ -219,8 +219,8 @@ IDocument* openDocumentInternal( const QUrl & inputUrl, const QString& prefName = QString(), const KTextEditor::Range& range = KTextEditor::Range::invalid(), const QString& encoding = QString(), - DocumentController::DocumentActivationParams activationParams = 0, - IDocument* buddy = 0) + DocumentController::DocumentActivationParams activationParams = nullptr, + IDocument* buddy = nullptr) { Q_ASSERT(!inputUrl.isRelative()); Q_ASSERT(!inputUrl.fileName().isEmpty()); @@ -236,7 +236,7 @@ _encoding = res.encoding; if ( url.isEmpty() ) //still no url - return 0; + return nullptr; } KSharedConfig::openConfig()->group("Open File").writeEntry( "Last Open File Directory", url.adjusted(QUrl::RemoveFilename) ); @@ -266,13 +266,13 @@ // If the url is valid and the file does not already exist, // kate creates the file and gives a message saying so qCDebug(SHELL) << "invalid URL:" << url.url(); - return 0; + return nullptr; } else if (KProtocolInfo::isKnownProtocol(url.scheme()) && !fileExists(url)) { //Don't create a new file if we are not in the code mode. if (ICore::self()->uiController()->activeArea()->objectName() != QLatin1String("code")) { - return 0; + return nullptr; } // enfore text mime type in order to create a kate part editor which then can be used to create the file // otherwise we could end up opening e.g. okteta which then crashes, see: https://bugs.kde.org/id=326434 @@ -297,7 +297,7 @@ if (mimeType.inherits(QStringLiteral("inode/directory"))) { qCDebug(SHELL) << "cannot open directory:" << url.url(); - return 0; + return nullptr; } if( prefName.isEmpty() ) @@ -325,12 +325,12 @@ doc = new PartDocument(url, Core::self()); } else { - int openAsText = KMessageBox::questionYesNo(0, i18n("KDevelop could not find the editor for file '%1' of type %2.\nDo you want to open it as plain text?", url.fileName(), mimeType.name()), i18nc("@title:window", "Could Not Find Editor"), + int openAsText = KMessageBox::questionYesNo(nullptr, i18n("KDevelop could not find the editor for file '%1' of type %2.\nDo you want to open it as plain text?", url.fileName(), mimeType.name()), i18nc("@title:window", "Could Not Find Editor"), KStandardGuiItem::yes(), KStandardGuiItem::no(), QStringLiteral("AskOpenWithTextEditor")); if (openAsText == KMessageBox::Yes) doc = new TextDocument(url, Core::self(), _encoding); else - return 0; + return nullptr; } } } @@ -341,14 +341,14 @@ if(doc && openDocumentInternal(doc, range, activationParams, buddy)) return doc; else - return 0; + return nullptr; } bool openDocumentInternal(IDocument* doc, const KTextEditor::Range& range, DocumentController::DocumentActivationParams activationParams, - IDocument* buddy = 0) + IDocument* buddy = nullptr) { IDocument* previousActiveDocument = controller->activeDocument(); KTextEditor::View* previousActiveTextView = ICore::self()->documentController()->activeTextDocumentView(); @@ -383,7 +383,7 @@ if (!activationParams.testFlag(IDocumentController::DoNotCreateView)) { //find a view if there's one already opened in this area - Sublime::View *partView = 0; + Sublime::View *partView = nullptr; Sublime::AreaIndex* activeViewIdx = area->indexOf(uiController->activeSublimeWindow()->activeView()); foreach (Sublime::View *view, sdoc->views()) { @@ -406,7 +406,7 @@ // This code is never executed when restoring session on startup, // only when opening a file manually - Sublime::View* buddyView = 0; + Sublime::View* buddyView = nullptr; bool placeAfterBuddy = true; if(Core::self()->uiControllerInternal()->arrangeBuddies() && !buddy && doc->mimeType().isValid()) { // If buddy is not set, look for a (usually) plugin which handles this URL's mimetype @@ -455,8 +455,8 @@ else { // no buddy found for new document / plugin does not support buddies / buddy feature disabled Sublime::View *activeView = uiController->activeSublimeWindow()->activeView(); - Sublime::UrlDocument *activeDoc = 0; - IBuddyDocumentFinder *buddyFinder = 0; + Sublime::UrlDocument *activeDoc = nullptr; + IBuddyDocumentFinder *buddyFinder = nullptr; if(activeView) activeDoc = dynamic_cast(activeView->document()); if(activeDoc && Core::self()->uiControllerInternal()->arrangeBuddies()) { @@ -474,9 +474,9 @@ // we do not want to separate foo.h and foo.cpp, so we take care and avoid this. Sublime::AreaIndex *activeAreaIndex = area->indexOf(activeView); int pos = activeAreaIndex->views().indexOf(activeView); - Sublime::View *afterActiveView = activeAreaIndex->views().value(pos+1, 0); + Sublime::View *afterActiveView = activeAreaIndex->views().value(pos+1, nullptr); - Sublime::UrlDocument *activeDoc = 0, *afterActiveDoc = 0; + Sublime::UrlDocument *activeDoc = nullptr, *afterActiveDoc = nullptr; if(activeView && afterActiveView) { activeDoc = dynamic_cast(activeView->document()); afterActiveDoc = dynamic_cast(afterActiveView->document()); @@ -766,7 +766,7 @@ Q_ASSERT(!dirtyUrl.isRelative()); Q_ASSERT(!dirtyUrl.fileName().isEmpty()); //Fix urls that might not be normalized - return d->documents.value( dirtyUrl.adjusted( QUrl::NormalizePathSegments ), 0 ); + return d->documents.value( dirtyUrl.adjusted( QUrl::NormalizePathSegments ), nullptr ); } QList DocumentController::openDocuments() const @@ -946,7 +946,7 @@ { UiController *uiController = Core::self()->uiControllerInternal(); Sublime::MainWindow* mw = uiController->activeSublimeWindow(); - if( !mw || !mw->activeView() ) return 0; + if( !mw || !mw->activeView() ) return nullptr; return dynamic_cast(mw->activeView()->document()); } @@ -955,11 +955,11 @@ UiController *uiController = Core::self()->uiControllerInternal(); Sublime::MainWindow* mw = uiController->activeSublimeWindow(); if( !mw || !mw->activeView() ) - return 0; + return nullptr; TextView* view = qobject_cast(mw->activeView()); if(!view) - return 0; + return nullptr; return view->textView(); } @@ -1220,7 +1220,7 @@ QUrl url = doc->url(); IProject* project = KDevelop::ICore::self()->projectController()->findProjectForUrl(url); if(project && project->versionControlPlugin()) { - IBasicVersionControl* iface = 0; + IBasicVersionControl* iface = nullptr; iface = project->versionControlPlugin()->extension(); auto helper = new VcsPluginHelper(project->versionControlPlugin(), iface); connect(doc->textDocument(), &KTextEditor::Document::aboutToClose, @@ -1233,7 +1233,7 @@ helper->annotation(); } else { - KMessageBox::error(0, i18n("Could not annotate the document because it is not " + KMessageBox::error(nullptr, i18n("Could not annotate the document because it is not " "part of a version-controlled project.")); } } diff --git a/shell/environmentconfigurebutton.cpp b/shell/environmentconfigurebutton.cpp --- a/shell/environmentconfigurebutton.cpp +++ b/shell/environmentconfigurebutton.cpp @@ -38,7 +38,7 @@ { public: EnvironmentConfigureButtonPrivate(EnvironmentConfigureButton* _q) - : q(_q), selectionWidget(0) + : q(_q), selectionWidget(nullptr) { } diff --git a/shell/languagecontroller.cpp b/shell/languagecontroller.cpp --- a/shell/languagecontroller.cpp +++ b/shell/languagecontroller.cpp @@ -210,7 +210,7 @@ QMutexLocker lock(&d->dataMutex); if(d->m_cleanedUp) - return 0; + return nullptr; if(d->languages.contains(name)) return d->languages[name]; diff --git a/shell/launchconfigurationdialog.cpp b/shell/launchconfigurationdialog.cpp --- a/shell/launchconfigurationdialog.cpp +++ b/shell/launchconfigurationdialog.cpp @@ -275,7 +275,7 @@ } } } - updateNameLabel(0); + updateNameLabel(nullptr); for( int i = 1; i < stack->count(); i++ ) { @@ -560,7 +560,7 @@ } } Q_ASSERT(false); - return 0; + return nullptr; } int LaunchConfigurationsModel::columnCount(const QModelIndex& parent) const @@ -797,7 +797,7 @@ return item->mode; } } - return 0; + return nullptr; } LaunchConfiguration* LaunchConfigurationsModel::configForIndex(const QModelIndex& idx ) const @@ -815,7 +815,7 @@ return dynamic_cast( lmitem->parent )->launch; } } - return 0; + return nullptr; } QModelIndex LaunchConfigurationsModel::indexForConfig( LaunchConfiguration* l ) const @@ -872,7 +872,7 @@ LaunchConfigurationType* type = Core::self()->runController()->launchConfigurationTypes().at(0); QPair launcher = qMakePair( type->launchers().at( 0 )->supportedModes().at(0), type->launchers().at( 0 )->id() ); - IProject* p = ( ti ? ti->project : 0 ); + IProject* p = ( ti ? ti->project : nullptr ); ILaunchConfiguration* l = Core::self()->runController()->createLaunchConfiguration( type, launcher, p ); addConfiguration(l, parent); @@ -900,7 +900,7 @@ return projectForIndex(idx.parent()); } else { const ProjectItem* item = dynamic_cast(topItems[idx.row()]); - return item ? item->project : 0; + return item ? item->project : nullptr; } } @@ -910,7 +910,7 @@ setLayout( new QVBoxLayout( this ) ); layout()->setContentsMargins( 0, 0, 0, 0 ); QWidget* parentwidget = this; - QTabWidget* tab = 0; + QTabWidget* tab = nullptr; if( factories.count() > 1 ) { tab = new QTabWidget( this ); diff --git a/shell/loadedpluginsdialog.cpp b/shell/loadedpluginsdialog.cpp --- a/shell/loadedpluginsdialog.cpp +++ b/shell/loadedpluginsdialog.cpp @@ -67,7 +67,7 @@ enum ExtraRoles { DescriptionRole = Qt::UserRole+1 }; - PluginsModel(QObject* parent = 0) + PluginsModel(QObject* parent = nullptr) : QAbstractListModel(parent) { m_plugins = KDevelop::Core::self()->pluginControllerInternal()->loadedPlugins(); @@ -76,10 +76,10 @@ KDevelop::IPlugin *pluginForIndex(const QModelIndex& index) const { - if (!index.isValid()) return 0; - if (index.parent().isValid()) return 0; - if (index.column() != 0) return 0; - if (index.row() >= m_plugins.count()) return 0; + if (!index.isValid()) return nullptr; + if (index.parent().isValid()) return nullptr; + if (index.column() != 0) return nullptr; + if (index.row() >= m_plugins.count()) return nullptr; return m_plugins[index.row()]; } @@ -119,7 +119,7 @@ public: - LoadedPluginsDelegate(QAbstractItemView *itemView, QObject *parent = 0) + LoadedPluginsDelegate(QAbstractItemView *itemView, QObject *parent = nullptr) : KWidgetItemDelegate(itemView, parent) , pushButton(new QPushButton) { @@ -160,7 +160,7 @@ painter->save(); - QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0); + QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, nullptr); int iconSize = option.rect.height() - MARGIN * 2; QIcon icon = QIcon::fromTheme(index.model()->data(index, Qt::DecorationRole).toString()); @@ -259,7 +259,7 @@ { Q_OBJECT public: - PluginsView(QWidget* parent = 0) + PluginsView(QWidget* parent = nullptr) :QListView(parent) { setModel(new PluginsModel()); diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp --- a/shell/mainwindow.cpp +++ b/shell/mainwindow.cpp @@ -180,7 +180,7 @@ QAction* MainWindow::createCustomElement(QWidget* parent, int index, const QDomElement& element) { - QAction* before = 0L; + QAction* before = nullptr; if (index > 0 && index < parent->actions().count()) before = parent->actions().at(index); diff --git a/shell/mainwindow_p.cpp b/shell/mainwindow_p.cpp --- a/shell/mainwindow_p.cpp +++ b/shell/mainwindow_p.cpp @@ -67,8 +67,8 @@ MainWindowPrivate::MainWindowPrivate(MainWindow *mainWindow) : QObject(mainWindow) , m_mainWindow(mainWindow) - , m_statusBar(0) - , lastXMLGUIClientView(0) + , m_statusBar(nullptr) + , lastXMLGUIClientView(nullptr) , m_changingActiveView(false) , m_kateWrapper(new KTextEditorIntegration::MainWindow(mainWindow)) { @@ -173,9 +173,9 @@ m_mainWindow->guiFactory()->removeClient(dynamic_cast(lastXMLGUIClientView)); - disconnect (lastXMLGUIClientView, &QWidget::destroyed, this, 0); + disconnect (lastXMLGUIClientView, &QWidget::destroyed, this, nullptr); - lastXMLGUIClientView = NULL; + lastXMLGUIClientView = nullptr; } if (!view) diff --git a/shell/openprojectdialog.cpp b/shell/openprojectdialog.cpp --- a/shell/openprojectdialog.cpp +++ b/shell/openprojectdialog.cpp @@ -100,7 +100,7 @@ QUrl start = startUrl.isValid() ? startUrl : Core::self()->projectController()->projectsBaseDirectory(); start = start.adjusted(QUrl::NormalizePathSegments); - KPageWidgetItem* currentPage = 0; + KPageWidgetItem* currentPage = nullptr; if( fetch ) { sourcePageWidget = new ProjectSourcePage( start, this ); diff --git a/shell/partcontroller.cpp b/shell/partcontroller.cpp --- a/shell/partcontroller.cpp +++ b/shell/partcontroller.cpp @@ -170,12 +170,12 @@ if ( !className.isEmpty() && editorFactory ) { return editorFactory->create( - 0, + nullptr, this, className.toLatin1() ); } - return 0; + return nullptr; } bool PartController::canCreatePart(const QUrl& url) @@ -203,7 +203,7 @@ //create a part for empty text file mimeType = QStringLiteral("text/plain"); else if ( !url.isValid() ) - return 0; + return nullptr; else mimeType = QMimeDatabase().mimeTypeForUrl(url).name(); @@ -214,7 +214,7 @@ return part; } - return 0; + return nullptr; } KParts::ReadOnlyPart* PartController::activeReadOnly() const @@ -287,14 +287,14 @@ if (textView) { return textView->textView(); } - return 0; + return nullptr; } KTextEditor::Document *PartController::createDocument() { // NOTE: not implemented qWarning() << "WARNING: interface call not implemented"; - return 0; + return nullptr; } bool PartController::closeDocument(KTextEditor::Document *doc) @@ -310,7 +310,7 @@ Q_UNUSED(doc) // NOTE: not implemented qWarning() << "WARNING: interface call not implemented"; - return 0; + return nullptr; } bool PartController::closeView(KTextEditor::View *view) diff --git a/shell/partdocument.cpp b/shell/partdocument.cpp --- a/shell/partdocument.cpp +++ b/shell/partdocument.cpp @@ -63,7 +63,7 @@ d->partForView[w] = part; return w; } - return 0; + return nullptr; } KParts::Part *PartDocument::partForView(QWidget *view) const @@ -83,7 +83,7 @@ KTextEditor::Document *PartDocument::textDocument() const { - return 0; + return nullptr; } bool PartDocument::isActive() const diff --git a/shell/plugincontroller.cpp b/shell/plugincontroller.cpp --- a/shell/plugincontroller.cpp +++ b/shell/plugincontroller.cpp @@ -585,7 +585,7 @@ { KPluginMetaData info = infoForPluginId( pluginId ); if ( !info.isValid() ) - return 0L; + return nullptr; return d->loadedPlugins.value( info ); } diff --git a/shell/progresswidget/overlaywidget.cpp b/shell/progresswidget/overlaywidget.cpp --- a/shell/progresswidget/overlaywidget.cpp +++ b/shell/progresswidget/overlaywidget.cpp @@ -38,7 +38,7 @@ using namespace KDevelop; OverlayWidget::OverlayWidget( QWidget* alignWidget, QWidget* parent, const char* name ) - : QWidget( parent, Qt::Window | Qt::FramelessWindowHint ), mAlignWidget( 0 ) + : QWidget( parent, Qt::Window | Qt::FramelessWindowHint ), mAlignWidget( nullptr ) { auto hboxHBoxLayout = new QHBoxLayout(this); hboxHBoxLayout->setMargin(0); diff --git a/shell/progresswidget/progressdialog.cpp b/shell/progresswidget/progressdialog.cpp --- a/shell/progresswidget/progressdialog.cpp +++ b/shell/progresswidget/progressdialog.cpp @@ -135,7 +135,7 @@ TransactionItem::TransactionItem( QWidget *parent, ProgressItem *item, bool first ) - : QWidget( parent ), mCancelButton( 0 ), mItem( item ) + : QWidget( parent ), mCancelButton( nullptr ), mItem( item ) { auto vbox = new QVBoxLayout(this); vbox->setSpacing( 2 ); diff --git a/shell/progresswidget/progressmanager.cpp b/shell/progresswidget/progressmanager.cpp --- a/shell/progresswidget/progressmanager.cpp +++ b/shell/progresswidget/progressmanager.cpp @@ -157,7 +157,7 @@ ProgressManager *ProgressManager::instance() { - return progressManagerPrivate.isDestroyed() ? 0 : &progressManagerPrivate->instance ; + return progressManagerPrivate.isDestroyed() ? nullptr : &progressManagerPrivate->instance ; } ProgressItem *ProgressManager::createProgressItemImpl( ProgressItem *parent, @@ -167,7 +167,7 @@ bool cancellable, bool usesCrypto ) { - ProgressItem *t = 0; + ProgressItem *t = nullptr; if ( !mTransactions.value( id ) ) { t = new ProgressItem ( parent, id, label, status, cancellable, usesCrypto ); mTransactions.insert( id, t ); @@ -234,18 +234,18 @@ ProgressItem *ProgressManager::singleItem() const { - ProgressItem *item = 0; + ProgressItem *item = nullptr; QHash< QString, ProgressItem* >::const_iterator it = mTransactions.constBegin(); QHash< QString, ProgressItem* >::const_iterator end = mTransactions.constEnd(); while ( it != end ) { // No single item for progress possible, as one of them is a busy indicator one. if ( (*it)->usesBusyIndicator() ) - return 0; + return nullptr; if ( !(*it)->parent() ) { // if it's a top level one, only those count if ( item ) { - return 0; // we found more than one + return nullptr; // we found more than one } else { item = (*it); } diff --git a/shell/progresswidget/statusbarprogresswidget.cpp b/shell/progresswidget/statusbarprogresswidget.cpp --- a/shell/progresswidget/statusbarprogresswidget.cpp +++ b/shell/progresswidget/statusbarprogresswidget.cpp @@ -58,8 +58,8 @@ //----------------------------------------------------------------------------- StatusbarProgressWidget::StatusbarProgressWidget( ProgressDialog* progressDialog, QWidget* parent, bool button ) - : QFrame( parent ), mCurrentItem( 0 ), mProgressDialog( progressDialog ), - mDelayTimer( 0 ), mCleanTimer( 0 ) + : QFrame( parent ), mCurrentItem( nullptr ), mProgressDialog( progressDialog ), + mDelayTimer( nullptr ), mCleanTimer( nullptr ) { m_bShowButton = button; int w = fontMetrics().width( QStringLiteral(" 999.9 kB/s 00:00:01 ") ) + 8; @@ -150,11 +150,11 @@ { if ( item->parent() ) { item->deleteLater(); - item = 0; + item = nullptr; return; // we are only interested in top level items } item->deleteLater(); - item = 0; + item = nullptr; connectSingleItem(); // if going back to 1 item if ( ProgressManager::instance()->isEmpty() ) { // No item // Done. In 5s the progress-widget will close, then we can clean up the statusbar @@ -169,7 +169,7 @@ if ( mCurrentItem ) { disconnect ( mCurrentItem, &ProgressItem::progressItemProgress, this, &StatusbarProgressWidget::slotProgressItemProgress ); - mCurrentItem = 0; + mCurrentItem = nullptr; } mCurrentItem = ProgressManager::instance()->singleItem(); if ( mCurrentItem ) { diff --git a/shell/project.cpp b/shell/project.cpp --- a/shell/project.cpp +++ b/shell/project.cpp @@ -323,7 +323,7 @@ { if (manager) { - IProjectFileManager* iface = 0; + IProjectFileManager* iface = nullptr; iface = manager->extension(); Q_ASSERT(iface); return iface; @@ -335,7 +335,7 @@ //Get our importer IPluginController* pluginManager = Core::self()->pluginController(); manager = pluginManager->pluginForExtension( QStringLiteral("org.kdevelop.IProjectFileManager"), managerSetting ); - IProjectFileManager* iface = 0; + IProjectFileManager* iface = nullptr; if ( manager ) iface = manager->extension(); else @@ -344,15 +344,15 @@ i18n( "Could not load project management plugin %1.
Check that the required programs are installed," " or see console output for more information.", managerSetting ) ); - manager = 0; - return 0; + manager = nullptr; + return nullptr; } - if (iface == 0) + if (iface == nullptr) { KMessageBox::sorry( Core::self()->uiControllerInternal()->defaultMainWindow(), i18n( "project importing plugin (%1) does not support the IProjectFileManager interface.", managerSetting ) ); delete manager; - manager = 0; + manager = nullptr; } return iface; } @@ -411,8 +411,8 @@ QDBusConnection::sessionBus().registerObject( QStringLiteral("/org/kdevelop/Project"), this, QDBusConnection::ExportScriptableSlots ); d->project = this; - d->manager = 0; - d->topItem = 0; + d->manager = nullptr; + d->topItem = nullptr; d->loading = false; d->scheduleReload = false; d->progress = new ProjectProgress; @@ -462,7 +462,7 @@ // delete topItem and remove it from model ProjectModel* model = Core::self()->projectController()->projectModel(); model->removeRow( d->topItem->row() ); - d->topItem = 0; + d->topItem = nullptr; IProjectFileManager* iface = d->manager->extension(); if (!d->importTopItem(iface)) diff --git a/shell/projectcontroller.cpp b/shell/projectcontroller.cpp --- a/shell/projectcontroller.cpp +++ b/shell/projectcontroller.cpp @@ -110,7 +110,7 @@ QHash< IProject*, QPointer > m_parseJobs; // parse jobs that add files from the project to the background parser. ProjectControllerPrivate( ProjectController* p ) - : m_core(0), model(0), selectionModel(0), dialog(0), q(p), buildset(0), m_foundProjectFile(false), m_cleaningUp(false) + : m_core(nullptr), model(nullptr), selectionModel(nullptr), dialog(nullptr), q(p), buildset(nullptr), m_foundProjectFile(false), m_cleaningUp(false) { } @@ -650,7 +650,7 @@ { if( !d->m_projects.isEmpty() && num >= 0 && num < d->m_projects.count() ) return d->m_projects.at( num ); - return 0; + return nullptr; } QList ProjectController::projects() const @@ -954,14 +954,14 @@ IProject* ProjectController::findProjectForUrl( const QUrl& url ) const { if (d->m_projects.isEmpty()) { - return 0; + return nullptr; } ProjectBaseItem* item = d->model->itemForPath(IndexedString(url)); if (item) { return item->project(); } - return 0; + return nullptr; } IProject* ProjectController::findProjectByName( const QString& name ) @@ -973,7 +973,7 @@ return proj; } } - return 0; + return nullptr; } @@ -1136,7 +1136,7 @@ QString ProjectController::mapSourceBuild( const QString& path_, bool reverse, bool fallbackRoot ) const { Path path(path_); - IProject* sourceDirProject = 0, *buildDirProject = 0; + IProject* sourceDirProject = nullptr, *buildDirProject = nullptr; Q_FOREACH(IProject* proj, d->m_projects) { if(proj->path().isParentOf(path) || proj->path() == path) diff --git a/shell/projectsourcepage.cpp b/shell/projectsourcepage.cpp --- a/shell/projectsourcepage.cpp +++ b/shell/projectsourcepage.cpp @@ -44,7 +44,7 @@ m_ui->remoteWidget->setLayout(new QVBoxLayout(m_ui->remoteWidget)); m_ui->sources->addItem(QIcon::fromTheme(QStringLiteral("folder")), i18n("From File System")); - m_plugins.append(0); + m_plugins.append(nullptr); IPluginController* pluginManager = ICore::self()->pluginController(); QList plugins = pluginManager->allPluginsForExtension( QStringLiteral("org.kdevelop.IBasicVersionControl") ); @@ -80,11 +80,11 @@ void ProjectSourcePage::setSourceIndex(int index) { - m_locationWidget = 0; - m_providerWidget = 0; + m_locationWidget = nullptr; + m_providerWidget = nullptr; QLayout* remoteWidgetLayout = m_ui->remoteWidget->layout(); QLayoutItem *child; - while ((child = remoteWidgetLayout->takeAt(0)) != 0) { + while ((child = remoteWidgetLayout->takeAt(0)) != nullptr) { delete child->widget(); delete child; } @@ -117,7 +117,7 @@ { IPlugin* p = m_plugins.value(index); if(!p) - return 0; + return nullptr; else return p->extension(); } @@ -126,7 +126,7 @@ { IPlugin* p = m_plugins.value(index); if(!p) - return 0; + return nullptr; else return p->extension(); } @@ -135,7 +135,7 @@ { QUrl url=m_ui->workingDir->url(); IPlugin* p=m_plugins[m_ui->sources->currentIndex()]; - VcsJob* job=0; + VcsJob* job=nullptr; if(IBasicVersionControl* iface=p->extension()) { Q_ASSERT(iface && m_locationWidget); @@ -153,7 +153,7 @@ if(!url.isLocalFile() && !d.exists()) { bool corr = d.mkpath(d.path()); if(!corr) { - KMessageBox::error(0, i18n("Could not create the directory: %1", d.path())); + KMessageBox::error(nullptr, i18n("Could not create the directory: %1", d.path())); return; } } diff --git a/shell/runcontroller.cpp b/shell/runcontroller.cpp --- a/shell/runcontroller.cpp +++ b/shell/runcontroller.cpp @@ -200,7 +200,7 @@ //qCDebug(SHELL) << "got mode and type:" << type << type->id() << mode << mode->id(); if( type && mode ) { - ILauncher* launcher = 0; + ILauncher* launcher = nullptr; foreach (ILauncher *l, type->launchers()) { //qCDebug(SHELL) << "available launcher" << l << l->id() << l->supportedModes(); @@ -212,7 +212,7 @@ if (launcher) { QStringList itemPath = Core::self()->projectController()->projectModel()->pathFromIndex(contextItem->index()); - ILaunchConfiguration* ilaunch = 0; + ILaunchConfiguration* ilaunch = nullptr; foreach (LaunchConfiguration *l, launchConfigurations) { QStringList path = l->config().readEntry(Strings::ConfiguredFromProjectItemEntry(), QStringList()); if (l->type() == type && path == itemPath) { @@ -247,7 +247,7 @@ QString currentLaunchProject = launchGrp.readEntry( Strings::CurrentLaunchConfigProjectEntry(), "" ); QString currentLaunchName = launchGrp.readEntry( Strings::CurrentLaunchConfigNameEntry(), "" ); - LaunchConfiguration* l = 0; + LaunchConfiguration* l = nullptr; if( currentTargetAction->currentAction() ) { l = static_cast( currentTargetAction->currentAction()->data().value() ); @@ -311,7 +311,7 @@ { qWarning() << "couldn't find type for id:" << id << ". Known types:" << launchConfigurationTypes.keys(); } - return 0; + return nullptr; } @@ -329,16 +329,16 @@ // TODO: need to implement compile only if needed before execute // TODO: need to implement abort all running programs when project closed - d->currentTargetAction = 0; + d->currentTargetAction = nullptr; d->state = Idle; d->q = this; d->delegate = new RunDelegate(this); d->launchChangeMapper = new QSignalMapper( this ); - d->launchAsMapper = 0; - d->contextItem = 0; - d->executeMode = 0; - d->debugMode = 0; - d->profileMode = 0; + d->launchAsMapper = nullptr; + d->contextItem = nullptr; + d->executeMode = nullptr; + d->debugMode = nullptr; + d->profileMode = nullptr; d->unityLauncher = new UnityLauncher(this); d->unityLauncher->setLauncherId(KAboutData::applicationData().desktopFileName()); @@ -369,11 +369,11 @@ void RunController::cleanup() { delete d->executeMode; - d->executeMode = 0; + d->executeMode = nullptr; delete d->profileMode; - d->profileMode = 0; + d->profileMode = nullptr; delete d->debugMode; - d->debugMode = 0; + d->debugMode = nullptr; stopAllProcesses(); d->saveCurrentLaunchAction(); @@ -387,7 +387,7 @@ addLaunchMode( d->profileMode ); d->debugMode = new DebugMode; addLaunchMode( d->debugMode ); - d->readLaunchConfigs( Core::self()->activeSession()->config(), 0 ); + d->readLaunchConfigs( Core::self()->activeSession()->config(), nullptr ); foreach (IProject* project, Core::self()->projectController()->projects()) { slotProjectOpened(project); @@ -411,7 +411,7 @@ if( !launch ) { qCDebug(SHELL) << "execute called without launch config!"; - return 0; + return nullptr; } LaunchConfiguration *run = dynamic_cast(launch); //TODO: Port to launch framework, probably needs to be part of the launcher @@ -434,7 +434,7 @@ qApp->activeWindow(), i18n("The current launch configuration does not support the '%1' mode.", runMode), QLatin1String("")); - return 0; + return nullptr; } KJob* launchJob = launcher->start(runMode, run); @@ -583,7 +583,7 @@ QAction* projectAction = d->currentTargetAction->currentAction(); if( projectAction ) return static_cast(qvariant_cast(projectAction->data())); - return 0; + return nullptr; } void KDevelop::RunController::registerJob(KJob * job) @@ -597,7 +597,7 @@ } if (!d->jobs.contains(job)) { - QAction* stopJobAction = 0; + QAction* stopJobAction = nullptr; if (Core::self()->setupFlags() != Core::NoUi) { stopJobAction = new QAction(job->objectName().isEmpty() ? i18n("<%1> Unnamed job", job->staticMetaObject.className()) : job->objectName(), this); stopJobAction->setData(QVariant::fromValue(static_cast(job))); @@ -725,7 +725,7 @@ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, dialog); KMessageBox::createKMessageBox(dialog, buttonBox, QMessageBox::Warning, job->errorString(), QStringList(), - QString(), 0, KMessageBox::NoExec); + QString(), nullptr, KMessageBox::NoExec); dialog->show(); } } @@ -827,7 +827,7 @@ { return it.value(); } - return 0; + return nullptr; } void KDevelop::RunController::addLaunchConfiguration(KDevelop::LaunchConfiguration* l) @@ -980,7 +980,7 @@ d->launchAsMapper = new QSignalMapper( this ); connect( d->launchAsMapper, static_cast(&QSignalMapper::mapped), this, [&] (int id) { d->launchAs(id); } ); d->launchAsInfo.clear(); - d->contextItem = 0; + d->contextItem = nullptr; ContextMenuExtension ext; if( ctx->type() == Context::ProjectItemContext ) { KDevelop::ProjectItemContext* prjctx = dynamic_cast( ctx ); diff --git a/shell/session.cpp b/shell/session.cpp --- a/shell/session.cpp +++ b/shell/session.cpp @@ -158,7 +158,7 @@ projectNames.reserve( info.projects.size() ); foreach( const QUrl& url, info.projects ) { - IProject* project = 0; + IProject* project = nullptr; if( ICore::self() && ICore::self()->projectController() ) { project = ICore::self()->projectController()->findProjectForUrl( url ); } diff --git a/shell/sessioncontroller.cpp b/shell/sessioncontroller.cpp --- a/shell/sessioncontroller.cpp +++ b/shell/sessioncontroller.cpp @@ -65,7 +65,7 @@ namespace { int argc = 0; - char** argv = 0; + char** argv = nullptr; }; void SessionController::setArguments(int _argc, char** _argv) @@ -96,8 +96,8 @@ public: SessionControllerPrivate( SessionController* s ) : q(s) - , activeSession(0) - , grp(0) + , activeSession(nullptr) + , grp(nullptr) { } @@ -111,7 +111,7 @@ if( s->name() == name ) return s; } - return 0; + return nullptr; } Session* findSessionForId(QString idString) @@ -123,7 +123,7 @@ if( s->id() == id) return s; } - return 0; + return nullptr; } void newSession() @@ -178,7 +178,7 @@ activeSession = s; TryLockSessionResult result = SessionController::tryLockSession( s->id().toString()); if( !result.lock ) { - activeSession = 0; + activeSession = nullptr; return result; } Q_ASSERT(s->id().toString() == result.lock->id()); @@ -212,7 +212,7 @@ void addSession( Session* s ) { if (Core::self()->setupFlags() & Core::NoUi) { - sessionActions[s] = 0; + sessionActions[s] = nullptr; return; } @@ -309,7 +309,7 @@ if (d->activeSession->isTemporary()) { deleteSessionFromDisk(d->sessionLock); } - d->activeSession = 0; + d->activeSession = nullptr; } d->sessionLock.clear(); @@ -442,7 +442,7 @@ // Iteratively try to load the session, asking user what to do in case of failure // If showForceOpenDialog() returns empty string, stop trying - Session* s = 0; + Session* s = nullptr; do { s = this->session( load ); diff --git a/shell/sessionlock.cpp b/shell/sessionlock.cpp --- a/shell/sessionlock.cpp +++ b/shell/sessionlock.cpp @@ -202,7 +202,7 @@ choose.setText(i18nc("@action:button", "Choose another session")); KGuiItem cancel = KStandardGuiItem::quit(); - int ret = KMessageBox::warningYesNoCancel(0, errmsg, i18nc("@title:window", "Failed to Lock Session %1", sessionName), + int ret = KMessageBox::warningYesNoCancel(nullptr, errmsg, i18nc("@title:window", "Failed to Lock Session %1", sessionName), retry, choose, cancel); switch( ret ) { case KMessageBox::Yes: diff --git a/shell/settings/sourceformattersettings.cpp b/shell/settings/sourceformattersettings.cpp --- a/shell/settings/sourceformattersettings.cpp +++ b/shell/settings/sourceformattersettings.cpp @@ -59,7 +59,7 @@ } LanguageSettings::LanguageSettings() - : selectedFormatter(0), selectedStyle(0) { + : selectedFormatter(nullptr), selectedStyle(nullptr) { } SourceFormatterSettings::SourceFormatterSettings(QWidget* parent) @@ -326,7 +326,7 @@ Q_ASSERT( l.formatters.contains(formatterIter.value()) ); if (l.selectedFormatter != formatterIter.value()) { l.selectedFormatter = formatterIter.value(); - l.selectedStyle = 0; // will hold 0 until a style is picked + l.selectedStyle = nullptr; // will hold 0 until a style is picked } foreach( const SourceFormatterStyle* style, formatterIter.value()->styles ) { if ( ! style->supportsLanguage(cbLanguages->currentText())) { @@ -338,7 +338,7 @@ styleList->setCurrentItem(item); } } - if (l.selectedStyle == 0) { + if (l.selectedStyle == nullptr) { styleList->setCurrentRow(0); } enableStyleButtons(); @@ -402,7 +402,7 @@ SourceFormatter* fmt = l.selectedFormatter; QMimeType mimetype = l.mimetypes.first(); - if( fmt->formatter->editStyleWidget( mimetype ) != 0 ) { + if( fmt->formatter->editStyleWidget( mimetype ) != nullptr ) { EditStyleDialog dlg( fmt->formatter, mimetype, *l.selectedStyle, this ); if( dlg.exec() == QDialog::Accepted ) { diff --git a/shell/shellextension.cpp b/shell/shellextension.cpp --- a/shell/shellextension.cpp +++ b/shell/shellextension.cpp @@ -20,7 +20,7 @@ namespace KDevelop { -ShellExtension *ShellExtension::s_instance = 0; +ShellExtension *ShellExtension::s_instance = nullptr; ShellExtension::ShellExtension() { diff --git a/shell/sourceformattercontroller.cpp b/shell/sourceformattercontroller.cpp --- a/shell/sourceformattercontroller.cpp +++ b/shell/sourceformattercontroller.cpp @@ -188,8 +188,8 @@ return iformatter; } } - knownFormatters[mime.name()] = 0; - return 0; + knownFormatters[mime.name()] = nullptr; + return nullptr; } static void populateStyleFromConfigGroup(SourceFormatterStyle* s, const KConfigGroup& stylegrp) @@ -225,7 +225,7 @@ ISourceFormatter* SourceFormatterController::formatterForMimeType(const QMimeType& mime) { if( !m_enabled || !isMimeTypeSupported( mime ) ) { - return 0; + return nullptr; } QString formatter = sessionConfig().readEntry( mime.name(), QString() ); @@ -238,7 +238,7 @@ if( formatterinfo.size() != 2 ) { qCDebug(SHELL) << "Broken formatting entry for mime:" << mime.name() << "current value:" << formatter; - return 0; + return nullptr; } return Core::self()->pluginControllerInternal()->extensionForPlugin( QStringLiteral("org.kdevelop.ISourceFormatter"), formatterinfo.at(0) ); @@ -581,9 +581,9 @@ data += addModelineForCurrentLang(output, list[fileCount], mime).toUtf8(); job = KIO::storedPut(data, list[fileCount], -1); if (!job->exec()) - KMessageBox::error(0, job->errorString()); + KMessageBox::error(nullptr, job->errorString()); } else - KMessageBox::error(0, job->errorString()); + KMessageBox::error(nullptr, job->errorString()); } } diff --git a/shell/statusbar.cpp b/shell/statusbar.cpp --- a/shell/statusbar.cpp +++ b/shell/statusbar.cpp @@ -45,7 +45,7 @@ StatusBar::StatusBar(QWidget* parent) : QStatusBar(parent) , m_timer(new QTimer(this)) - , m_currentView(0) + , m_currentView(nullptr) , m_errorRemovalMapper(new QSignalMapper(this)) { #ifdef Q_OS_MAC diff --git a/shell/testcontroller.cpp b/shell/testcontroller.cpp --- a/shell/testcontroller.cpp +++ b/shell/testcontroller.cpp @@ -88,7 +88,7 @@ return suite; } } - return 0; + return nullptr; } diff --git a/shell/tests/test_documentcontroller.cpp b/shell/tests/test_documentcontroller.cpp --- a/shell/tests/test_documentcontroller.cpp +++ b/shell/tests/test_documentcontroller.cpp @@ -59,8 +59,8 @@ // pre-conditions QVERIFY(m_subject->openDocuments().empty()); - QVERIFY(m_subject->documentForUrl(QUrl()) == 0); - QVERIFY(m_subject->activeDocument() == 0); + QVERIFY(m_subject->documentForUrl(QUrl()) == nullptr); + QVERIFY(m_subject->activeDocument() == nullptr); } void TestDocumentController::cleanup() @@ -88,7 +88,7 @@ QVERIFY(openedSpy.isValid()); IDocument* document = m_subject->openDocumentFromText(QLatin1String("")); - QVERIFY(document != 0); + QVERIFY(document != nullptr); QCOMPARE(createdSpy.count(), 1); QCOMPARE(openedSpy.count(), 1); @@ -102,7 +102,7 @@ { QUrl url = QUrl::fromLocalFile(m_file1.fileName()); IDocument* document = m_subject->openDocument(url); - QVERIFY(document != 0); + QVERIFY(document != nullptr); } void TestDocumentController::testSaveSomeDocuments() diff --git a/shell/tests/test_projectcontroller.cpp b/shell/tests/test_projectcontroller.cpp --- a/shell/tests/test_projectcontroller.cpp +++ b/shell/tests/test_projectcontroller.cpp @@ -126,8 +126,8 @@ return it; } - ProjectFolderItem* addFolder(const Path& /*folder*/, ProjectFolderItem */*parent*/) override { return 0; } - ProjectFileItem* addFile(const Path& /*file*/, ProjectFolderItem */*parent*/) override { return 0; } + ProjectFolderItem* addFolder(const Path& /*folder*/, ProjectFolderItem */*parent*/) override { return nullptr; } + ProjectFileItem* addFile(const Path& /*file*/, ProjectFolderItem */*parent*/) override { return nullptr; } bool removeFilesAndFolders(const QList &/*items*/) override { return false; } bool moveFilesAndFolders(const QList< KDevelop::ProjectBaseItem* > &/*items*/, KDevelop::ProjectFolderItem* /*newParent*/) override { return false; } bool copyFilesAndFolders(const Path::List &/*items*/, KDevelop::ProjectFolderItem* /*newParent*/) override { return false; } @@ -535,7 +535,7 @@ void TestProjectController::assertProjectClosed(IProject* proj) { IProject* p = m_projCtrl->findProjectByName(proj->name()); - QVERIFY(p == 0); + QVERIFY(p == nullptr); QVERIFY(!m_projCtrl->projects().contains(proj)); } diff --git a/shell/tests/test_shellbuddy.cpp b/shell/tests/test_shellbuddy.cpp --- a/shell/tests/test_shellbuddy.cpp +++ b/shell/tests/test_shellbuddy.cpp @@ -97,7 +97,7 @@ { KDevelop::IBuddyDocumentFinder::removeFinder(QStringLiteral("text/plain")); delete m_finder; - m_finder = 0; + m_finder = nullptr; TestCore::shutdown(); } diff --git a/shell/tests/test_shelldocumentoperation.cpp b/shell/tests/test_shelldocumentoperation.cpp --- a/shell/tests/test_shelldocumentoperation.cpp +++ b/shell/tests/test_shelldocumentoperation.cpp @@ -81,8 +81,8 @@ QPointer the_view = area->views().at(0); QPointer the_widget = the_view->widget(); documentController->openDocuments().at(0)->close(IDocument::Discard); - QCOMPARE(the_view.data(), (Sublime::View*)0); - QCOMPARE(the_widget.data(), (QWidget*)0); + QCOMPARE(the_view.data(), (Sublime::View*)nullptr); + QCOMPARE(the_widget.data(), (QWidget*)nullptr); } // Now try the same, where there are two open documents. @@ -101,8 +101,8 @@ << " " << area->views().at(1); QPointer the_widget = the_view->widget(); doc2->close(IDocument::Discard); - QCOMPARE(the_view.data(), (Sublime::View*)0); - QCOMPARE(the_widget.data(), (QWidget*)0); + QCOMPARE(the_view.data(), (Sublime::View*)nullptr); + QCOMPARE(the_widget.data(), (QWidget*)nullptr); doc1->close(IDocument::Discard); } } diff --git a/shell/tests/test_testcontroller.cpp b/shell/tests/test_testcontroller.cpp --- a/shell/tests/test_testcontroller.cpp +++ b/shell/tests/test_testcontroller.cpp @@ -77,21 +77,21 @@ KJob* FakeTestSuite::launchAllCases(ITestSuite::TestJobVerbosity verbosity) { Q_UNUSED(verbosity); - return 0; + return nullptr; } KJob* FakeTestSuite::launchCase(const QString& testCase, ITestSuite::TestJobVerbosity verbosity) { Q_UNUSED(testCase); Q_UNUSED(verbosity); - return 0; + return nullptr; } KJob* FakeTestSuite::launchCases(const QStringList& testCases, ITestSuite::TestJobVerbosity verbosity) { Q_UNUSED(testCases); Q_UNUSED(verbosity); - return 0; + return nullptr; } void TestTestController::emitTestResult(ITestSuite* suite, TestResult::TestCaseResult caseResult) @@ -146,7 +146,7 @@ QVERIFY(m_testController->findTestSuite(m_project, TestSuiteName)); m_testController->removeTestSuite(&suite); - QCOMPARE(m_testController->findTestSuite(m_project, TestSuiteName), (ITestSuite*)0); + QCOMPARE(m_testController->findTestSuite(m_project, TestSuiteName), (ITestSuite*)nullptr); QVERIFY(m_testController->testSuites().isEmpty()); } diff --git a/shell/textdocument.cpp b/shell/textdocument.cpp --- a/shell/textdocument.cpp +++ b/shell/textdocument.cpp @@ -84,14 +84,14 @@ struct TextDocumentPrivate { TextDocumentPrivate(TextDocument *textDocument) : document(nullptr), state(IDocument::Clean), encoding(), q(textDocument) - , m_loaded(false), m_addedContextMenu(0) + , m_loaded(false), m_addedContextMenu(nullptr) { } ~TextDocumentPrivate() { delete m_addedContextMenu; - m_addedContextMenu = 0; + m_addedContextMenu = nullptr; saveSessionConfig(); delete document; @@ -175,7 +175,7 @@ // Determines whether the current contents of this document in the editor // could be retrieved from the VCS if they were dismissed. void queryCanRecreateFromVcs(KTextEditor::Document* document) const { - IProject* project = 0; + IProject* project = nullptr; // Find projects by checking which one contains the file's parent directory, // to avoid issues with the cmake manager temporarily removing files from a project // during reloading. @@ -279,7 +279,7 @@ QWidget *TextDocument::createViewWidget(QWidget *parent) { - KTextEditor::View* view = 0L; + KTextEditor::View* view = nullptr; if (!d->document) { @@ -295,7 +295,7 @@ this, [] (KTextEditor::Document* document) { ICore::self()->languageController()->backgroundParser()->addDocument(IndexedString(document->url()), (TopDUContext::Features) ( TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::ForceUpdate ), - BackgroundParser::BestPriority, 0); + BackgroundParser::BestPriority, nullptr); }); // Set encoding passed via constructor @@ -368,7 +368,7 @@ { if (d->document && d->document->views().contains((KTextEditor::View*)view)) return d->document; - return 0; + return nullptr; } @@ -380,7 +380,7 @@ if (!d->document) return; - KTextEditor::ModificationInterface* modif=0; + KTextEditor::ModificationInterface* modif=nullptr; if(d->state==Dirty) { modif = qobject_cast(d->document); modif->setModifiedOnDiskWarning(false); diff --git a/shell/uicontroller.cpp b/shell/uicontroller.cpp --- a/shell/uicontroller.cpp +++ b/shell/uicontroller.cpp @@ -120,7 +120,7 @@ } else { - activeSublimeWindow = defaultMainWindow = 0; + activeSublimeWindow = defaultMainWindow = nullptr; } m_assistantTimer.setSingleShot(true); @@ -159,7 +159,7 @@ public: UiToolViewFactory(IToolViewFactory *factory): m_factory(factory) {} ~UiToolViewFactory() override { delete m_factory; } - QWidget* create(Sublime::ToolDocument *doc, QWidget *parent = 0) override + QWidget* create(Sublime::ToolDocument *doc, QWidget *parent = nullptr) override { Q_UNUSED( doc ); return m_factory->create(parent); @@ -183,7 +183,7 @@ class ViewSelectorItem: public QListWidgetItem { public: - ViewSelectorItem(const QString &text, QListWidget *parent = 0, int type = Type) + ViewSelectorItem(const QString &text, QListWidget *parent = nullptr, int type = Type) :QListWidgetItem(text, parent, type) {} IToolViewFactory *factory; }; @@ -193,7 +193,7 @@ Q_OBJECT public: - NewToolViewListWidget(MainWindow *mw, QWidget* parent = 0) + NewToolViewListWidget(MainWindow *mw, QWidget* parent = nullptr) :QListWidget(parent), m_mw(mw) { connect(this, &NewToolViewListWidget::doubleClicked, this, &NewToolViewListWidget::addNewToolViewByDoubleClick); @@ -216,7 +216,7 @@ }; UiController::UiController(Core *core) - :Sublime::Controller(0), IUiController(), d(new UiControllerPrivate(this)) + :Sublime::Controller(nullptr), IUiController(), d(new UiControllerPrivate(this)) { setObjectName(QStringLiteral("UiController")); d->core = core; @@ -278,7 +278,7 @@ QWidget* UiController::findToolView(const QString& name, IToolViewFactory *factory, FindFlags flags) { if(!d->areasRestored || !activeArea()) - return 0; + return nullptr; QList< Sublime::View* > views = activeArea()->toolViews(); foreach(Sublime::View* view, views) { @@ -290,7 +290,7 @@ } } - QWidget* ret = 0; + QWidget* ret = nullptr; if(flags & Create) { @@ -406,7 +406,7 @@ Sublime::MainWindow *m = activeSublimeWindow(); if (m) return activeSublimeWindow()->area(); - return 0; + return nullptr; } Sublime::MainWindow *UiController::activeSublimeWindow() diff --git a/shell/watcheddocumentset.cpp b/shell/watcheddocumentset.cpp --- a/shell/watcheddocumentset.cpp +++ b/shell/watcheddocumentset.cpp @@ -137,7 +137,7 @@ } CurrentProjectSet::CurrentProjectSet(const IndexedString& document, QObject *parent) - : ProjectSet(parent), m_currentProject(0) + : ProjectSet(parent), m_currentProject(nullptr) { setCurrentDocumentInternal(document); trackProjectFiles(m_currentProject); diff --git a/shell/workingsetcontroller.cpp b/shell/workingsetcontroller.cpp --- a/shell/workingsetcontroller.cpp +++ b/shell/workingsetcontroller.cpp @@ -45,7 +45,7 @@ const int toolTipTimeout = 2000; WorkingSetController::WorkingSetController() - : m_emptyWorkingSet(0), m_changingWorkingSet(false) + : m_emptyWorkingSet(nullptr), m_changingWorkingSet(false) { m_hideToolTipTimer = new QTimer(this); m_hideToolTipTimer->setInterval(toolTipTimeout); @@ -95,7 +95,7 @@ m_workingSets.clear(); delete m_emptyWorkingSet; - m_emptyWorkingSet = 0; + m_emptyWorkingSet = nullptr; } const QString WorkingSetController::makeSetId(const QString& prefix) const diff --git a/shell/workingsets/closedworkingsetswidget.cpp b/shell/workingsets/closedworkingsetswidget.cpp --- a/shell/workingsets/closedworkingsetswidget.cpp +++ b/shell/workingsets/closedworkingsetswidget.cpp @@ -40,7 +40,7 @@ } ClosedWorkingSetsWidget::ClosedWorkingSetsWidget( MainWindow* window ) - : QWidget(0), m_mainWindow(window) + : QWidget(nullptr), m_mainWindow(window) { connect(window, &MainWindow::areaChanged, this, &ClosedWorkingSetsWidget::areaChanged); diff --git a/shell/workingsets/workingset.cpp b/shell/workingsets/workingset.cpp --- a/shell/workingsets/workingset.cpp +++ b/shell/workingsets/workingset.cpp @@ -256,7 +256,7 @@ qCDebug(SHELL) << "deleting " << recycle.size() << " old views"; qDeleteAll( recycle ); - area->setActiveView(0); + area->setActiveView(nullptr); //activate view in the working set /// @todo correctly select one out of multiple equal views @@ -316,7 +316,7 @@ if (specifier.isEmpty()) { continue; } - Sublime::View* previousView = area->views().empty() ? 0 : area->views().at(area->views().size() - 1); + Sublime::View* previousView = area->views().empty() ? nullptr : area->views().at(area->views().size() - 1); QMultiMap::iterator it = recycle.find( specifier ); if( it != recycle.end() ) diff --git a/shell/workingsets/workingsettooltipwidget.cpp b/shell/workingsets/workingsettooltipwidget.cpp --- a/shell/workingsets/workingsettooltipwidget.cpp +++ b/shell/workingsets/workingsettooltipwidget.cpp @@ -261,7 +261,7 @@ if(mainWindow->area()->activeView()) activeFile = mainWindow->area()->activeView()->document()->documentSpecifier(); - WorkingSet* currentWorkingSet = 0; + WorkingSet* currentWorkingSet = nullptr; QSet openFiles; if(!mainWindow->area()->workingSet().isEmpty()) diff --git a/shell/workingsets/workingsetwidget.cpp b/shell/workingsets/workingsetwidget.cpp --- a/shell/workingsets/workingsetwidget.cpp +++ b/shell/workingsets/workingsetwidget.cpp @@ -33,14 +33,14 @@ WorkingSet* getSet(const QString& id) { if (id.isEmpty()) { - return 0; + return nullptr; } return Core::self()->workingSetControllerInternal()->getWorkingSet(id); } WorkingSetWidget::WorkingSetWidget(Sublime::Area* area, QWidget* parent) - : WorkingSetToolButton(parent, 0) + : WorkingSetToolButton(parent, nullptr) , m_area(area) { //Queued connect so the change is already applied to the area when we start processing diff --git a/sublime/aggregatemodel.cpp b/sublime/aggregatemodel.cpp --- a/sublime/aggregatemodel.cpp +++ b/sublime/aggregatemodel.cpp @@ -81,7 +81,7 @@ Qt::ItemFlags AggregateModel::flags(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return nullptr; return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } diff --git a/sublime/area.cpp b/sublime/area.cpp --- a/sublime/area.cpp +++ b/sublime/area.cpp @@ -61,7 +61,7 @@ } struct ViewFinder { - ViewFinder(View *_view): view(_view), index(0) {} + ViewFinder(View *_view): view(_view), index(nullptr) {} Area::WalkerMode operator() (AreaIndex *idx) { if (idx->hasView(view)) { @@ -243,7 +243,7 @@ View* Area::removeToolView(View *view) { if (!d->toolViews.contains(view)) - return 0; + return nullptr; emit aboutToRemoveToolView(view, d->toolViewPositions[view]); QString id = view->document()->documentSpecifier(); diff --git a/sublime/areaindex.cpp b/sublime/areaindex.cpp --- a/sublime/areaindex.cpp +++ b/sublime/areaindex.cpp @@ -30,7 +30,7 @@ struct AreaIndexPrivate { AreaIndexPrivate() - :parent(0), first(0), second(0), orientation(Qt::Horizontal) + :parent(nullptr), first(nullptr), second(nullptr), orientation(Qt::Horizontal) { } ~AreaIndexPrivate() @@ -45,10 +45,10 @@ } AreaIndexPrivate(const AreaIndexPrivate &p) { - parent = 0; + parent = nullptr; orientation = p.orientation; - first = p.first ? new AreaIndex(*(p.first)) : 0; - second = p.second ? new AreaIndex(*(p.second)) : 0; + first = p.first ? new AreaIndex(*(p.first)) : nullptr; + second = p.second ? new AreaIndex(*(p.second)) : nullptr; } bool isSplit() const @@ -149,8 +149,8 @@ AreaIndex *other = d->first == childToRemove ? d->second : d->first; other->moveViewsTo(this); d->orientation = other->orientation(); - d->first = 0; - d->second = 0; + d->first = nullptr; + d->second = nullptr; other->copyChildrenTo(this); delete other; @@ -166,8 +166,8 @@ target->d->first->setParent(target); target->d->second->setParent(target); - d->first = 0; - d->second = 0; + d->first = nullptr; + d->second = nullptr; } void AreaIndex::moveViewsTo(AreaIndex *target) @@ -183,7 +183,7 @@ View *AreaIndex::viewAt(int position) const { - return d->views.value(position, 0); + return d->views.value(position, nullptr); } int AreaIndex::viewCount() const @@ -234,7 +234,7 @@ // class RootAreaIndex RootAreaIndex::RootAreaIndex() - :AreaIndex(), d(0) + :AreaIndex(), d(nullptr) { } diff --git a/sublime/container.cpp b/sublime/container.cpp --- a/sublime/container.cpp +++ b/sublime/container.cpp @@ -188,7 +188,7 @@ class UnderlinedLabel: public KSqueezedTextLabel { Q_OBJECT public: - UnderlinedLabel(QTabBar *tabBar, QWidget* parent = 0) + UnderlinedLabel(QTabBar *tabBar, QWidget* parent = nullptr) :KSqueezedTextLabel(parent), m_tabBar(tabBar) { } @@ -230,7 +230,7 @@ class StatusLabel: public UnderlinedLabel { Q_OBJECT public: - StatusLabel(QTabBar *tabBar, QWidget* parent = 0): + StatusLabel(QTabBar *tabBar, QWidget* parent = nullptr): UnderlinedLabel(tabBar, parent) { setAlignment(Qt::AlignRight | Qt::AlignVCenter); @@ -310,7 +310,7 @@ { if(d->leftCornerWidget.data() == widget) { if(d->leftCornerWidget) - d->leftCornerWidget.data()->setParent(0); + d->leftCornerWidget.data()->setParent(nullptr); }else{ delete d->leftCornerWidget.data(); d->leftCornerWidget.clear(); diff --git a/sublime/controller.cpp b/sublime/controller.cpp --- a/sublime/controller.cpp +++ b/sublime/controller.cpp @@ -35,7 +35,7 @@ namespace Sublime { struct WidgetFinder { - WidgetFinder(QWidget *_w) :w(_w), view(0) {} + WidgetFinder(QWidget *_w) :w(_w), view(nullptr) {} Area::WalkerMode operator()(AreaIndex *index) { foreach (View *v, index->views()) @@ -54,7 +54,7 @@ }; struct ToolWidgetFinder { - ToolWidgetFinder(QWidget *_w) :w(_w), view(0) {} + ToolWidgetFinder(QWidget *_w) :w(_w), view(nullptr) {} Area::WalkerMode operator()(View *v, Sublime::Position /*position*/) { if (v->hasWidget() && (v->widget() == w)) @@ -113,7 +113,7 @@ void Controller::showArea(Area *area, MainWindow *mainWindow) { - Area *areaToShow = 0; + Area *areaToShow = nullptr; //if the area is already shown in another mainwindow then we need to clone it if (d->shownAreas.contains(area) && (mainWindow != d->shownAreas[area])) areaToShow = new Area(*area); @@ -149,7 +149,7 @@ int index = d->controlledWindows.indexOf(mainWindow); Q_ASSERT(index != -1); - Area* area = NULL; + Area* area = nullptr; foreach (Area* a, d->mainWindowAreas[index]) { qCDebug(SUBLIME) << "Object name: " << a->objectName() << " id " @@ -170,7 +170,7 @@ QString id = mainWindow->area()->objectName(); int areaIndex = 0; - Area* def = NULL; + Area* def = nullptr; foreach (Area* a, d->areas) { if (a->objectName() == id) { @@ -259,7 +259,7 @@ { qCDebug(SUBLIME) << "" << area->objectName(); areaReleased(area); - disconnect(area, 0, w, 0); + disconnect(area, nullptr, w, nullptr); } d->controlledWindows.removeAll(w); @@ -283,7 +283,7 @@ if (area->objectName() == id) return area; } - return 0; + return nullptr; } Area* Controller::areaForView(View* view) const @@ -292,7 +292,7 @@ if(area->views().contains(view)) return area; - return 0; + return nullptr; } /*We need this to catch activation of views and toolviews @@ -320,7 +320,7 @@ return false; //not a mouse button that should activate the widget? - return - QMouseEvent *mev = 0; + QMouseEvent *mev = nullptr; if (ev->type() == QEvent::MouseButtonPress || ev->type() == QEvent::MouseButtonDblClick) { mev = static_cast(ev); diff --git a/sublime/examples/example1main.cpp b/sublime/examples/example1main.cpp --- a/sublime/examples/example1main.cpp +++ b/sublime/examples/example1main.cpp @@ -36,7 +36,7 @@ #include Example1Main::Example1Main() - :KXmlGuiWindow(0) + :KXmlGuiWindow(nullptr) { //documents m_controller = new Sublime::Controller(this); diff --git a/sublime/idealbuttonbarwidget.cpp b/sublime/idealbuttonbarwidget.cpp --- a/sublime/idealbuttonbarwidget.cpp +++ b/sublime/idealbuttonbarwidget.cpp @@ -42,7 +42,7 @@ : QWidget(parent) , _area(area) , _controller(controller) - , _corner(0) + , _corner(nullptr) , _showState(false) { setContextMenuPolicy(Qt::CustomContextMenu); @@ -149,7 +149,7 @@ void IdealButtonBarWidget::showWidget(bool checked) { - Q_ASSERT(parentWidget() != 0); + Q_ASSERT(parentWidget() != nullptr); QAction *action = qobject_cast(sender()); Q_ASSERT(action); diff --git a/sublime/idealcontroller.cpp b/sublime/idealcontroller.cpp --- a/sublime/idealcontroller.cpp +++ b/sublime/idealcontroller.cpp @@ -91,7 +91,7 @@ KAcceleratorManager::setNoAccel(dock); QWidget *w = view->widget(dock); - if (w->parent() == 0) + if (w->parent() == nullptr) { /* Could happen when we're moving the widget from one IdealDockWidget to another. See moveView below. @@ -211,7 +211,7 @@ default: Q_ASSERT(false); - return 0; + return nullptr; } } @@ -346,7 +346,7 @@ m_dockwidget_to_action.remove(dock); if (nondestructive) - view->widget()->setParent(0); + view->widget()->setParent(nullptr); delete dock; } @@ -428,7 +428,7 @@ w = w->parentWidget(); } - return 0; + return nullptr; } void IdealController::goPrevNextDock(IdealController::Direction direction) diff --git a/sublime/idealdockwidget.cpp b/sublime/idealdockwidget.cpp --- a/sublime/idealdockwidget.cpp +++ b/sublime/idealdockwidget.cpp @@ -41,8 +41,8 @@ IdealDockWidget::IdealDockWidget(IdealController *controller, Sublime::MainWindow *parent) : QDockWidget(parent), - m_area(0), - m_view(0), + m_area(nullptr), + m_view(nullptr), m_docking_area(Qt::NoDockWidgetArea), m_controller(controller) { @@ -53,7 +53,7 @@ QAbstractButton *closeButton = findChild(QStringLiteral("qt_dockwidget_closebutton")); if (closeButton) { - disconnect(closeButton, &QAbstractButton::clicked, 0, 0); + disconnect(closeButton, &QAbstractButton::clicked, nullptr, nullptr); connect(closeButton, &QAbstractButton::clicked, this, &IdealDockWidget::closeRequested); } diff --git a/sublime/ideallayout.cpp b/sublime/ideallayout.cpp --- a/sublime/ideallayout.cpp +++ b/sublime/ideallayout.cpp @@ -166,7 +166,7 @@ QLayoutItem* IdealButtonBarLayout::itemAt(int index) const { - return _items.value(index, 0); + return _items.value(index, nullptr); } QLayoutItem* IdealButtonBarLayout::takeAt(int index) @@ -174,7 +174,7 @@ if (index >= 0 && index < _items.count()) return _items.takeAt(index); invalidate(); - return 0; + return nullptr; } int IdealButtonBarLayout::count() const diff --git a/sublime/mainwindow.cpp b/sublime/mainwindow.cpp --- a/sublime/mainwindow.cpp +++ b/sublime/mainwindow.cpp @@ -42,7 +42,7 @@ namespace Sublime { MainWindow::MainWindow(Controller *controller, Qt::WindowFlags flags) -: KParts::MainWindow(0, flags), d(new MainWindowPrivate(this, controller)) +: KParts::MainWindow(nullptr, flags), d(new MainWindowPrivate(this, controller)) { connect(this, &MainWindow::destroyed, controller, static_cast(&Controller::areaReleased)); @@ -107,7 +107,7 @@ void MainWindow::setArea(Area *area) { if (d->area) - disconnect(d->area, 0, d, 0); + disconnect(d->area, nullptr, d, nullptr); bool differentArea = (area != d->area); /* All views will be removed from dock area now. However, this does @@ -419,7 +419,7 @@ } } - return 0; + return nullptr; } void MainWindow::setBackgroundCentralWidget(QWidget* w) diff --git a/sublime/mainwindow_p.cpp b/sublime/mainwindow_p.cpp --- a/sublime/mainwindow_p.cpp +++ b/sublime/mainwindow_p.cpp @@ -76,7 +76,7 @@ namespace Sublime { MainWindowPrivate::MainWindowPrivate(MainWindow *w, Controller* controller) -:controller(controller), area(0), activeView(0), activeToolView(0), bgCentralWidget(0), +:controller(controller), area(nullptr), activeView(nullptr), activeToolView(nullptr), bgCentralWidget(nullptr), ignoreDockShown(false), autoAreaSettingsSave(false), m_mainWindow(w) { KActionCollection *ac = m_mainWindow->actionCollection(); @@ -214,7 +214,7 @@ m_concentrateToolBar->setMovable(false); m_mainWindow->addToolBar(Qt::TopToolBarArea, m_concentrateToolBar); - m_mainWindow->menuBar()->setCornerWidget(0, Qt::TopRightCorner); + m_mainWindow->menuBar()->setCornerWidget(nullptr, Qt::TopRightCorner); } else if (cornerWidget) { m_mainWindow->menuBar()->setCornerWidget(cornerWidget, Qt::TopRightCorner); cornerWidget->show(); @@ -346,14 +346,14 @@ splitter->setOrientation(index->orientation()); else { - Container *container = 0; + Container *container = nullptr; while(splitter->count() && qobject_cast(splitter->widget(0))) { // After unsplitting, we might have to remove old splitters QWidget* widget = splitter->widget(0); qCDebug(SUBLIME) << "deleting" << widget; - widget->setParent(0); + widget->setParent(nullptr); delete widget; } @@ -419,7 +419,7 @@ { if(m_leftTabbarCornerWidget) { m_leftTabbarCornerWidget->hide(); - m_leftTabbarCornerWidget->setParent(0); + m_leftTabbarCornerWidget->setParent(nullptr); } IdealToolViewCreator toolViewCreator(this); @@ -448,7 +448,7 @@ void MainWindowPrivate::clearArea() { if(m_leftTabbarCornerWidget) - m_leftTabbarCornerWidget->setParent(0); + m_leftTabbarCornerWidget->setParent(nullptr); //reparent toolview widgets to 0 to prevent their deletion together with dockwidgets foreach (View *view, area->toolViews()) @@ -458,7 +458,7 @@ idealController->removeView(view, nonDestructive); if (view->hasWidget()) - view->widget()->setParent(0); + view->widget()->setParent(nullptr); } docks.clear(); @@ -468,12 +468,12 @@ foreach (View *view, area->views()) { if (view->hasWidget()) - view->widget()->setParent(0); + view->widget()->setParent(nullptr); } cleanCentralWidget(); - m_mainWindow->setActiveView(0); + m_mainWindow->setActiveView(nullptr); m_indexSplitters.clear(); - area = 0; + area = nullptr; viewContainers.clear(); setTabBarLeftCornerWidget(m_leftTabbarCornerWidget.data()); @@ -524,7 +524,7 @@ { if(m_leftTabbarCornerWidget) { m_leftTabbarCornerWidget->hide(); - m_leftTabbarCornerWidget->setParent(0); + m_leftTabbarCornerWidget->setParent(nullptr); } // Remove container objects in the hierarchy from the parents, @@ -546,7 +546,7 @@ { while (container->count()) { - container->widget(0)->setParent(0); + container->widget(0)->setParent(nullptr); } //and then delete the container delete container; @@ -598,7 +598,7 @@ //just remove a widget if( view->widget() ) { container->removeWidget(view->widget()); - view->widget()->setParent(0); + view->widget()->setParent(nullptr); //activate what is visible currently in the container if the removed view was active if (wasActive) return m_mainWindow->setActiveView(container->viewForWidget(container->currentWidget())); @@ -608,7 +608,7 @@ { if(m_leftTabbarCornerWidget) { m_leftTabbarCornerWidget->hide(); - m_leftTabbarCornerWidget->setParent(0); + m_leftTabbarCornerWidget->setParent(nullptr); } // We've about to remove the last view of this container. It will @@ -620,7 +620,7 @@ container->removeWidget(view->widget()); if (view->widget()) - view->widget()->setParent(0); + view->widget()->setParent(nullptr); else qWarning() << "View does not have a widget!"; @@ -628,7 +628,7 @@ // We can be called from signal handler of container // (which is tab widget), so defer deleting it. container->deleteLater(); - container->setParent(0); + container->setParent(nullptr); /* If we're not at the top level, we get to collapse split views. */ if (index->parent()) @@ -636,7 +636,7 @@ /* The splitter used to have container as the only child, now it's time to get rid of it. Make sure deleting splitter does not delete container -- per above comment, we'll delete it later. */ - container->setParent(0); + container->setParent(nullptr); m_indexSplitters.remove(index); delete splitter; @@ -687,7 +687,7 @@ setTabBarLeftCornerWidget(m_leftTabbarCornerWidget.data()); if ( wasActive ) { - m_mainWindow->setActiveView(0L); + m_mainWindow->setActiveView(nullptr); } } @@ -782,7 +782,7 @@ // Q_ASSERT(splitter || putToIndex == area->rootIndex()); - Container* c = 0; + Container* c = nullptr; if(splitter) { c = qobject_cast(splitter->widget(0)); }else{ diff --git a/sublime/tests/test_areaoperation.cpp b/sublime/tests/test_areaoperation.cpp --- a/sublime/tests/test_areaoperation.cpp +++ b/sublime/tests/test_areaoperation.cpp @@ -145,9 +145,9 @@ delete m_area1; delete m_area2; delete m_controller; - m_area1 = 0; - m_area2 = 0; - m_controller = 0; + m_area1 = nullptr; + m_area2 = nullptr; + m_controller = nullptr; } void TestAreaOperation::areaConstruction() @@ -218,7 +218,7 @@ //check that mainwindow have all splitters and widgets in splitters inside centralWidget QWidget *central = mw->centralWidget(); - QVERIFY(central != 0); + QVERIFY(central != nullptr); QVERIFY(central->inherits("QWidget")); QWidget *splitter = central->findChild(); @@ -232,7 +232,7 @@ area->walkViews(c, area->rootIndex()); QCOMPARE(container->count(), c.count); for (int i = 0; i < container->count(); ++i) - QVERIFY(container->widget(i) != 0); + QVERIFY(container->widget(i) != nullptr); } void TestAreaOperation::checkArea2(MainWindow *mw) @@ -247,7 +247,7 @@ //check that mainwindow have all splitters and widgets in splitters inside centralWidget QWidget *central = mw->centralWidget(); - QVERIFY(central != 0); + QVERIFY(central != nullptr); QVERIFY(central->inherits("QWidget")); QWidget *splitter = central->findChild(); @@ -262,7 +262,7 @@ foreach (Container *c, containers) { for (int i = 0; i < c->count(); ++i) - QVERIFY(c->widget(i) != 0); + QVERIFY(c->widget(i) != nullptr); widgetCount += c->count(); } @@ -524,7 +524,7 @@ //check that mainwindow has newly added toolview foreach (View *dock, mw.toolDocks()) - QVERIFY(dock->widget() != 0); + QVERIFY(dock->widget() != nullptr); QCOMPARE(mw.toolDocks().count(), m_area1->toolViews().count()); //now remove toolview @@ -541,7 +541,7 @@ //check that mainwindow has newly added toolview foreach (View *dock, mw.toolDocks()) - QVERIFY(dock->widget() != 0); + QVERIFY(dock->widget() != nullptr); QCOMPARE(mw.toolDocks().count(), m_area1->toolViews().count()); } @@ -682,7 +682,7 @@ //check mainwindow QWidget *central = mw->centralWidget(); - QVERIFY(central != 0); + QVERIFY(central != nullptr); QVERIFY(central->inherits("QWidget")); QWidget *splitter = central->findChild(); @@ -701,8 +701,8 @@ { for (int i = 0; i < c->count(); ++i) { - QVERIFY(c->widget(i) != 0); - QVERIFY(c->widget(i)->parentWidget() != 0); + QVERIFY(c->widget(i) != nullptr); + QVERIFY(c->widget(i)->parentWidget() != nullptr); } widgetCount += c->count(); } @@ -721,7 +721,7 @@ foreach (View *view, area->views()) if (view->objectName() == name) return view; - return 0; + return nullptr; } /////////// diff --git a/sublime/tests/test_controller.cpp b/sublime/tests/test_controller.cpp --- a/sublime/tests/test_controller.cpp +++ b/sublime/tests/test_controller.cpp @@ -59,7 +59,7 @@ QCOMPARE(area->views().count(), 2); delete area; - view2 = 0; view3= 0; + view2 = nullptr; view3= nullptr; QEXPECT_FAIL("", "Fails because of delayed view deletion", Continue); QCOMPARE(doc->views().count(), 1); diff --git a/sublime/tests/test_toolviewtoolbar.cpp b/sublime/tests/test_toolviewtoolbar.cpp --- a/sublime/tests/test_toolviewtoolbar.cpp +++ b/sublime/tests/test_toolviewtoolbar.cpp @@ -42,7 +42,7 @@ ToolViewToolBarFactory(const QString &id): SimpleToolWidgetFactory(id) {} QList toolBarActions( QWidget* ) const override { - QAction* action = new QAction(actionText, 0); + QAction* action = new QAction(actionText, nullptr); return QList() << action; } QString actionText; diff --git a/sublime/tests/test_view.cpp b/sublime/tests/test_view.cpp --- a/sublime/tests/test_view.cpp +++ b/sublime/tests/test_view.cpp @@ -56,7 +56,7 @@ QString documentType() const override { return QStringLiteral("Test"); } QString documentSpecifier() const override { return QString(); } protected: - QWidget *createViewWidget(QWidget *parent = 0) override { return new QWidget(parent); } + QWidget *createViewWidget(QWidget *parent = nullptr) override { return new QWidget(parent); } View *newView(Document *doc) override { return new Test(doc); } }; @@ -65,7 +65,7 @@ Controller controller; Document *doc = new TestDocument(&controller); View *view = doc->createView(); - QVERIFY(dynamic_cast(view) != 0); + QVERIFY(dynamic_cast(view) != nullptr); } QTEST_MAIN(TestView) diff --git a/sublime/tests/test_viewactivation.cpp b/sublime/tests/test_viewactivation.cpp --- a/sublime/tests/test_viewactivation.cpp +++ b/sublime/tests/test_viewactivation.cpp @@ -38,7 +38,7 @@ class SpecialWidgetFactory: public SimpleToolWidgetFactory { public: SpecialWidgetFactory(const QString &id): SimpleToolWidgetFactory(id) {} - QWidget* create(ToolDocument *doc, QWidget *parent = 0) override + QWidget* create(ToolDocument *doc, QWidget *parent = nullptr) override { QWidget *w = new QWidget(parent); Widget *inner = new Widget(w); diff --git a/sublime/view.cpp b/sublime/view.cpp --- a/sublime/view.cpp +++ b/sublime/view.cpp @@ -38,13 +38,13 @@ }; ViewPrivate::ViewPrivate() - :doc(0), widget(0) + :doc(nullptr), widget(nullptr) { } void ViewPrivate::unsetWidget() { - widget = 0; + widget = nullptr; } View::View(Document *doc, WidgetOwnership ws ) @@ -58,7 +58,7 @@ { if (d->widget && d->ws == View::TakeOwnership ) { d->widget->hide(); - d->widget->setParent(0); + d->widget->setParent(nullptr); d->widget->deleteLater(); } delete d; @@ -86,7 +86,7 @@ bool View::hasWidget() const { - return d->widget != 0; + return d->widget != nullptr; } void View::requestRaise() diff --git a/tests/kdevsignalspy.cpp b/tests/kdevsignalspy.cpp --- a/tests/kdevsignalspy.cpp +++ b/tests/kdevsignalspy.cpp @@ -27,7 +27,7 @@ KDevSignalSpy::KDevSignalSpy(QObject *obj, const char *signal, Qt::ConnectionType ct ) - : QObject(0), m_obj(obj), m_emitted(false) + : QObject(nullptr), m_obj(obj), m_emitted(false) { m_timer = new QTimer(this); m_loop = new QEventLoop(this); @@ -52,7 +52,7 @@ void KDevSignalSpy::signalEmitted() { m_emitted = true; - disconnect(m_obj, 0, this, 0); + disconnect(m_obj, nullptr, this, nullptr); m_timer->stop(); m_loop->quit(); } diff --git a/tests/testplugincontroller.cpp b/tests/testplugincontroller.cpp --- a/tests/testplugincontroller.cpp +++ b/tests/testplugincontroller.cpp @@ -54,7 +54,7 @@ Q_UNUSED(extension); Q_UNUSED(pluginname); Q_UNUSED(constraints); - return 0; + return nullptr; } QVector TestPluginController::queryExtensionPlugins(const QString& extension, const QVariantMap& constraints) const @@ -67,7 +67,7 @@ IPlugin* TestPluginController::loadPlugin(const QString& pluginName) { Q_UNUSED(pluginName); - return 0; + return nullptr; } KPluginMetaData TestPluginController::pluginInfo(const IPlugin*) const diff --git a/tests/testproject.cpp b/tests/testproject.cpp --- a/tests/testproject.cpp +++ b/tests/testproject.cpp @@ -28,7 +28,7 @@ TestProject::TestProject(const Path& path, QObject* parent) : IProject(parent) -, m_root(0) +, m_root(nullptr) , m_projectConfiguration(KSharedConfig::openConfig()) { m_path = path.isValid() ? path : Path(QStringLiteral("/tmp/kdev-testproject/")); @@ -60,7 +60,7 @@ { if (m_root) { ICore::self()->projectController()->projectModel()->removeRow( m_root->row() ); - m_root = 0; + m_root = nullptr; m_path.clear(); } if (item) { diff --git a/util/dbus_socket_transformer/main.cpp b/util/dbus_socket_transformer/main.cpp --- a/util/dbus_socket_transformer/main.cpp +++ b/util/dbus_socket_transformer/main.cpp @@ -349,7 +349,7 @@ int sockfd; int addrSize; - sockaddr* useAddr = 0; + sockaddr* useAddr = nullptr; sockaddr_un serv_addru; sockaddr_in serv_addrin; @@ -379,7 +379,7 @@ } int port = atoi(argv[1]); hostent *server = gethostbyname("localhost"); - if(server == NULL) + if(server == nullptr) { std::cerr << "failed to get server" << std::endl; return 5; diff --git a/util/focusedtreeview.cpp b/util/focusedtreeview.cpp --- a/util/focusedtreeview.cpp +++ b/util/focusedtreeview.cpp @@ -49,7 +49,7 @@ void FocusedTreeView::setModel(QAbstractItemModel* newModel) { if (QAbstractItemModel* oldModel = model()) { - disconnect(oldModel, 0, this, 0); + disconnect(oldModel, nullptr, this, nullptr); } QTreeView::setModel(newModel); diff --git a/util/foregroundlock.cpp b/util/foregroundlock.cpp --- a/util/foregroundlock.cpp +++ b/util/foregroundlock.cpp @@ -34,7 +34,7 @@ QMutex finishMutex; QWaitCondition condition; -volatile QThread* holderThread = 0; +volatile QThread* holderThread = nullptr; volatile int recursion = 0; void lockForegroundMutexInternal() { @@ -44,7 +44,7 @@ ++recursion; }else{ internalMutex.lock(); - Q_ASSERT(recursion == 0 && holderThread == 0); + Q_ASSERT(recursion == 0 && holderThread == nullptr); holderThread = QThread::currentThread(); recursion = 1; } @@ -59,7 +59,7 @@ }else{ if(internalMutex.tryLock(interval)) { - Q_ASSERT(recursion == 0 && holderThread == 0); + Q_ASSERT(recursion == 0 && holderThread == nullptr); holderThread = QThread::currentThread(); recursion = 1; return true; @@ -79,7 +79,7 @@ recursion -= 1; if(recursion == 0) { - holderThread = 0; + holderThread = nullptr; internalMutex.unlock(); } } diff --git a/util/multilevellistview.cpp b/util/multilevellistview.cpp --- a/util/multilevellistview.cpp +++ b/util/multilevellistview.cpp @@ -60,7 +60,7 @@ Q_OBJECT public: - RootProxyModel( QObject* parent = 0 ) + RootProxyModel( QObject* parent = nullptr ) : QSortFilterProxyModel( parent ) { } @@ -82,7 +82,7 @@ Q_OBJECT public: - explicit SubTreeProxyModel( QItemSelectionModel* selectionModel, QObject* parent = 0 ) + explicit SubTreeProxyModel( QItemSelectionModel* selectionModel, QObject* parent = nullptr ) : KSelectionProxyModel( selectionModel, parent ) {} QVariant headerData( int section, Qt::Orientation orientation, int role ) const override @@ -136,7 +136,7 @@ MultiLevelListViewPrivate::MultiLevelListViewPrivate(MultiLevelListView* view_) : view(view_) , levels(0) -, model(0) +, model(nullptr) { } @@ -291,7 +291,7 @@ d->levels = levels; - QTreeView* previousView = 0; + QTreeView* previousView = nullptr; for (int i = 0; i < d->levels; ++i) { QVBoxLayout* levelLayout = new QVBoxLayout(); diff --git a/util/projecttestjob.cpp b/util/projecttestjob.cpp --- a/util/projecttestjob.cpp +++ b/util/projecttestjob.cpp @@ -32,8 +32,8 @@ { Private(ProjectTestJob* q) : q(q) - , m_currentJob(0) - , m_currentSuite(0) + , m_currentJob(nullptr) + , m_currentSuite(nullptr) {} void runNext(); diff --git a/util/tests/test_embeddedfreetree.cpp b/util/tests/test_embeddedfreetree.cpp --- a/util/tests/test_embeddedfreetree.cpp +++ b/util/tests/test_embeddedfreetree.cpp @@ -336,7 +336,7 @@ const int removeProbability = 40; //Percent TestSet set; - srand(time(NULL)); + srand(time(nullptr)); for(int a = 0; a < cycles; ++a) { if(a % (cycles / 10) == 0) { qDebug() << "cycle" << a; @@ -439,7 +439,7 @@ uint totalItems = 0, totalFilteredItems = 0; - srand(time(NULL)); + srand(time(nullptr)); for(uint a = 0; a < cycles; ++a) { KDevelop::ConvenientFreeListSet set1; std::set testSet1; diff --git a/vcs/dvcs/dvcsjob.cpp b/vcs/dvcs/dvcsjob.cpp --- a/vcs/dvcs/dvcsjob.cpp +++ b/vcs/dvcs/dvcsjob.cpp @@ -45,7 +45,7 @@ struct DVcsJobPrivate { - DVcsJobPrivate() : childproc(new KProcess), vcsplugin(0), ignoreError(false) + DVcsJobPrivate() : childproc(new KProcess), vcsplugin(nullptr), ignoreError(false) {} ~DVcsJobPrivate() { diff --git a/vcs/interfaces/ipatchsource.cpp b/vcs/interfaces/ipatchsource.cpp --- a/vcs/interfaces/ipatchsource.cpp +++ b/vcs/interfaces/ipatchsource.cpp @@ -66,7 +66,7 @@ QWidget* IPatchSource::customWidget() const { - return 0; + return nullptr; } uint IPatchSource::depth() const diff --git a/vcs/models/brancheslistmodel.cpp b/vcs/models/brancheslistmodel.cpp --- a/vcs/models/brancheslistmodel.cpp +++ b/vcs/models/brancheslistmodel.cpp @@ -75,11 +75,11 @@ BranchesListModel* bmodel = qobject_cast(model()); if(!bmodel->findItems(newBranch).isEmpty()) { - KMessageBox::messageBox(0, KMessageBox::Sorry, i18n("Branch \"%1\" already exists.", newBranch)); + KMessageBox::messageBox(nullptr, KMessageBox::Sorry, i18n("Branch \"%1\" already exists.", newBranch)); return; } - int ret = KMessageBox::messageBox(0, KMessageBox::WarningYesNo, + int ret = KMessageBox::messageBox(nullptr, KMessageBox::WarningYesNo, i18n("Are you sure you want to rename \"%1\" to \"%2\"?", text(), newBranch)); if (ret == KMessageBox::No) { return; // ignore event diff --git a/vcs/models/vcsfilechangesmodel.cpp b/vcs/models/vcsfilechangesmodel.cpp --- a/vcs/models/vcsfilechangesmodel.cpp +++ b/vcs/models/vcsfilechangesmodel.cpp @@ -170,7 +170,7 @@ parent->appendRow({ item, itStatus }); } else { QStandardItem *parent = item->parent(); - if(parent == 0) + if(parent == nullptr) parent = invisibleRootItem(); auto statusInfoItem = static_cast(parent->child(item->row(), 1)); statusInfoItem->setStatus(status); @@ -196,7 +196,7 @@ return parent->child(i); } } - return 0; + return nullptr; } void VcsFileChangesModel::setAllChecked(bool checked) diff --git a/vcs/vcspluginhelper.cpp b/vcs/vcspluginhelper.cpp --- a/vcs/vcspluginhelper.cpp +++ b/vcs/vcspluginhelper.cpp @@ -394,11 +394,11 @@ SIGNAL(annotationContextMenuAboutToShow(KTextEditor::View*,QMenu*,int)), this, SLOT(annotationContextMenuAboutToShow(KTextEditor::View*,QMenu*,int))); } else { - KMessageBox::error(0, i18n("Cannot display annotations, missing interface KTextEditor::AnnotationInterface for the editor.")); + KMessageBox::error(nullptr, i18n("Cannot display annotations, missing interface KTextEditor::AnnotationInterface for the editor.")); delete job; } } else { - KMessageBox::error(0, i18n("Cannot execute annotate action because the " + KMessageBox::error(nullptr, i18n("Cannot execute annotate action because the " "document was not found, or was not a text document:\n%1", url.toDisplayString(QUrl::PreferLocalFile))); } } diff --git a/vcs/widgets/vcsdiffpatchsources.cpp b/vcs/widgets/vcsdiffpatchsources.cpp --- a/vcs/widgets/vcsdiffpatchsources.cpp +++ b/vcs/widgets/vcsdiffpatchsources.cpp @@ -115,7 +115,7 @@ if (details.isEmpty()) { //errorText may be empty details = i18n("For more detailed information please see the Version Control toolview"); } - KMessageBox::detailedError(0, i18n("Unable to commit"), details, i18n("Commit unsuccessful")); + KMessageBox::detailedError(nullptr, i18n("Unable to commit"), details, i18n("Commit unsuccessful")); } deleteLater(); @@ -149,7 +149,7 @@ } VCSDiffPatchSource::VCSDiffPatchSource(const KDevelop::VcsDiff& diff) - : m_updater(0) + : m_updater(nullptr) { updateFromDiff(diff); } @@ -260,7 +260,7 @@ QString text = i18n("Files will be committed:\n
    %1
\nWith message:\n
%2
", files, message); - int res = KMessageBox::warningContinueCancel(0, text, i18n("About to commit to repository"), + int res = KMessageBox::warningContinueCancel(nullptr, text, i18n("About to commit to repository"), KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QStringLiteral("ShouldAskConfirmCommit")); if (res != KMessageBox::Continue) { @@ -300,7 +300,7 @@ KDevelop::VcsRevision::createSpecialRevision(KDevelop::VcsRevision::Working))); const bool success = diffJob ? diffJob->exec() : false; if (!success) { - KMessageBox::error(0, i18n("Could not create a patch for the current version.")); + KMessageBox::error(nullptr, i18n("Could not create a patch for the current version.")); return {}; }