replace all instances of NULL with nullptr

This commit is contained in:
Rasmus Karlsson 2017-06-11 09:37:30 +02:00
parent 1c6ff37e76
commit 9cd70877a5
15 changed files with 47 additions and 47 deletions

View file

@ -42,7 +42,7 @@ void Emojis::parseEmojis(std::vector<std::tuple<messages::LazyLoadedImage *, QSt
if (i - lastSlice != 0) {
vector.push_back(std::tuple<messages::LazyLoadedImage *, QString>(
NULL, text.mid(lastSlice, i - lastSlice)));
nullptr, text.mid(lastSlice, i - lastSlice)));
}
vector.push_back(std::tuple<messages::LazyLoadedImage *, QString>(
@ -63,7 +63,7 @@ void Emojis::parseEmojis(std::vector<std::tuple<messages::LazyLoadedImage *, QSt
if (lastSlice < text.length()) {
vector.push_back(
std::tuple<messages::LazyLoadedImage *, QString>(NULL, text.mid(lastSlice)));
std::tuple<messages::LazyLoadedImage *, QString>(nullptr, text.mid(lastSlice)));
}
}

View file

@ -254,7 +254,7 @@ void IrcManager::privateMessageReceived(Communi::IrcPrivateMessage *message)
{
auto c = ChannelManager::getInstance().getChannel(message->target().mid(1));
if (c != NULL) {
if (c != nullptr) {
messages::MessageParseArgs args;
c->addMessage(twitch::TwitchMessageBuilder::parse(message, c.get(), args));

View file

@ -20,7 +20,7 @@ namespace messages {
LazyLoadedImage::LazyLoadedImage(const QString &url, qreal scale, const QString &name,
const QString &tooltip, const QMargins &margin, bool isHat)
: _currentPixmap(NULL)
: _currentPixmap(nullptr)
, _currentFrame(0)
, _currentFrameOffset(0)
, _url(url)

View file

@ -63,7 +63,7 @@ public:
int getWidth() const
{
if (_currentPixmap == NULL) {
if (_currentPixmap == nullptr) {
return 16;
}
return _currentPixmap->width();
@ -71,7 +71,7 @@ public:
int getHeight() const
{
if (_currentPixmap == NULL) {
if (_currentPixmap == nullptr) {
return 16;
}
return _currentPixmap->height();

View file

@ -22,7 +22,7 @@ Word::Word(LazyLoadedImage *image, Type type, const QString &copytext, const QSt
// Text word
Word::Word(const QString &text, Type type, const QColor &color, const QString &copytext,
const QString &tooltip, const Link &link)
: _image(NULL)
: _image(nullptr)
, _text(text)
, _color(color)
, _isImage(false)

View file

@ -4,23 +4,23 @@
namespace chatterino {
messages::LazyLoadedImage *Resources::badgeStaff(NULL);
messages::LazyLoadedImage *Resources::badgeAdmin(NULL);
messages::LazyLoadedImage *Resources::badgeModerator(NULL);
messages::LazyLoadedImage *Resources::badgeGlobalmod(NULL);
messages::LazyLoadedImage *Resources::badgeTurbo(NULL);
messages::LazyLoadedImage *Resources::badgeBroadcaster(NULL);
messages::LazyLoadedImage *Resources::badgePremium(NULL);
messages::LazyLoadedImage *Resources::badgeStaff(nullptr);
messages::LazyLoadedImage *Resources::badgeAdmin(nullptr);
messages::LazyLoadedImage *Resources::badgeModerator(nullptr);
messages::LazyLoadedImage *Resources::badgeGlobalmod(nullptr);
messages::LazyLoadedImage *Resources::badgeTurbo(nullptr);
messages::LazyLoadedImage *Resources::badgeBroadcaster(nullptr);
messages::LazyLoadedImage *Resources::badgePremium(nullptr);
messages::LazyLoadedImage *Resources::cheerBadge100000(NULL);
messages::LazyLoadedImage *Resources::cheerBadge10000(NULL);
messages::LazyLoadedImage *Resources::cheerBadge5000(NULL);
messages::LazyLoadedImage *Resources::cheerBadge1000(NULL);
messages::LazyLoadedImage *Resources::cheerBadge100(NULL);
messages::LazyLoadedImage *Resources::cheerBadge1(NULL);
messages::LazyLoadedImage *Resources::cheerBadge100000(nullptr);
messages::LazyLoadedImage *Resources::cheerBadge10000(nullptr);
messages::LazyLoadedImage *Resources::cheerBadge5000(nullptr);
messages::LazyLoadedImage *Resources::cheerBadge1000(nullptr);
messages::LazyLoadedImage *Resources::cheerBadge100(nullptr);
messages::LazyLoadedImage *Resources::cheerBadge1(nullptr);
messages::LazyLoadedImage *Resources::buttonBan(NULL);
messages::LazyLoadedImage *Resources::buttonTimeout(NULL);
messages::LazyLoadedImage *Resources::buttonBan(nullptr);
messages::LazyLoadedImage *Resources::buttonTimeout(nullptr);
Resources::Resources()
{

View file

@ -21,7 +21,7 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges)
{
for (QString badge : badges) {
if (badge.startsWith("bits/")) {
long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), NULL, 10);
long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), nullptr, 10);
appendWord(Word(EmoteManager::getInstance().getCheerBadge(cheer), Word::BadgeCheer,
QString(), QString("Twitch Cheer" + QString::number(cheer))));
} else if (badge == "staff/1") {
@ -166,7 +166,7 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM
if (parameters.length() < 2)
continue;
long int id = std::stol(parameters.at(0).toStdString(), NULL, 10);
long int id = std::stol(parameters.at(0).toStdString(), nullptr, 10);
QStringList occurences = parameters.at(1).split(',');
@ -176,8 +176,8 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM
if (coords.length() < 2)
continue;
long int start = std::stol(coords.at(0).toStdString(), NULL, 10);
long int end = std::stol(coords.at(1).toStdString(), NULL, 10);
long int start = std::stol(coords.at(0).toStdString(), nullptr, 10);
long int end = std::stol(coords.at(1).toStdString(), nullptr, 10);
if (start >= end || start < 0 || end > ircMessage->content().length())
continue;
@ -235,7 +235,7 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM
for (const std::tuple<LazyLoadedImage *, QString> &tuple : parsed) {
LazyLoadedImage *image = std::get<0>(tuple);
if (image == NULL) { // is text
if (image == nullptr) { // is text
QString string = std::get<1>(tuple);
static QRegularExpression cheerRegex("cheer[1-9][0-9]*");

View file

@ -137,7 +137,7 @@
// if (parameters.length() < 2)
// continue;
//
// long int id = std::stol(parameters.at(0).toStdString(), NULL, 10);
// long int id = std::stol(parameters.at(0).toStdString(), nullptr, 10);
//
// QStringList occurences = parameters.at(1).split(',');
//
@ -148,8 +148,8 @@
// continue;
//
// long int start =
// std::stol(coords.at(0).toStdString(), NULL, 10);
// long int end = std::stol(coords.at(1).toStdString(), NULL,
// std::stol(coords.at(0).toStdString(), nullptr, 10);
// long int end = std::stol(coords.at(1).toStdString(), nullptr,
// 10);
//
// if (start >= end || start < 0 ||
@ -209,7 +209,7 @@
// for (const std::tuple<LazyLoadedImage *, QString> &tuple : parsed) {
// LazyLoadedImage *image = std::get<0>(tuple);
//
// if (image == NULL) { // is text
// if (image == nullptr) { // is text
// QString string = std::get<1>(tuple);
//
// static QRegularExpression cheerRegex("cheer[1-9][0-9]*");

View file

@ -65,7 +65,7 @@ void MainWindow::layoutVisibleChatWidgets(Channel *channel)
{
auto *page = _notebook.getSelectedPage();
if (page == NULL) {
if (page == nullptr) {
return;
}
@ -74,7 +74,7 @@ void MainWindow::layoutVisibleChatWidgets(Channel *channel)
for (auto it = widgets.begin(); it != widgets.end(); ++it) {
ChatWidget *widget = *it;
if (channel == NULL || channel == widget->getChannel().get()) {
if (channel == nullptr || channel == widget->getChannel().get()) {
widget->layoutMessages();
}
}
@ -84,7 +84,7 @@ void MainWindow::repaintVisibleChatWidgets(Channel *channel)
{
auto *page = _notebook.getSelectedPage();
if (page == NULL) {
if (page == nullptr) {
return;
}
@ -93,7 +93,7 @@ void MainWindow::repaintVisibleChatWidgets(Channel *channel)
for (auto it = widgets.begin(); it != widgets.end(); ++it) {
ChatWidget *widget = *it;
if (channel == NULL || channel == widget->getChannel().get()) {
if (channel == nullptr || channel == widget->getChannel().get()) {
widget->layoutMessages();
}
}
@ -103,7 +103,7 @@ void MainWindow::repaintGifEmotes()
{
auto *page = _notebook.getSelectedPage();
if (page == NULL) {
if (page == nullptr) {
return;
}

View file

@ -67,7 +67,7 @@ void Notebook::removePage(NotebookPage *page)
int index = _pages.indexOf(page);
if (_pages.size() == 1) {
select(NULL);
select(nullptr);
} else if (index == _pages.count() - 1) {
select(_pages[index - 1]);
} else {

View file

@ -98,7 +98,7 @@ void NotebookTab::moveAnimated(QPoint pos, bool animated)
{
_posAnimationDesired = pos;
if ((window() != NULL && !window()->isVisible()) || !animated || _posAnimated == false) {
if ((window() != nullptr && !window()->isVisible()) || !animated || _posAnimated == false) {
move(pos);
_posAnimated = true;

View file

@ -41,7 +41,7 @@ ScrollBar::~ScrollBar()
{
auto highlight = _highlights;
while (highlight != NULL) {
while (highlight != nullptr) {
auto tmp = highlight->next;
delete highlight;
highlight = tmp;
@ -52,12 +52,12 @@ void ScrollBar::removeHighlightsWhere(std::function<bool(ScrollBarHighlight &)>
{
_mutex.lock();
ScrollBarHighlight *last = NULL;
ScrollBarHighlight *last = nullptr;
ScrollBarHighlight *current = _highlights;
while (current != NULL) {
while (current != nullptr) {
if (func(*current)) {
if (last == NULL) {
if (last == nullptr) {
_highlights = current->next;
} else {
last->next = current->next;
@ -79,7 +79,7 @@ void ScrollBar::addHighlight(ScrollBarHighlight *highlight)
{
_mutex.lock();
if (_highlights == NULL) {
if (_highlights == nullptr) {
_highlights = highlight;
} else {
highlight->next = _highlights->next;
@ -224,7 +224,7 @@ void ScrollBar::paintEvent(QPaintEvent *)
// do {
// painter.fillRect();
// } while ((highlight = highlight->next()) != NULL);
// } while ((highlight = highlight->next()) != nullptr);
_mutex.unlock();
}

View file

@ -289,7 +289,7 @@ void SettingsDialog::select(SettingsDialogTab *tab)
{
_pageStack.setCurrentWidget(tab->getWidget());
if (_selectedTab != NULL) {
if (_selectedTab != nullptr) {
_selectedTab->setSelected(false);
_selectedTab->setStyleSheet("color: #FFF");
}

View file

@ -42,7 +42,7 @@ private:
void addTabs();
SettingsDialogTab *_selectedTab = NULL;
SettingsDialogTab *_selectedTab = nullptr;
/// Widget creation helpers
QCheckBox *createCheckbox(const QString &title, Setting<bool> &setting);

View file

@ -15,7 +15,7 @@ class TextInputDialog : public QDialog
Q_OBJECT
public:
TextInputDialog(QWidget *parent = NULL);
TextInputDialog(QWidget *parent = nullptr);
QString getText() const
{