src: use nullptr instead of NULL

This commit is contained in:
mlangkabel
2018-02-23 19:11:35 +01:00
parent 0df32f239e
commit ca20cb7bc9
17 changed files with 44 additions and 44 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ bool LicenseChecker::isCurrentLicenseValid()
LicenseChecker::LicenseState LicenseChecker::checkCurrentLicense() const
{
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
if (appSettings == NULL)
if (appSettings == nullptr)
{
LOG_ERROR_STREAM(<< "Unable to retrieve app settings");
return LICENSE_EMPTY;
+2 -2
View File
@@ -22,12 +22,12 @@ Component::~Component()
{
if (m_controller)
{
m_controller->setComponent(NULL);
m_controller->setComponent(nullptr);
}
if (m_view)
{
m_view->setComponent(NULL);
m_view->setComponent(nullptr);
}
}
+1 -1
View File
@@ -81,7 +81,7 @@ ControllerType* View::getController()
{
return m_component->getController<ControllerType>();
}
return NULL;
return nullptr;
}
#endif // VIEW_H
@@ -13,7 +13,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand)
setIndexedPaths(indexerCommand->getIndexedPaths());
setExcludedPaths(indexerCommand->getExcludedPath());
if (dynamic_cast<IndexerCommandCxxCdb*>(indexerCommand) != NULL)
if (dynamic_cast<IndexerCommandCxxCdb*>(indexerCommand) != nullptr)
{
IndexerCommandCxxCdb* cmd = dynamic_cast<IndexerCommandCxxCdb*>(indexerCommand);
@@ -23,7 +23,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand)
setSystemHeaderSearchPaths(cmd->getSystemHeaderSearchPaths());
setFrameworkSearchhPaths(cmd->getFrameworkSearchPaths());
}
else if (dynamic_cast<IndexerCommandCxxEmpty*>(indexerCommand) != NULL)
else if (dynamic_cast<IndexerCommandCxxEmpty*>(indexerCommand) != nullptr)
{
IndexerCommandCxxEmpty* cmd = dynamic_cast<IndexerCommandCxxEmpty*>(indexerCommand);
@@ -34,7 +34,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand)
setSystemHeaderSearchPaths(cmd->getSystemHeaderSearchPaths());
setFrameworkSearchhPaths(cmd->getFrameworkSearchPaths());
}
else if (dynamic_cast<IndexerCommandJava*>(indexerCommand) != NULL)
else if (dynamic_cast<IndexerCommandJava*>(indexerCommand) != nullptr)
{
IndexerCommandJava* cmd = dynamic_cast<IndexerCommandJava*>(indexerCommand);
+1 -1
View File
@@ -308,7 +308,7 @@ bool ConfigManager::load(const std::shared_ptr<TextAccess> textAccess)
TiXmlDocument doc;
const char* pTest = doc.Parse(text.c_str(), 0, TIXML_ENCODING_UTF8);
if (pTest != NULL)
if (pTest != nullptr)
{
TiXmlHandle docHandle(&doc);
TiXmlNode *rootNode = docHandle.FirstChild("config").ToNode();
+8 -8
View File
@@ -15,7 +15,7 @@ namespace utility
TiXmlDocument doc;
const char* pTest = doc.Parse(text.c_str(), 0, TIXML_ENCODING_LEGACY);
if (pTest != NULL)
if (pTest != nullptr)
{
TiXmlHandle docHandle(&doc);
std::vector<std::pair<TiXmlElement*, size_t>> traversalStates;
@@ -77,7 +77,7 @@ namespace utility
TiXmlDocument doc;
const char* pTest = doc.Parse(text.c_str(), 0, TIXML_ENCODING_UTF8);
if (pTest != NULL)
if (pTest != nullptr)
{
TiXmlHandle docHandle(&doc);
TiXmlElement *rootElement = docHandle.ToNode()->FirstChildElement();
@@ -121,31 +121,31 @@ namespace utility
nodes.push_back(element);
}
if (element->FirstChildElement() != NULL)
if (element->FirstChildElement() != nullptr)
{
element = element->FirstChildElement();
}
else if (element->NextSiblingElement() != NULL)
else if (element->NextSiblingElement() != nullptr)
{
element = element->NextSiblingElement();
}
else
{
if (element == NULL)
if (element == nullptr)
{
}
while (element->Parent()->ToElement() != NULL && element->Parent()->NextSiblingElement() == NULL)
while (element->Parent()->ToElement() != nullptr && element->Parent()->NextSiblingElement() == nullptr)
{
TiXmlElement* newElement = element->Parent()->ToElement();
if (newElement == NULL)
if (newElement == nullptr)
{
}
element = newElement;
}
if (element->Parent() != NULL && element->Parent()->NextSiblingElement() != NULL)
if (element->Parent() != nullptr && element->Parent()->NextSiblingElement() != nullptr)
{
element = element->Parent()->NextSiblingElement();
}
@@ -70,11 +70,11 @@ void CxxAstVisitorComponentContext::beginTraverseDecl(clang::Decl* d)
if (d &&
clang::isa<clang::NamedDecl>(d) &&
!clang::isa<clang::ParmVarDecl>(d) && // no parameter
!(clang::isa<clang::VarDecl>(d) && d->getParentFunctionOrMethod() != NULL) && // no local variable
!clang::isa<clang::UsingDirectiveDecl>(d) && // no using directive decl
!clang::isa<clang::UsingDecl>(d) && // no using decl
!clang::isa<clang::NamespaceDecl>(d) // no namespace
!clang::isa<clang::ParmVarDecl>(d) && // no parameter
!(clang::isa<clang::VarDecl>(d) && d->getParentFunctionOrMethod() != nullptr) && // no local variable
!clang::isa<clang::UsingDirectiveDecl>(d) && // no using directive decl
!clang::isa<clang::UsingDecl>(d) && // no using decl
!clang::isa<clang::NamespaceDecl>(d) // no namespace
){
clang::NamedDecl* nd = clang::dyn_cast<clang::NamedDecl>(d);
context = std::make_shared<CxxContextDecl>(nd, getAstVisitor()->getDeclNameCache());
@@ -440,7 +440,7 @@ void CxxAstVisitorComponentIndexer::visitTypedefDecl(clang::TypedefDecl* d)
{
m_client->recordSymbol(
getAstVisitor()->getDeclNameCache()->getValue(d),
d->getAnonDeclWithTypedefName() == NULL ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()),
d->getAnonDeclWithTypedefName() == nullptr ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()),
getParseLocation(d->getLocation()),
utility::convertAccessSpecifier(d->getAccess()),
utility::isImplicit(d) ? DEFINITION_IMPLICIT : DEFINITION_EXPLICIT
@@ -454,7 +454,7 @@ void CxxAstVisitorComponentIndexer::visitTypeAliasDecl(clang::TypeAliasDecl* d)
{
m_client->recordSymbol(
getAstVisitor()->getDeclNameCache()->getValue(d),
d->getAnonDeclWithTypedefName() == NULL ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()),
d->getAnonDeclWithTypedefName() == nullptr ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()),
getParseLocation(d->getLocation()),
utility::convertAccessSpecifier(d->getAccess()),
utility::isImplicit(d) ? DEFINITION_IMPLICIT : DEFINITION_EXPLICIT
@@ -572,7 +572,7 @@ void CxxAstVisitorComponentIndexer::visitDeclRefExpr(clang::DeclRefExpr* s)
if (shouldVisitReference(s->getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
{
if ((clang::isa<clang::ParmVarDecl>(decl)) ||
(clang::isa<clang::VarDecl>(decl) && decl->getParentFunctionOrMethod() != NULL)
(clang::isa<clang::VarDecl>(decl) && decl->getParentFunctionOrMethod() != nullptr)
) {
ParseLocation declLocation = getParseLocation(decl->getLocation());
std::wstring name = declLocation.filePath.fileName() + L"<" +
@@ -345,7 +345,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
else if (clang::isa<clang::VarDecl>(declaration))
{
const clang::VarDecl* varDecl = clang::dyn_cast<clang::VarDecl>(declaration);
if (varDecl->getParentFunctionOrMethod() == NULL)
if (varDecl->getParentFunctionOrMethod() == nullptr)
{
bool isStatic = false;
if (varDecl->getAccess() != clang::AS_none)
+1 -1
View File
@@ -90,7 +90,7 @@ SymbolKind utility::getSymbolKind(const clang::VarDecl* d)
{
symbolKind = SYMBOL_PARAMETER;
}
else if (d->getParentFunctionOrMethod() == NULL)
else if (d->getParentFunctionOrMethod() == nullptr)
{
if (d->getAccess() == clang::AS_none)
{
+1 -1
View File
@@ -11,7 +11,7 @@
QtBookmark::QtBookmark(ControllerProxy<BookmarkController>* controllerProxy)
: m_controllerProxy(controllerProxy)
, m_treeWidgetItem(NULL)
, m_treeWidgetItem(nullptr)
, m_arrowImageName(L"arrow_line_down.png")
, m_hovered(false)
, m_ignoreNextResize(false)
@@ -81,7 +81,7 @@ void QtBookmarkCategory::setTreeWidgetItem(QTreeWidgetItem* treeItem)
void QtBookmarkCategory::updateArrow()
{
if (m_treeItem != NULL)
if (m_treeItem != nullptr)
{
if (m_treeItem->isExpanded())
{
@@ -98,7 +98,7 @@ void QtBookmarkCategory::updateArrow()
void QtBookmarkCategory::expandClicked()
{
if (m_treeItem != NULL)
if (m_treeItem != nullptr)
{
m_treeItem->setExpanded(!m_treeItem->isExpanded());
updateArrow();
+3 -3
View File
@@ -32,7 +32,7 @@ void QtTcpWrapper::stopListening()
QtTcpWrapper::~QtTcpWrapper()
{
if (m_tcpServer != NULL)
if (m_tcpServer != nullptr)
{
if (m_tcpServer->isListening())
{
@@ -111,7 +111,7 @@ void QtTcpWrapper::startRead()
QString message = QString::fromUtf8(byteArray);
if (m_readCallback != NULL)
if (m_readCallback != nullptr)
{
m_readCallback(message.toStdWString());
}
@@ -121,7 +121,7 @@ void QtTcpWrapper::startRead()
m_tcpClient->close();
if (m_readCallback != NULL)
if (m_readCallback != nullptr)
{
m_readCallback(buffer);
}*/
+7 -7
View File
@@ -297,7 +297,7 @@ void QtGraphView::rebuildGraph(
for (unsigned int i = 0; i < nodes.size(); i++)
{
QtGraphNode* node = createNodeRecursive(view, NULL, nodes[i].get(), activeNodeCount > 1);
QtGraphNode* node = createNodeRecursive(view, nullptr, nodes[i].get(), activeNodeCount > 1);
if (node)
{
m_nodes.push_back(node);
@@ -889,7 +889,7 @@ QtGraphNode* QtGraphView::createNodeRecursive(
){
if (!node->visible)
{
return NULL;
return nullptr;
}
QtGraphNode* newNode = nullptr;
@@ -970,13 +970,13 @@ QtGraphEdge* QtGraphView::createEdge(
{
if (!edge->visible)
{
return NULL;
return nullptr;
}
QtGraphNode* owner = findNodeRecursive(m_nodes, edge->ownerId);
QtGraphNode* target = findNodeRecursive(m_nodes, edge->targetId);
if (owner != NULL && target != NULL)
if (owner != nullptr && target != nullptr)
{
QtGraphEdge* qtEdge = new QtGraphEdge(
owner, target, edge->data, edge->getWeight(), edge->active && !useBezier, edge->getDirection());
@@ -1022,7 +1022,7 @@ QtGraphEdge* QtGraphView::createEdge(
return qtEdge;
}
return NULL;
return nullptr;
}
QtGraphEdge* QtGraphView::createAggregationEdge(
@@ -1030,7 +1030,7 @@ QtGraphEdge* QtGraphView::createAggregationEdge(
{
if (!edge->visible)
{
return NULL;
return nullptr;
}
bool allVisible = true;
@@ -1046,7 +1046,7 @@ QtGraphEdge* QtGraphView::createAggregationEdge(
if (allVisible)
{
return NULL;
return nullptr;
}
return createEdge(view, edge, visibleEdgeIds, Graph::TRAIL_NONE, QPointF(), false);
+2 -2
View File
@@ -193,14 +193,14 @@ void QtBookmarkBrowser::filterOrOrderChanged(const QString& text)
void QtBookmarkBrowser::treeItemClicked(QTreeWidgetItem* item, int column)
{
QtBookmarkCategory* category = dynamic_cast<QtBookmarkCategory*>(m_bookmarkTree->itemWidget(item, 0));
if (category != NULL)
if (category != nullptr)
{
category->expandClicked();
return;
}
QtBookmark* bookmark = dynamic_cast<QtBookmark*>(m_bookmarkTree->itemWidget(item, 0));
if (bookmark != NULL)
if (bookmark != nullptr)
{
bookmark->commentToggled();
return;
@@ -937,7 +937,7 @@ void QtProjectWizzard::createProject()
if (m_editing)
{
Application* application = Application::getInstance().get();
if (application->getCurrentProject() != NULL)
if (application->getCurrentProject() != nullptr)
{
settingsChanged = !(application->getCurrentProject()->settingsEqualExceptNameAndLocation(*(m_projectSettings.get())));
}
+2 -2
View File
@@ -11,7 +11,7 @@ public:
std::shared_ptr<TextAccess> textAccess = TextAccess::createFromString(text);
TS_ASSERT(textAccess.get() != NULL);
TS_ASSERT(textAccess.get() != nullptr);
}
void test_textAccessString_lines_count()
@@ -91,7 +91,7 @@ public:
std::shared_ptr<TextAccess> textAccess = TextAccess::createFromFile(filePath);
TS_ASSERT(textAccess.get() != NULL);
TS_ASSERT(textAccess.get() != nullptr);
}
void test_textAccessFile_lines_count()