GUI: library editor, edit function comments
This commit is contained in:
parent
366a8325b5
commit
e09f583096
30
cfg/std.cfg
30
cfg/std.cfg
|
@ -3321,8 +3321,8 @@
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- const char * strrchr(const char * str, int character);
|
<!-- const char * strrchr(const char * str, int character);-->
|
||||||
char * strrchr( char * str, int character); -->
|
<!-- char * strrchr( char * str, int character); -->
|
||||||
<function name="strrchr,std::strrchr">
|
<function name="strrchr,std::strrchr">
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
|
@ -3336,8 +3336,8 @@
|
||||||
<valid>0:255</valid>
|
<valid>0:255</valid>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- const char * strpbrk(const char * str1, const char * str2);
|
<!-- const char * strpbrk(const char * str1, const char * str2);-->
|
||||||
char * strpbrk( char * str1, const char * str2); -->
|
<!-- char * strpbrk( char * str1, const char * str2); -->
|
||||||
<function name="strbprk">
|
<function name="strbprk">
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<pure/>
|
<pure/>
|
||||||
|
@ -3352,8 +3352,8 @@
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- const wchar_t* wcsrchr(const wchar_t* ws, wchar_t wc);
|
<!-- const wchar_t* wcsrchr(const wchar_t* ws, wchar_t wc);-->
|
||||||
wchar_t* wcsrchr( wchar_t* ws, wchar_t wc); -->
|
<!-- wchar_t* wcsrchr( wchar_t* ws, wchar_t wc); -->
|
||||||
<function name="wcsrchr,std::wcsrchr">
|
<function name="wcsrchr,std::wcsrchr">
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
|
@ -3595,9 +3595,9 @@
|
||||||
</arg>
|
</arg>
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="2">
|
<arg nr="2">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="any">
|
<arg nr="any">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
@ -3611,8 +3611,8 @@
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="3">
|
<arg nr="3">
|
||||||
<not-uninit/>
|
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int vsprintf(char *s, const char *format, va_list arg); -->
|
<!-- int vsprintf(char *s, const char *format, va_list arg); -->
|
||||||
|
@ -3621,9 +3621,9 @@
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="2">
|
<arg nr="2">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="3"/>
|
<arg nr="3"/>
|
||||||
</function>
|
</function>
|
||||||
|
@ -3636,9 +3636,9 @@
|
||||||
</arg>
|
</arg>
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="3">
|
<arg nr="3">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="4"/>
|
<arg nr="4"/>
|
||||||
</function>
|
</function>
|
||||||
|
@ -3651,9 +3651,9 @@
|
||||||
</arg>
|
</arg>
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="2">
|
<arg nr="2">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="any">
|
<arg nr="any">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
@ -3668,9 +3668,9 @@
|
||||||
</arg>
|
</arg>
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="3">
|
<arg nr="3">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="any">
|
<arg nr="any">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
@ -3685,9 +3685,9 @@
|
||||||
</arg>
|
</arg>
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<arg nr="3">
|
<arg nr="3">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="4"/>
|
<arg nr="4"/>
|
||||||
</function>
|
</function>
|
||||||
|
@ -3697,9 +3697,9 @@
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<formatstr scan="true"/>
|
<formatstr scan="true"/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int sscanf(const char *string, const char * format, ...); -->
|
<!-- int sscanf(const char *string, const char * format, ...); -->
|
||||||
|
@ -3712,8 +3712,8 @@
|
||||||
<formatstr scan="true"/>
|
<formatstr scan="true"/>
|
||||||
<arg nr="2">
|
<arg nr="2">
|
||||||
<formatstr/>
|
<formatstr/>
|
||||||
<not-uninit/>
|
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int fwscanf(FILE* stream, const wchar_t* format, ...); -->
|
<!-- int fwscanf(FILE* stream, const wchar_t* format, ...); -->
|
||||||
|
|
|
@ -119,7 +119,7 @@ static CppcheckLibraryData::Function::Arg loadFunctionArg(QXmlStreamReader &xmlR
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CppcheckLibraryData::Function loadFunction(QXmlStreamReader &xmlReader, const QStringList &comments)
|
static CppcheckLibraryData::Function loadFunction(QXmlStreamReader &xmlReader, const QString comments)
|
||||||
{
|
{
|
||||||
CppcheckLibraryData::Function function;
|
CppcheckLibraryData::Function function;
|
||||||
function.comments = comments;
|
function.comments = comments;
|
||||||
|
@ -185,13 +185,15 @@ static CppcheckLibraryData::PodType loadPodType(const QXmlStreamReader &xmlReade
|
||||||
bool CppcheckLibraryData::open(QIODevice &file)
|
bool CppcheckLibraryData::open(QIODevice &file)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
QStringList comments;
|
QString comments;
|
||||||
QXmlStreamReader xmlReader(&file);
|
QXmlStreamReader xmlReader(&file);
|
||||||
while (!xmlReader.atEnd()) {
|
while (!xmlReader.atEnd()) {
|
||||||
const QXmlStreamReader::TokenType t = xmlReader.readNext();
|
const QXmlStreamReader::TokenType t = xmlReader.readNext();
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case QXmlStreamReader::Comment:
|
case QXmlStreamReader::Comment:
|
||||||
comments.append(xmlReader.text().toString());
|
if (!comments.isEmpty())
|
||||||
|
comments += "\n";
|
||||||
|
comments += xmlReader.text().toString();
|
||||||
break;
|
break;
|
||||||
case QXmlStreamReader::StartElement:
|
case QXmlStreamReader::StartElement:
|
||||||
if (xmlReader.name() == "container")
|
if (xmlReader.name() == "container")
|
||||||
|
@ -263,7 +265,12 @@ static void writeContainer(QXmlStreamWriter &xmlWriter, const CppcheckLibraryDat
|
||||||
|
|
||||||
static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::Function &function)
|
static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::Function &function)
|
||||||
{
|
{
|
||||||
foreach(const QString &comment, function.comments) {
|
QString comments = function.comments;
|
||||||
|
while (comments.startsWith("\n"))
|
||||||
|
comments = comments.mid(1);
|
||||||
|
while (comments.endsWith("\n"))
|
||||||
|
comments.chop(1);
|
||||||
|
foreach(const QString &comment, comments.split('\n')) {
|
||||||
xmlWriter.writeComment(comment);
|
xmlWriter.writeComment(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
leakignore(false), useretval(false) {
|
leakignore(false), useretval(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList comments;
|
QString comments;
|
||||||
QString name;
|
QString name;
|
||||||
enum TrueFalseUnknown { False, True, Unknown } noreturn;
|
enum TrueFalseUnknown { False, True, Unknown } noreturn;
|
||||||
bool gccPure;
|
bool gccPure;
|
||||||
|
|
|
@ -167,6 +167,7 @@ void LibraryDialog::selectFunction()
|
||||||
}
|
}
|
||||||
|
|
||||||
ignoreChanges = true;
|
ignoreChanges = true;
|
||||||
|
ui->comments->setPlainText(function->comments);
|
||||||
ui->noreturn->setCurrentIndex(function->noreturn);
|
ui->noreturn->setCurrentIndex(function->noreturn);
|
||||||
ui->useretval->setChecked(function->useretval);
|
ui->useretval->setChecked(function->useretval);
|
||||||
ui->leakignore->setChecked(function->leakignore);
|
ui->leakignore->setChecked(function->leakignore);
|
||||||
|
@ -214,6 +215,7 @@ void LibraryDialog::changeFunction()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CppcheckLibraryData::Function *function = currentFunction();
|
CppcheckLibraryData::Function *function = currentFunction();
|
||||||
|
function->comments = ui->comments->toPlainText();
|
||||||
function->noreturn = (CppcheckLibraryData::Function::TrueFalseUnknown)ui->noreturn->currentIndex();
|
function->noreturn = (CppcheckLibraryData::Function::TrueFalseUnknown)ui->noreturn->currentIndex();
|
||||||
function->useretval = ui->useretval->isChecked();
|
function->useretval = ui->useretval->isChecked();
|
||||||
function->leakignore = ui->leakignore->isChecked();
|
function->leakignore = ui->leakignore->isChecked();
|
||||||
|
|
|
@ -134,6 +134,55 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>80</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Comments</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="comments">
|
||||||
|
<property name="lineWrapMode">
|
||||||
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
|
@ -249,12 +298,12 @@
|
||||||
<slot>changeFunction()</slot>
|
<slot>changeFunction()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>739</x>
|
<x>550</x>
|
||||||
<y>74</y>
|
<y>157</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>750</x>
|
<x>561</x>
|
||||||
<y>74</y>
|
<y>157</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -265,12 +314,12 @@
|
||||||
<slot>changeFunction()</slot>
|
<slot>changeFunction()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>735</x>
|
<x>531</x>
|
||||||
<y>103</y>
|
<y>183</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>744</x>
|
<x>540</x>
|
||||||
<y>102</y>
|
<y>182</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -313,8 +362,8 @@
|
||||||
<slot>editArg()</slot>
|
<slot>editArg()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>519</x>
|
<x>488</x>
|
||||||
<y>575</y>
|
<y>580</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>497</x>
|
<x>497</x>
|
||||||
|
@ -329,12 +378,12 @@
|
||||||
<slot>editArg()</slot>
|
<slot>editArg()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>685</x>
|
<x>529</x>
|
||||||
<y>149</y>
|
<y>223</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>693</x>
|
<x>543</x>
|
||||||
<y>148</y>
|
<y>223</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -393,12 +442,12 @@
|
||||||
<slot>changeFunction()</slot>
|
<slot>changeFunction()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>696</x>
|
<x>545</x>
|
||||||
<y>46</y>
|
<y>137</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>703</x>
|
<x>552</x>
|
||||||
<y>46</y>
|
<y>138</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -418,6 +467,38 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>noreturn</sender>
|
||||||
|
<signal>editTextChanged(QString)</signal>
|
||||||
|
<receiver>LibraryDialog</receiver>
|
||||||
|
<slot>changeFunction()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>548</x>
|
||||||
|
<y>128</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>555</x>
|
||||||
|
<y>128</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>comments</sender>
|
||||||
|
<signal>textChanged()</signal>
|
||||||
|
<receiver>LibraryDialog</receiver>
|
||||||
|
<slot>changeFunction()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>567</x>
|
||||||
|
<y>50</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>584</x>
|
||||||
|
<y>48</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>addFunction()</slot>
|
<slot>addFunction()</slot>
|
||||||
|
|
Loading…
Reference in New Issue