More c++11 (#478)

* Replace 0 and Q_NULLPTR with nullptr
* Use c++11 foreach
This commit is contained in:
Paul I 2018-05-04 10:58:32 +03:00 committed by xarkes
parent c4d7dd3383
commit bebc2ec36d
44 changed files with 81 additions and 81 deletions

View File

@ -11,7 +11,7 @@ class AnalThread : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AnalThread(OptionsDialog *parent = 0); explicit AnalThread(OptionsDialog *parent = nullptr);
~AnalThread(); ~AnalThread();
void start(MainWindow *main, int level, QList<QString> advanced); void start(MainWindow *main, int level, QList<QString> advanced);

View File

@ -288,7 +288,7 @@ void CutterCore::analyze(int level, QList<QString> advanced)
} else if (level == 2) { } else if (level == 2) {
r_core_cmd0(core_, "aaaa"); r_core_cmd0(core_, "aaaa");
} else if (level == 3) { } else if (level == 3) {
foreach (QString option, advanced) { for (QString option : advanced) {
r_core_cmd0(core_, option.toStdString().c_str()); r_core_cmd0(core_, option.toStdString().c_str());
} }
} }
@ -802,7 +802,7 @@ QList<RVA> CutterCore::getSeekHistory()
QList<RVA> ret; QList<RVA> ret;
QJsonArray jsonArray = cmdj("sj").array(); QJsonArray jsonArray = cmdj("sj").array();
foreach (QJsonValue value, jsonArray) for (QJsonValue value : jsonArray)
ret << value.toVariant().toULongLong(); ret << value.toVariant().toULongLong();
return ret; return ret;
@ -942,7 +942,7 @@ QList<FunctionDescription> CutterCore::getAllFunctions()
QJsonArray jsonArray = cmdj("aflj").array(); QJsonArray jsonArray = cmdj("aflj").array();
foreach (QJsonValue value, jsonArray) { for (QJsonValue value : jsonArray) {
QJsonObject jsonObject = value.toObject(); QJsonObject jsonObject = value.toObject();
FunctionDescription function; FunctionDescription function;
@ -969,7 +969,7 @@ QList<ImportDescription> CutterCore::getAllImports()
QJsonArray importsArray = cmdj("iij").array(); QJsonArray importsArray = cmdj("iij").array();
foreach (QJsonValue value, importsArray) { for (QJsonValue value : importsArray) {
QJsonObject importObject = value.toObject(); QJsonObject importObject = value.toObject();
ImportDescription import; ImportDescription import;
@ -993,7 +993,7 @@ QList<ExportDescription> CutterCore::getAllExports()
QJsonArray importsArray = cmdj("iEj").array(); QJsonArray importsArray = cmdj("iEj").array();
foreach (QJsonValue value, importsArray) { for (QJsonValue value : importsArray) {
QJsonObject importObject = value.toObject(); QJsonObject importObject = value.toObject();
ExportDescription exp; ExportDescription exp;
@ -1364,7 +1364,7 @@ QList<TypeDescription> CutterCore::getAllTypes()
QJsonArray typesArray = cmdj("tj").array(); QJsonArray typesArray = cmdj("tj").array();
foreach (QJsonValue value, typesArray) { for (QJsonValue value : typesArray) {
QJsonObject typeObject = value.toObject(); QJsonObject typeObject = value.toObject();
TypeDescription exp; TypeDescription exp;
@ -1387,11 +1387,11 @@ QList<SearchDescription> CutterCore::getAllSearch(QString search_for, QString sp
QJsonArray searchArray = cmdj(space + QString(" ") + search_for).array(); QJsonArray searchArray = cmdj(space + QString(" ") + search_for).array();
if (space == "/Rj") { if (space == "/Rj") {
foreach (QJsonValue value, searchArray) { for (QJsonValue value : searchArray) {
QJsonObject searchObject = value.toObject(); QJsonObject searchObject = value.toObject();
SearchDescription exp; SearchDescription exp;
exp.code = QString(""); exp.code = QString("");
foreach (QJsonValue value2, searchObject["opcodes"].toArray()) { for (QJsonValue value2 : searchObject["opcodes"].toArray()) {
QJsonObject gadget = value2.toObject(); QJsonObject gadget = value2.toObject();
exp.code += gadget["opcode"].toString() + "; "; exp.code += gadget["opcode"].toString() + "; ";
} }
@ -1403,7 +1403,7 @@ QList<SearchDescription> CutterCore::getAllSearch(QString search_for, QString sp
ret << exp; ret << exp;
} }
} else { } else {
foreach (QJsonValue value, searchArray) { for (QJsonValue value : searchArray) {
QJsonObject searchObject = value.toObject(); QJsonObject searchObject = value.toObject();
SearchDescription exp; SearchDescription exp;

View File

@ -283,7 +283,7 @@ class CutterCore: public QObject
friend class ccClass; friend class ccClass;
public: public:
explicit CutterCore(QObject *parent = 0); explicit CutterCore(QObject *parent = nullptr);
~CutterCore(); ~CutterCore();
static CutterCore *getInstance(); static CutterCore *getInstance();

View File

@ -376,13 +376,13 @@ void MainWindow::saveSettings()
void MainWindow::setPanelLock() void MainWindow::setPanelLock()
{ {
if (panelLock) { if (panelLock) {
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) { for (QDockWidget *dockWidget : findChildren<QDockWidget *>()) {
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
} }
ui->actionLock->setChecked(false); ui->actionLock->setChecked(false);
} else { } else {
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) { for (QDockWidget *dockWidget : findChildren<QDockWidget *>()) {
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
} }
@ -411,11 +411,11 @@ void MainWindow::refreshAll()
void MainWindow::lockUnlock_Docks(bool what) void MainWindow::lockUnlock_Docks(bool what)
{ {
if (what) { if (what) {
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) { for (QDockWidget *dockWidget : findChildren<QDockWidget *>()) {
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
} }
} else { } else {
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) { for (QDockWidget *dockWidget : findChildren<QDockWidget *>()) {
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
} }
} }
@ -549,12 +549,12 @@ void MainWindow::on_actionLock_triggered()
void MainWindow::on_actionLockUnlock_triggered() void MainWindow::on_actionLockUnlock_triggered()
{ {
if (ui->actionLockUnlock->isChecked()) { if (ui->actionLockUnlock->isChecked()) {
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) { for (QDockWidget *dockWidget : findChildren<QDockWidget *>()) {
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
} }
ui->actionLockUnlock->setIcon(QIcon(":/lock")); ui->actionLockUnlock->setIcon(QIcon(":/lock"));
} else { } else {
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) { for (QDockWidget *dockWidget : findChildren<QDockWidget *>()) {
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
} }
ui->actionLockUnlock->setIcon(QIcon(":/unlock")); ui->actionLockUnlock->setIcon(QIcon(":/unlock"));

View File

@ -58,7 +58,7 @@ class MainWindow : public QMainWindow
public: public:
bool responsive; bool responsive;
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
void openNewFile(const QString &fn, int analLevel = -1, void openNewFile(const QString &fn, int analLevel = -1,

View File

@ -13,7 +13,7 @@ class AboutDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit AboutDialog(QWidget *parent = 0); explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog(); ~AboutDialog();
private slots: private slots:

View File

@ -13,7 +13,7 @@ class CommentsDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit CommentsDialog(QWidget *parent = 0); explicit CommentsDialog(QWidget *parent = nullptr);
~CommentsDialog(); ~CommentsDialog();
QString getComment(); QString getComment();

View File

@ -14,7 +14,7 @@ class EditInstructionDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit EditInstructionDialog(QWidget *parent = 0); explicit EditInstructionDialog(QWidget *parent = nullptr);
~EditInstructionDialog(); ~EditInstructionDialog();
QString getInstruction(); QString getInstruction();

View File

@ -15,7 +15,7 @@ class FlagDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit FlagDialog(RVA offset, QWidget *parent = 0); explicit FlagDialog(RVA offset, QWidget *parent = nullptr);
~FlagDialog(); ~FlagDialog();
private slots: private slots:

View File

@ -14,7 +14,7 @@ class NewFileDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit NewFileDialog(QWidget *parent = 0); explicit NewFileDialog(QWidget *parent = nullptr);
~NewFileDialog(); ~NewFileDialog();
private slots: private slots:

View File

@ -15,7 +15,7 @@ class R2PluginsDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit R2PluginsDialog(QWidget *parent = 0); explicit R2PluginsDialog(QWidget *parent = nullptr);
~R2PluginsDialog(); ~R2PluginsDialog();
private: private:

View File

@ -13,7 +13,7 @@ class RenameDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit RenameDialog(QWidget *parent = 0); explicit RenameDialog(QWidget *parent = nullptr);
~RenameDialog(); ~RenameDialog();
void setName(QString fcnName); void setName(QString fcnName);

View File

@ -17,7 +17,7 @@ class SaveProjectDialog : public QDialog
public: public:
enum Result { Saved, Rejected, Destructive }; enum Result { Saved, Rejected, Destructive };
explicit SaveProjectDialog(bool quit, QWidget *parent = 0); explicit SaveProjectDialog(bool quit, QWidget *parent = nullptr);
~SaveProjectDialog(); ~SaveProjectDialog();
virtual void accept() override; virtual void accept() override;

View File

@ -64,7 +64,7 @@ void VersionInfoDialog::fillVersionInfo(){
QTreeWidgetItem *entriesItemL = new QTreeWidgetItem(); QTreeWidgetItem *entriesItemL = new QTreeWidgetItem();
entriesItemL->setText(0, "Entries:"); entriesItemL->setText(0, "Entries:");
foreach (QJsonValue val, versym["entries"].toArray()) { for (QJsonValue val : versym["entries"].toArray()) {
QJsonObject obj = val.toObject(); QJsonObject obj = val.toObject();
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, RAddressString(obj["idx"].toDouble())); tempItem->setText(0, RAddressString(obj["idx"].toDouble()));
@ -104,7 +104,7 @@ void VersionInfoDialog::fillVersionInfo(){
QTreeWidgetItem *entriesItemR = new QTreeWidgetItem(); QTreeWidgetItem *entriesItemR = new QTreeWidgetItem();
entriesItemR->setText(0, "Entries:"); entriesItemR->setText(0, "Entries:");
foreach (QJsonValue parentVal, verneed["entries"].toArray()) { for (QJsonValue parentVal : verneed["entries"].toArray()) {
QJsonObject parentObj = parentVal.toObject(); QJsonObject parentObj = parentVal.toObject();
QTreeWidgetItem *parentItem = new QTreeWidgetItem(); QTreeWidgetItem *parentItem = new QTreeWidgetItem();
QString parentString; QString parentString;
@ -113,7 +113,7 @@ void VersionInfoDialog::fillVersionInfo(){
parentString.append("File: " + parentObj["file_name"].toString()); parentString.append("File: " + parentObj["file_name"].toString());
parentItem->setText(1, parentString); parentItem->setText(1, parentString);
foreach (QJsonValue childVal, parentObj["vernaux"].toArray()) { for (QJsonValue childVal : parentObj["vernaux"].toArray()) {
QJsonObject childObj = childVal.toObject(); QJsonObject childObj = childVal.toObject();
QTreeWidgetItem *childItem = new QTreeWidgetItem(); QTreeWidgetItem *childItem = new QTreeWidgetItem();
QString childString; QString childString;
@ -143,7 +143,7 @@ void VersionInfoDialog::fillVersionInfo(){
ui->rightLabel->setText("String table"); ui->rightLabel->setText("String table");
// Left tree // Left tree
foreach (QString key, vs.keys()){ for (QString key : vs.keys()){
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, key); tempItem->setText(0, key);
if (vs[key].isDouble()) if (vs[key].isDouble())
@ -157,7 +157,7 @@ void VersionInfoDialog::fillVersionInfo(){
} }
// Right tree // Right tree
foreach (QString key, strings.keys()){ for (QString key : strings.keys()){
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, key); tempItem->setText(0, key);
tempItem->setText(1, strings[key].toString()); tempItem->setText(1, strings[key].toString());

View File

@ -15,7 +15,7 @@ class VersionInfoDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit VersionInfoDialog(QWidget *parent = 0); explicit VersionInfoDialog(QWidget *parent = nullptr);
~VersionInfoDialog(); ~VersionInfoDialog();
private: private:

View File

@ -18,7 +18,7 @@ class XrefsDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit XrefsDialog(QWidget *parent = 0); explicit XrefsDialog(QWidget *parent = nullptr);
~XrefsDialog(); ~XrefsDialog();
void fillRefsForAddress(RVA addr, QString name, bool whole_function); void fillRefsForAddress(RVA addr, QString name, bool whole_function);

View File

@ -18,7 +18,7 @@ AsciiHighlighter::AsciiHighlighter(QTextDocument *parent)
void AsciiHighlighter::highlightBlock(const QString &text) void AsciiHighlighter::highlightBlock(const QString &text)
{ {
foreach (const HighlightingRule &rule, highlightingRules) { for (const HighlightingRule &rule : highlightingRules) {
QRegExp expression(rule.pattern); QRegExp expression(rule.pattern);
int index = expression.indexIn(text); int index = expression.indexIn(text);
while (index >= 0) { while (index >= 0) {

View File

@ -13,7 +13,7 @@ class AsciiHighlighter : public QSyntaxHighlighter
Q_OBJECT Q_OBJECT
public: public:
explicit AsciiHighlighter(QTextDocument *parent = 0); explicit AsciiHighlighter(QTextDocument *parent = nullptr);
protected: protected:
void highlightBlock(const QString &text); void highlightBlock(const QString &text);

View File

@ -26,7 +26,7 @@ HexHighlighter::HexHighlighter(QTextDocument *parent)
<< "\\b6e\\b" << "\\b6f\\b" << "\\b70\\b" << "\\b71\\b" << "\\b72\\b" << "\\b73\\b" << "\\b74\\b" << "\\b6e\\b" << "\\b6f\\b" << "\\b70\\b" << "\\b71\\b" << "\\b72\\b" << "\\b73\\b" << "\\b74\\b"
<< "\\b75\\b" << "\\b76\\b" << "\\b77\\b" << "\\b78\\b" << "\\b79\\b" << "\\b7a\\b" << "\\b7b\\b" << "\\b75\\b" << "\\b76\\b" << "\\b77\\b" << "\\b78\\b" << "\\b79\\b" << "\\b7a\\b" << "\\b7b\\b"
<< "\\b7c\\b" << "\\b7d\\b" << "\\b7e\\b" << "\\b7f\\b"; << "\\b7c\\b" << "\\b7d\\b" << "\\b7e\\b" << "\\b7f\\b";
foreach (const QString &pattern, keywordPatterns) { for (const QString &pattern : keywordPatterns) {
rule.pattern = QRegExp(pattern); rule.pattern = QRegExp(pattern);
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive); rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
rule.format = keywordFormat; rule.format = keywordFormat;
@ -45,7 +45,7 @@ HexHighlighter::HexHighlighter(QTextDocument *parent)
void HexHighlighter::highlightBlock(const QString &text) void HexHighlighter::highlightBlock(const QString &text)
{ {
foreach (const HighlightingRule &rule, highlightingRules) { for (const HighlightingRule &rule : highlightingRules) {
QRegExp expression(rule.pattern); QRegExp expression(rule.pattern);
int index = expression.indexIn(text); int index = expression.indexIn(text);
while (index >= 0) { while (index >= 0) {

View File

@ -13,7 +13,7 @@ class HexHighlighter : public QSyntaxHighlighter
Q_OBJECT Q_OBJECT
public: public:
explicit HexHighlighter(QTextDocument *parent = 0); explicit HexHighlighter(QTextDocument *parent = nullptr);
protected: protected:
void highlightBlock(const QString &text); void highlightBlock(const QString &text);

View File

@ -13,7 +13,7 @@ Highlighter::Highlighter(QTextDocument *parent) :
keywordFormat.setForeground(QColor(65, 131, 215)); keywordFormat.setForeground(QColor(65, 131, 215));
keywordFormat.setFontWeight(QFont::Bold); keywordFormat.setFontWeight(QFont::Bold);
foreach (const QString &pattern, this->core->opcodes) { for (const QString &pattern : this->core->opcodes) {
rule.pattern = QRegExp("\\b" + pattern + "\\b"); rule.pattern = QRegExp("\\b" + pattern + "\\b");
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive); rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
rule.format = keywordFormat; rule.format = keywordFormat;
@ -23,7 +23,7 @@ Highlighter::Highlighter(QTextDocument *parent) :
regFormat.setForeground(QColor(236, 100, 75)); regFormat.setForeground(QColor(236, 100, 75));
regFormat.setFontWeight(QFont::Bold); regFormat.setFontWeight(QFont::Bold);
foreach (const QString &pattern, this->core->regs) { for (const QString &pattern : this->core->regs) {
rule.pattern = QRegExp("\\b" + pattern + "\\b"); rule.pattern = QRegExp("\\b" + pattern + "\\b");
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive); rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
rule.format = regFormat; rule.format = regFormat;
@ -43,7 +43,7 @@ Highlighter::Highlighter(QTextDocument *parent) :
void Highlighter::highlightBlock(const QString &text) void Highlighter::highlightBlock(const QString &text)
{ {
foreach (const HighlightingRule &rule, highlightingRules) { for (const HighlightingRule &rule : highlightingRules) {
QRegExp expression(rule.pattern); QRegExp expression(rule.pattern);
int index = expression.indexIn(text); int index = expression.indexIn(text);
while (index >= 0) { while (index >= 0) {

View File

@ -15,7 +15,7 @@ class Highlighter : public QSyntaxHighlighter
Q_OBJECT Q_OBJECT
public: public:
Highlighter(QTextDocument *parent = 0); Highlighter(QTextDocument *parent = nullptr);
protected: protected:
void highlightBlock(const QString &text); void highlightBlock(const QString &text);

View File

@ -17,7 +17,7 @@ class JsonModel : public QAbstractItemModel
{ {
public: public:
explicit JsonModel(QObject *parent = 0); explicit JsonModel(QObject *parent = nullptr);
bool load(QIODevice *device); bool load(QIODevice *device);
bool loadJson(const QByteArray &json); bool loadJson(const QByteArray &json);
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;

View File

@ -13,7 +13,7 @@
class JsonTreeItem class JsonTreeItem
{ {
public: public:
JsonTreeItem(JsonTreeItem *parent = 0); JsonTreeItem(JsonTreeItem *parent = nullptr);
~JsonTreeItem(); ~JsonTreeItem();
void appendChild(JsonTreeItem *item); void appendChild(JsonTreeItem *item);
JsonTreeItem *child(int row); JsonTreeItem *child(int row);
@ -26,7 +26,7 @@ public:
QString key() const; QString key() const;
QString value() const; QString value() const;
QJsonValue::Type type() const; QJsonValue::Type type() const;
static JsonTreeItem *load(const QJsonValue &value, JsonTreeItem *parent = 0); static JsonTreeItem *load(const QJsonValue &value, JsonTreeItem *parent = nullptr);
private: private:
QString mKey; QString mKey;

View File

@ -15,7 +15,7 @@ MdHighlighter::MdHighlighter(QTextDocument *parent)
<< "\\*([^\\\\]+)\\*" << "\\_([^\\\\]+)\\_" << "\\*([^\\\\]+)\\*" << "\\_([^\\\\]+)\\_"
<< "\\_\\_([^\\\\]+)\\_\\_"; << "\\_\\_([^\\\\]+)\\_\\_";
foreach (const QString &pattern, keywordPatterns) { for (const QString &pattern : keywordPatterns) {
rule.pattern = QRegExp(pattern); rule.pattern = QRegExp(pattern);
rule.format = keywordFormat; rule.format = keywordFormat;
highlightingRules.append(rule); highlightingRules.append(rule);
@ -30,7 +30,7 @@ MdHighlighter::MdHighlighter(QTextDocument *parent)
void MdHighlighter::highlightBlock(const QString &text) void MdHighlighter::highlightBlock(const QString &text)
{ {
foreach (const HighlightingRule &rule, highlightingRules) { for (const HighlightingRule &rule : highlightingRules) {
QRegExp expression(rule.pattern); QRegExp expression(rule.pattern);
int index = expression.indexIn(text); int index = expression.indexIn(text);
while (index >= 0) { while (index >= 0) {

View File

@ -13,7 +13,7 @@ class MdHighlighter : public QSyntaxHighlighter
Q_OBJECT Q_OBJECT
public: public:
explicit MdHighlighter(QTextDocument *parent = 0); explicit MdHighlighter(QTextDocument *parent = nullptr);
protected: protected:
void highlightBlock(const QString &text); void highlightBlock(const QString &text);

View File

@ -33,7 +33,7 @@ public:
static const int NameRole = Qt::UserRole + 1; static const int NameRole = Qt::UserRole + 1;
static const int TypeRole = Qt::UserRole + 2; static const int TypeRole = Qt::UserRole + 2;
explicit ClassesModel(QList<ClassDescription> *classes, QObject *parent = 0); explicit ClassesModel(QList<ClassDescription> *classes, QObject *parent = nullptr);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const override; QModelIndex parent(const QModelIndex &index) const override;
@ -57,7 +57,7 @@ class ClassesSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
explicit ClassesSortFilterProxyModel(ClassesModel *source_model, QObject *parent = 0); explicit ClassesSortFilterProxyModel(ClassesModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -30,7 +30,7 @@ public:
enum Role { CommentDescriptionRole = Qt::UserRole, FunctionRole }; enum Role { CommentDescriptionRole = Qt::UserRole, FunctionRole };
CommentsModel(QList<CommentDescription> *comments, QMap<QString, QList<CommentDescription>> *nestedComments, CommentsModel(QList<CommentDescription> *comments, QMap<QString, QList<CommentDescription>> *nestedComments,
QObject *parent = Q_NULLPTR); QObject *parent = nullptr);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const; QModelIndex parent(const QModelIndex &index) const;
@ -53,7 +53,7 @@ class CommentsProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
CommentsProxyModel(CommentsModel *sourceModel, QObject *parent = Q_NULLPTR); CommentsProxyModel(CommentsModel *sourceModel, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -27,7 +27,7 @@ public:
enum Column { OffsetColumn = 0, SizeColumn, TypeColumn, NameColumn, ColumnCount }; enum Column { OffsetColumn = 0, SizeColumn, TypeColumn, NameColumn, ColumnCount };
enum Role { ExportDescriptionRole = Qt::UserRole }; enum Role { ExportDescriptionRole = Qt::UserRole };
ExportsModel(QList<ExportDescription> *exports, QObject *parent = Q_NULLPTR); ExportsModel(QList<ExportDescription> *exports, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -44,7 +44,7 @@ class ExportsProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
ExportsProxyModel(ExportsModel *source_model, QObject *parent = Q_NULLPTR); ExportsProxyModel(ExportsModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -24,7 +24,7 @@ public:
enum Columns { OFFSET = 0, SIZE, NAME, COUNT }; enum Columns { OFFSET = 0, SIZE, NAME, COUNT };
static const int FlagDescriptionRole = Qt::UserRole; static const int FlagDescriptionRole = Qt::UserRole;
FlagsModel(QList<FlagDescription> *flags, QObject *parent = 0); FlagsModel(QList<FlagDescription> *flags, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -43,7 +43,7 @@ class FlagsSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
FlagsSortFilterProxyModel(FlagsModel *source_model, QObject *parent = 0); FlagsSortFilterProxyModel(FlagsModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -438,7 +438,7 @@ void FunctionsWidget::refreshTree()
functions = Core()->getAllFunctions(); functions = Core()->getAllFunctions();
importAddresses.clear(); importAddresses.clear();
foreach (ImportDescription import, Core()->getAllImports()) for (ImportDescription import : Core()->getAllImports())
importAddresses.insert(import.plt); importAddresses.insert(import.plt);
mainAdress = (ut64)Core()->cmdj("iMj").object()["vaddr"].toInt(); mainAdress = (ut64)Core()->cmdj("iMj").object()["vaddr"].toInt();

View File

@ -45,7 +45,7 @@ public:
NlocalsColumn, CcColumn, CalltypeColumn, ColumnCount }; NlocalsColumn, CcColumn, CalltypeColumn, ColumnCount };
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress, FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress,
bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = 0); bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = nullptr);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const; QModelIndex parent(const QModelIndex &index) const;
@ -81,7 +81,7 @@ class FunctionSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
FunctionSortFilterProxyModel(FunctionModel *source_model, QObject *parent = 0); FunctionSortFilterProxyModel(FunctionModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -62,7 +62,7 @@ class ImportsProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
ImportsProxyModel(ImportsModel *sourceModel, QObject *parent = Q_NULLPTR); ImportsProxyModel(ImportsModel *sourceModel, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -9,7 +9,7 @@ class Omnibar : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Omnibar(MainWindow *main, QWidget *parent = 0); explicit Omnibar(MainWindow *main, QWidget *parent = nullptr);
void refresh(const QStringList &flagList); void refresh(const QStringList &flagList);

View File

@ -49,7 +49,7 @@ class PieView : public QAbstractItemView
Q_OBJECT Q_OBJECT
public: public:
explicit PieView(QWidget *parent = 0); explicit PieView(QWidget *parent = nullptr);
QRect visualRect(const QModelIndex &index) const override; QRect visualRect(const QModelIndex &index) const override;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override; void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;

View File

@ -25,7 +25,7 @@ public:
enum Column { VAddrColumn = 0, TypeColumn, NameColumn, ColumnCount }; enum Column { VAddrColumn = 0, TypeColumn, NameColumn, ColumnCount };
enum Role { RelocDescriptionRole = Qt::UserRole, AddressRole }; enum Role { RelocDescriptionRole = Qt::UserRole, AddressRole };
RelocsModel(QList<RelocDescription> *relocs, QObject* parent = Q_NULLPTR); RelocsModel(QList<RelocDescription> *relocs, QObject* parent = nullptr);
int rowCount(const QModelIndex &parent) const; int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const;
@ -42,7 +42,7 @@ class RelocsProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
RelocsProxyModel(RelocsModel *sourceModel, QObject *parent = Q_NULLPTR); RelocsProxyModel(RelocsModel *sourceModel, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -33,7 +33,7 @@ void SdbDock::reload(QString _path)
QList<QString> keys; QList<QString> keys;
/* key-values */ /* key-values */
keys = Core()->sdbListKeys(path); keys = Core()->sdbListKeys(path);
foreach (QString key, keys) { for (QString key : keys) {
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, key); tempItem->setText(0, key);
tempItem->setText(1, Core()->sdbGet(path, key)); tempItem->setText(1, Core()->sdbGet(path, key));
@ -45,7 +45,7 @@ void SdbDock::reload(QString _path)
/* namespaces */ /* namespaces */
keys = Core()->sdbList(path); keys = Core()->sdbList(path);
keys.append(".."); keys.append("..");
foreach (QString key, keys) { for (QString key : keys) {
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, key + "/"); tempItem->setText(0, key + "/");
tempItem->setText(1, ""); tempItem->setText(1, "");

View File

@ -24,7 +24,7 @@ public:
enum Columns { OFFSET = 0, SIZE, CODE, DATA, COUNT }; enum Columns { OFFSET = 0, SIZE, CODE, DATA, COUNT };
static const int SearchDescriptionRole = Qt::UserRole; static const int SearchDescriptionRole = Qt::UserRole;
SearchModel(QList<SearchDescription> *search, QObject *parent = 0); SearchModel(QList<SearchDescription> *search, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -43,7 +43,7 @@ class SearchSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
SearchSortFilterProxyModel(SearchModel *source_model, QObject *parent = 0); SearchSortFilterProxyModel(SearchModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -30,7 +30,7 @@ public:
enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, ColumnCount }; enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, ColumnCount };
enum Role { SectionDescriptionRole = Qt::UserRole }; enum Role { SectionDescriptionRole = Qt::UserRole };
SectionsModel(QList<SectionDescription> *sections, QObject *parent = Q_NULLPTR); SectionsModel(QList<SectionDescription> *sections, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -47,7 +47,7 @@ class SectionsProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
SectionsProxyModel(SectionsModel *sourceModel, QObject *parent = Q_NULLPTR); SectionsProxyModel(SectionsModel *sourceModel, QObject *parent = nullptr);
private slots: private slots:
void onSourceModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, void onSourceModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight,
@ -62,7 +62,7 @@ class SectionsWidget : public CutterDockWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SectionsWidget(MainWindow *main, QAction *action = Q_NULLPTR); explicit SectionsWidget(MainWindow *main, QAction *action = nullptr);
~SectionsWidget(); ~SectionsWidget();
protected: protected:

View File

@ -190,7 +190,7 @@ void SidebarWidget::fillOffsetInfo(QString off)
ui->offsetTreeWidget->clear(); ui->offsetTreeWidget->clear();
QString raw = Core()->getOffsetInfo(off); QString raw = Core()->getOffsetInfo(off);
QList<QString> lines = raw.split("\n", QString::SkipEmptyParts); QList<QString> lines = raw.split("\n", QString::SkipEmptyParts);
foreach (QString line, lines) { for (QString line : lines) {
QList<QString> eles = line.split(":", QString::SkipEmptyParts); QList<QString> eles = line.split(":", QString::SkipEmptyParts);
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, eles.at(0).toUpper()); tempItem->setText(0, eles.at(0).toUpper());
@ -239,11 +239,11 @@ void SidebarWidget::fillRegistersInfo()
ui->regInfoTreeWidget->clear(); ui->regInfoTreeWidget->clear();
QJsonObject jsonRoot = Core()->getRegistersInfo().object(); QJsonObject jsonRoot = Core()->getRegistersInfo().object();
foreach (QString key, jsonRoot.keys()) { for (QString key : jsonRoot.keys()) {
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
QString tempString; QString tempString;
tempItem->setText(0, key.toUpper()); tempItem->setText(0, key.toUpper());
foreach (QJsonValue value, jsonRoot[key].toArray()) { for (QJsonValue value : jsonRoot[key].toArray()) {
tempString.append(value.toString() + " "); tempString.append(value.toString() + " ");
} }
tempItem->setText(1, tempString); tempItem->setText(1, tempString);

View File

@ -27,7 +27,7 @@ public:
enum Columns { OFFSET = 0, STRING, TYPE, LENGTH, SIZE, COUNT }; enum Columns { OFFSET = 0, STRING, TYPE, LENGTH, SIZE, COUNT };
static const int StringDescriptionRole = Qt::UserRole; static const int StringDescriptionRole = Qt::UserRole;
StringsModel(QList<StringDescription> *strings, QObject *parent = 0); StringsModel(QList<StringDescription> *strings, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -46,7 +46,7 @@ class StringsSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
StringsSortFilterProxyModel(StringsModel *source_model, QObject *parent = 0); StringsSortFilterProxyModel(StringsModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -26,7 +26,7 @@ public:
enum Column { AddressColumn = 0, TypeColumn, NameColumn, ColumnCount }; enum Column { AddressColumn = 0, TypeColumn, NameColumn, ColumnCount };
enum Role { SymbolDescriptionRole = Qt::UserRole }; enum Role { SymbolDescriptionRole = Qt::UserRole };
SymbolsModel(QList<SymbolDescription> *exports, QObject *parent = Q_NULLPTR); SymbolsModel(QList<SymbolDescription> *exports, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -43,7 +43,7 @@ class SymbolsProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
SymbolsProxyModel(SymbolsModel *sourceModel, QObject *parent = Q_NULLPTR); SymbolsProxyModel(SymbolsModel *sourceModel, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -32,7 +32,7 @@ public:
enum Columns { TYPE = 0, SIZE, FORMAT, COUNT }; enum Columns { TYPE = 0, SIZE, FORMAT, COUNT };
static const int TypeDescriptionRole = Qt::UserRole; static const int TypeDescriptionRole = Qt::UserRole;
TypesModel(QList<TypeDescription> *types, QObject *parent = 0); TypesModel(QList<TypeDescription> *types, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -51,7 +51,7 @@ class TypesSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
TypesSortFilterProxyModel(TypesModel *source_model, QObject *parent = 0); TypesSortFilterProxyModel(TypesModel *source_model, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;

View File

@ -35,7 +35,7 @@ class VisualNavbar : public QToolBar
}; };
public: public:
explicit VisualNavbar(MainWindow *main, QWidget *parent = 0); explicit VisualNavbar(MainWindow *main, QWidget *parent = nullptr);
public slots: public slots:
void paintEvent(QPaintEvent *event) override; void paintEvent(QPaintEvent *event) override;