2015-08-16 17:36:10 +02:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2023-01-28 10:16:34 +01:00
|
|
|
* Copyright (C) 2007-2023 Cppcheck team.
|
2015-08-16 17:36:10 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "librarydialog.h"
|
2022-02-02 16:17:28 +01:00
|
|
|
|
|
|
|
#include "common.h"
|
2015-08-30 10:24:44 +02:00
|
|
|
#include "libraryaddfunctiondialog.h"
|
2015-08-30 13:33:43 +02:00
|
|
|
#include "libraryeditargdialog.h"
|
2015-11-28 18:31:56 +01:00
|
|
|
#include "path.h"
|
2023-09-11 11:34:22 +02:00
|
|
|
#include "utils.h"
|
2015-08-16 17:36:10 +02:00
|
|
|
|
2022-03-19 19:54:20 +01:00
|
|
|
#include "ui_librarydialog.h"
|
|
|
|
|
2023-04-08 16:08:47 +02:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
2015-08-16 17:36:10 +02:00
|
|
|
#include <QFile>
|
|
|
|
#include <QFileDialog>
|
2023-04-08 16:08:47 +02:00
|
|
|
#include <QFlags>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QList>
|
|
|
|
#include <QListWidget>
|
|
|
|
#include <QListWidgetItem>
|
2015-11-28 18:31:56 +01:00
|
|
|
#include <QMessageBox>
|
2023-04-08 16:08:47 +02:00
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include <QPushButton>
|
2022-03-23 18:16:22 +01:00
|
|
|
#include <QRegularExpression>
|
2022-02-02 16:17:28 +01:00
|
|
|
#include <QTextStream>
|
2023-04-08 16:08:47 +02:00
|
|
|
#include <Qt>
|
2015-08-16 17:36:10 +02:00
|
|
|
|
2022-04-13 12:24:00 +02:00
|
|
|
class QWidget;
|
|
|
|
|
2015-08-16 17:36:10 +02:00
|
|
|
// TODO: get/compare functions from header
|
|
|
|
|
2023-11-16 15:49:41 +01:00
|
|
|
namespace {
|
|
|
|
class FunctionListItem : public QListWidgetItem {
|
|
|
|
public:
|
|
|
|
FunctionListItem(QListWidget *view,
|
|
|
|
CppcheckLibraryData::Function *function,
|
|
|
|
bool selected)
|
|
|
|
: QListWidgetItem(view), function(function) {
|
|
|
|
setText(function->name);
|
|
|
|
setFlags(flags() | Qt::ItemIsEditable);
|
|
|
|
setSelected(selected);
|
|
|
|
}
|
|
|
|
CppcheckLibraryData::Function *function;
|
|
|
|
};
|
|
|
|
}
|
2015-09-08 15:38:02 +02:00
|
|
|
|
2015-08-16 17:36:10 +02:00
|
|
|
LibraryDialog::LibraryDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
2023-08-08 11:05:02 +02:00
|
|
|
mUi(new Ui::LibraryDialog)
|
2015-08-16 17:36:10 +02:00
|
|
|
{
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->setupUi(this);
|
|
|
|
mUi->buttonSave->setEnabled(false);
|
|
|
|
mUi->buttonSaveAs->setEnabled(false);
|
|
|
|
mUi->sortFunctions->setEnabled(false);
|
|
|
|
mUi->filter->setEnabled(false);
|
|
|
|
mUi->addFunction->setEnabled(false);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
|
|
|
//As no function selected, this disables function editing widgets
|
|
|
|
selectFunction();
|
2015-08-16 17:36:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
LibraryDialog::~LibraryDialog()
|
|
|
|
{
|
2018-06-18 10:13:33 +02:00
|
|
|
delete mUi;
|
2015-08-16 17:36:10 +02:00
|
|
|
}
|
2015-08-29 17:24:56 +02:00
|
|
|
|
2015-09-06 14:20:27 +02:00
|
|
|
CppcheckLibraryData::Function *LibraryDialog::currentFunction()
|
|
|
|
{
|
2018-06-18 10:13:33 +02:00
|
|
|
QList<QListWidgetItem *> selitems = mUi->functions->selectedItems();
|
2015-09-06 14:20:27 +02:00
|
|
|
if (selitems.count() != 1)
|
|
|
|
return nullptr;
|
2017-09-02 10:34:02 +02:00
|
|
|
return static_cast<FunctionListItem *>(selitems.first())->function;
|
2015-09-06 14:20:27 +02:00
|
|
|
}
|
|
|
|
|
2015-08-16 17:36:10 +02:00
|
|
|
void LibraryDialog::openCfg()
|
|
|
|
{
|
2020-08-29 21:26:49 +02:00
|
|
|
const QString datadir = getDataDir();
|
2015-08-16 17:36:10 +02:00
|
|
|
|
|
|
|
QString selectedFilter;
|
|
|
|
const QString filter(tr("Library files (*.cfg)"));
|
|
|
|
const QString selectedFile = QFileDialog::getOpenFileName(this,
|
2021-08-07 20:51:18 +02:00
|
|
|
tr("Open library file"),
|
|
|
|
datadir,
|
|
|
|
filter,
|
|
|
|
&selectedFilter);
|
2015-08-16 17:36:10 +02:00
|
|
|
|
2017-11-11 21:52:36 +01:00
|
|
|
if (selectedFile.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QFile file(selectedFile);
|
2017-11-12 21:03:22 +01:00
|
|
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
2017-11-11 21:52:36 +01:00
|
|
|
QMessageBox msg(QMessageBox::Critical,
|
|
|
|
tr("Cppcheck"),
|
2019-07-12 17:55:44 +02:00
|
|
|
tr("Cannot open file %1.").arg(selectedFile),
|
2017-11-11 21:52:36 +01:00
|
|
|
QMessageBox::Ok,
|
|
|
|
this);
|
|
|
|
msg.exec();
|
2017-11-12 21:03:22 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CppcheckLibraryData tempdata;
|
|
|
|
const QString errmsg = tempdata.open(file);
|
|
|
|
if (!errmsg.isNull()) {
|
|
|
|
QMessageBox msg(QMessageBox::Critical,
|
|
|
|
tr("Cppcheck"),
|
2023-12-27 10:36:18 +01:00
|
|
|
tr("Failed to load %1. %2.").arg(selectedFile, errmsg),
|
2017-11-12 21:03:22 +01:00
|
|
|
QMessageBox::Ok,
|
|
|
|
this);
|
|
|
|
msg.exec();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = true;
|
|
|
|
mData.swap(tempdata);
|
2017-11-12 21:03:22 +01:00
|
|
|
mFileName = selectedFile;
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->buttonSave->setEnabled(false);
|
|
|
|
mUi->buttonSaveAs->setEnabled(true);
|
|
|
|
mUi->filter->clear();
|
|
|
|
mUi->functions->clear();
|
2018-06-18 14:11:34 +02:00
|
|
|
for (CppcheckLibraryData::Function &function : mData.functions) {
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->functions->addItem(new FunctionListItem(mUi->functions,
|
2021-08-07 20:51:18 +02:00
|
|
|
&function,
|
|
|
|
false));
|
2015-08-16 17:36:10 +02:00
|
|
|
}
|
2018-06-18 14:11:34 +02:00
|
|
|
mUi->sortFunctions->setEnabled(!mData.functions.empty());
|
|
|
|
mUi->filter->setEnabled(!mData.functions.empty());
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->addFunction->setEnabled(true);
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = false;
|
2015-08-23 12:49:51 +02:00
|
|
|
}
|
2015-08-16 17:36:10 +02:00
|
|
|
|
2015-08-23 12:49:51 +02:00
|
|
|
void LibraryDialog::saveCfg()
|
|
|
|
{
|
2015-08-23 16:03:24 +02:00
|
|
|
if (mFileName.isNull())
|
|
|
|
return;
|
2015-08-23 12:49:51 +02:00
|
|
|
QFile file(mFileName);
|
|
|
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
2015-08-23 13:34:50 +02:00
|
|
|
QTextStream ts(&file);
|
2018-06-18 14:11:34 +02:00
|
|
|
ts << mData.toString() << '\n';
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->buttonSave->setEnabled(false);
|
2015-11-28 18:31:56 +01:00
|
|
|
} else {
|
|
|
|
QMessageBox msg(QMessageBox::Critical,
|
|
|
|
tr("Cppcheck"),
|
2019-07-12 17:55:44 +02:00
|
|
|
tr("Cannot save file %1.").arg(mFileName),
|
2015-11-28 18:31:56 +01:00
|
|
|
QMessageBox::Ok,
|
|
|
|
this);
|
|
|
|
msg.exec();
|
2015-08-23 12:49:51 +02:00
|
|
|
}
|
2015-08-16 17:36:10 +02:00
|
|
|
}
|
|
|
|
|
2015-11-28 18:31:56 +01:00
|
|
|
void LibraryDialog::saveCfgAs()
|
|
|
|
{
|
|
|
|
const QString filter(tr("Library files (*.cfg)"));
|
|
|
|
const QString path = Path::getPathFromFilename(mFileName.toStdString()).c_str();
|
|
|
|
QString selectedFile = QFileDialog::getSaveFileName(this,
|
2021-08-07 20:51:18 +02:00
|
|
|
tr("Save the library as"),
|
|
|
|
path,
|
|
|
|
filter);
|
2015-11-29 16:20:18 +01:00
|
|
|
if (selectedFile.isEmpty())
|
|
|
|
return;
|
|
|
|
|
2015-11-28 18:31:56 +01:00
|
|
|
if (!selectedFile.endsWith(".cfg", Qt::CaseInsensitive))
|
|
|
|
selectedFile += ".cfg";
|
|
|
|
|
|
|
|
mFileName = selectedFile;
|
|
|
|
saveCfg();
|
|
|
|
}
|
|
|
|
|
2015-08-29 18:50:08 +02:00
|
|
|
void LibraryDialog::addFunction()
|
|
|
|
{
|
2015-08-30 10:24:44 +02:00
|
|
|
LibraryAddFunctionDialog *d = new LibraryAddFunctionDialog;
|
2015-08-30 13:33:43 +02:00
|
|
|
if (d->exec() == QDialog::Accepted && !d->functionName().isEmpty()) {
|
2015-08-30 10:24:44 +02:00
|
|
|
|
2015-08-30 13:41:57 +02:00
|
|
|
CppcheckLibraryData::Function f;
|
2015-08-30 13:33:43 +02:00
|
|
|
f.name = d->functionName();
|
2022-10-02 07:12:40 +02:00
|
|
|
const int args = d->numberOfArguments();
|
2015-08-30 10:24:44 +02:00
|
|
|
|
2015-08-30 13:33:43 +02:00
|
|
|
for (int i = 1; i <= args; i++) {
|
2015-08-30 13:41:57 +02:00
|
|
|
CppcheckLibraryData::Function::Arg arg;
|
2015-08-30 13:33:43 +02:00
|
|
|
arg.nr = i;
|
|
|
|
f.args.append(arg);
|
|
|
|
}
|
2018-06-18 14:11:34 +02:00
|
|
|
mData.functions.append(f);
|
|
|
|
mUi->functions->addItem(new FunctionListItem(mUi->functions, &mData.functions.back(), false));
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->buttonSave->setEnabled(true);
|
2018-06-18 14:11:34 +02:00
|
|
|
mUi->sortFunctions->setEnabled(!mData.functions.empty());
|
|
|
|
mUi->filter->setEnabled(!mData.functions.empty());
|
2015-08-29 18:50:08 +02:00
|
|
|
}
|
2015-08-30 13:33:43 +02:00
|
|
|
delete d;
|
2015-08-29 18:50:08 +02:00
|
|
|
}
|
|
|
|
|
2015-09-08 15:38:02 +02:00
|
|
|
void LibraryDialog::editFunctionName(QListWidgetItem* item)
|
|
|
|
{
|
2018-06-18 14:11:34 +02:00
|
|
|
if (mIgnoreChanges)
|
2015-09-08 15:38:02 +02:00
|
|
|
return;
|
|
|
|
QString functionName = item->text();
|
|
|
|
CppcheckLibraryData::Function * const function = dynamic_cast<FunctionListItem*>(item)->function;
|
|
|
|
if (functionName != function->name) {
|
2022-03-23 18:16:22 +01:00
|
|
|
const QRegularExpressionMatch matchRes = QRegularExpression("^" NAMES "$").match(functionName);
|
|
|
|
if (matchRes.hasMatch()) {
|
2015-09-08 15:38:02 +02:00
|
|
|
function->name = functionName;
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->buttonSave->setEnabled(true);
|
2015-09-08 15:38:02 +02:00
|
|
|
} else {
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = true;
|
2015-09-08 15:38:02 +02:00
|
|
|
item->setText(function->name);
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = false;
|
2015-09-08 15:38:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-06 14:20:27 +02:00
|
|
|
void LibraryDialog::selectFunction()
|
2015-08-16 17:36:10 +02:00
|
|
|
{
|
2015-09-06 14:20:27 +02:00
|
|
|
const CppcheckLibraryData::Function * const function = currentFunction();
|
|
|
|
|
|
|
|
if (function == nullptr) {
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->comments->clear();
|
|
|
|
mUi->comments->setEnabled(false);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->noreturn->setCurrentIndex(0);
|
|
|
|
mUi->noreturn->setEnabled(false);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->useretval->setChecked(false);
|
|
|
|
mUi->useretval->setEnabled(false);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->leakignore->setChecked(false);
|
|
|
|
mUi->leakignore->setEnabled(false);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->arguments->clear();
|
|
|
|
mUi->arguments->setEnabled(false);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->editArgButton->setEnabled(false);
|
2015-08-30 02:49:17 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = true;
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->comments->setPlainText(function->comments);
|
|
|
|
mUi->comments->setEnabled(true);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->noreturn->setCurrentIndex(function->noreturn);
|
|
|
|
mUi->noreturn->setEnabled(true);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->useretval->setChecked(function->useretval);
|
|
|
|
mUi->useretval->setEnabled(true);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->leakignore->setChecked(function->leakignore);
|
|
|
|
mUi->leakignore->setEnabled(true);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2015-09-06 14:20:27 +02:00
|
|
|
updateArguments(*function);
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->arguments->setEnabled(true);
|
2015-11-05 16:34:08 +01:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->editArgButton->setEnabled(true);
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = false;
|
2015-08-16 17:36:10 +02:00
|
|
|
}
|
2015-08-23 12:49:51 +02:00
|
|
|
|
2015-09-06 14:20:27 +02:00
|
|
|
void LibraryDialog::sortFunctions(bool sort)
|
|
|
|
{
|
2015-09-08 15:38:02 +02:00
|
|
|
if (sort) {
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->functions->sortItems();
|
2015-09-08 15:38:02 +02:00
|
|
|
} else {
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = true;
|
2023-05-22 19:53:51 +02:00
|
|
|
const CppcheckLibraryData::Function* selfunction = currentFunction();
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->functions->clear();
|
2018-06-18 14:11:34 +02:00
|
|
|
for (CppcheckLibraryData::Function &function : mData.functions) {
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->functions->addItem(new FunctionListItem(mUi->functions,
|
2021-08-07 20:51:18 +02:00
|
|
|
&function,
|
|
|
|
selfunction == &function));
|
2015-09-06 14:54:21 +02:00
|
|
|
}
|
2018-06-18 10:13:33 +02:00
|
|
|
if (!mUi->filter->text().isEmpty())
|
|
|
|
filterFunctions(mUi->filter->text());
|
2018-06-18 14:11:34 +02:00
|
|
|
mIgnoreChanges = false;
|
2015-09-06 14:20:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-07 11:33:08 +01:00
|
|
|
void LibraryDialog::filterFunctions(const QString& filter)
|
2015-09-03 20:36:26 +02:00
|
|
|
{
|
2018-06-18 10:13:33 +02:00
|
|
|
QList<QListWidgetItem *> allItems = mUi->functions->findItems(QString(), Qt::MatchContains);
|
2015-09-06 14:20:27 +02:00
|
|
|
|
|
|
|
if (filter.isEmpty()) {
|
2022-03-21 17:14:26 +01:00
|
|
|
for (QListWidgetItem *item : allItems) {
|
2015-09-06 14:20:27 +02:00
|
|
|
item->setHidden(false);
|
|
|
|
}
|
|
|
|
} else {
|
2022-03-21 17:14:26 +01:00
|
|
|
for (QListWidgetItem *item : allItems) {
|
2015-09-06 14:20:27 +02:00
|
|
|
item->setHidden(!item->text().startsWith(filter));
|
|
|
|
}
|
|
|
|
}
|
2015-09-03 20:36:26 +02:00
|
|
|
}
|
|
|
|
|
2015-08-23 12:49:51 +02:00
|
|
|
void LibraryDialog::changeFunction()
|
|
|
|
{
|
2018-06-18 14:11:34 +02:00
|
|
|
if (mIgnoreChanges)
|
2015-08-29 17:24:56 +02:00
|
|
|
return;
|
2015-09-06 14:20:27 +02:00
|
|
|
|
|
|
|
CppcheckLibraryData::Function *function = currentFunction();
|
2015-11-05 16:34:08 +01:00
|
|
|
if (!function)
|
|
|
|
return;
|
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
function->comments = mUi->comments->toPlainText();
|
|
|
|
function->noreturn = (CppcheckLibraryData::Function::TrueFalseUnknown)mUi->noreturn->currentIndex();
|
|
|
|
function->useretval = mUi->useretval->isChecked();
|
|
|
|
function->leakignore = mUi->leakignore->isChecked();
|
2015-09-06 14:20:27 +02:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->buttonSave->setEnabled(true);
|
2015-08-23 12:49:51 +02:00
|
|
|
}
|
|
|
|
|
2015-08-30 13:33:43 +02:00
|
|
|
void LibraryDialog::editArg()
|
2015-08-29 17:24:56 +02:00
|
|
|
{
|
2015-09-06 14:20:27 +02:00
|
|
|
CppcheckLibraryData::Function *function = currentFunction();
|
|
|
|
if (!function)
|
2015-08-30 13:33:43 +02:00
|
|
|
return;
|
2015-09-06 14:20:27 +02:00
|
|
|
|
2018-06-18 10:13:33 +02:00
|
|
|
if (mUi->arguments->selectedItems().count() != 1)
|
2015-08-29 17:24:56 +02:00
|
|
|
return;
|
2018-06-18 10:13:33 +02:00
|
|
|
CppcheckLibraryData::Function::Arg &arg = function->args[mUi->arguments->row(mUi->arguments->selectedItems().first())];
|
2015-08-30 13:33:43 +02:00
|
|
|
|
2019-07-02 20:37:44 +02:00
|
|
|
LibraryEditArgDialog d(nullptr, arg);
|
|
|
|
if (d.exec() == QDialog::Accepted) {
|
2022-10-02 07:12:40 +02:00
|
|
|
const unsigned number = arg.nr;
|
2019-07-02 20:37:44 +02:00
|
|
|
arg = d.getArg();
|
2015-11-26 18:58:13 +01:00
|
|
|
arg.nr = number;
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->arguments->selectedItems().first()->setText(getArgText(arg));
|
2015-08-29 17:24:56 +02:00
|
|
|
}
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->buttonSave->setEnabled(true);
|
2015-08-29 17:24:56 +02:00
|
|
|
}
|
|
|
|
|
2015-08-30 18:37:12 +02:00
|
|
|
QString LibraryDialog::getArgText(const CppcheckLibraryData::Function::Arg &arg)
|
|
|
|
{
|
|
|
|
QString s("arg");
|
|
|
|
if (arg.nr != CppcheckLibraryData::Function::Arg::ANY)
|
|
|
|
s += QString::number(arg.nr);
|
|
|
|
|
2023-09-11 11:34:22 +02:00
|
|
|
s += "\n not bool: " + QString(bool_to_string(arg.notbool));
|
|
|
|
s += "\n not null: " + QString(bool_to_string(arg.notnull));
|
|
|
|
s += "\n not uninit: " + QString(bool_to_string(arg.notuninit));
|
|
|
|
s += "\n format string: " + QString(bool_to_string(arg.formatstr));
|
|
|
|
s += "\n strz: " + QString(bool_to_string(arg.strz));
|
2015-08-30 18:37:12 +02:00
|
|
|
s += "\n valid: " + QString(arg.valid.isEmpty() ? "any" : arg.valid);
|
2022-03-21 17:14:26 +01:00
|
|
|
for (const CppcheckLibraryData::Function::Arg::MinSize &minsize : arg.minsizes) {
|
2015-08-30 18:37:12 +02:00
|
|
|
s += "\n minsize: " + minsize.type + " " + minsize.arg + " " + minsize.arg2;
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2015-08-30 13:41:57 +02:00
|
|
|
void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &function)
|
2015-08-30 13:33:43 +02:00
|
|
|
{
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->arguments->clear();
|
2022-03-21 17:14:26 +01:00
|
|
|
for (const CppcheckLibraryData::Function::Arg &arg : function.args) {
|
2018-06-18 10:13:33 +02:00
|
|
|
mUi->arguments->addItem(getArgText(arg));
|
2015-08-30 13:33:43 +02:00
|
|
|
}
|
|
|
|
}
|