qt.cfg: Add QLinkedList container configuration and some tests. (#2099)

This commit is contained in:
Sebastian 2019-08-20 07:09:43 +02:00 committed by GitHub
parent 4f94e4fff8
commit 26dfee58f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 129 additions and 0 deletions

View File

@ -3594,6 +3594,67 @@
<not-bool/>
</arg>
</function>
<!-- QLinkedList https://doc.qt.io/qt-5/qlinkedlist.html -->
<!-- void QLinkedList::append(const T &value) -->
<function name="QLinkedList::append">
<noreturn>false</noreturn>
<returnValue type="void"/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
</function>
<!-- int QLinkedList::count(const T &value) const -->
<!-- int QLinkedList::count() const -->
<function name="QLinkedList::count">
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
<const/>
<arg nr="1" direction="in" default="">
<not-uninit/>
</arg>
</function>
<!-- bool QLinkedList::endsWith(const T &value) const -->
<function name="QLinkedList::endsWith">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
</function>
<!-- QLinkedList::iterator QLinkedList::erase(QLinkedList::iterator pos) -->
<!-- QLinkedList::iterator QLinkedList::erase(QLinkedList::iterator begin, QLinkedList::iterator end) -->
<function name="QLinkedList::erase">
<noreturn>false</noreturn>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2" default="">
<not-uninit/>
</arg>
</function>
<!-- int QLinkedList::size() const -->
<function name="QLinkedList::size">
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
<const/>
</function>
<!-- bool QLinkedList::startsWith(const T &value) const -->
<function name="QLinkedList::startsWith">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
</function>
<!-- ##### Container ##### -->
<container id="qtContainer" opLessAllowed="false" itEndPattern="&gt; :: iterator|const_iterator">
<type templateParameter="0"/>
@ -3648,6 +3709,35 @@
<function name="crend" yields="end-iterator"/>
</access>
</container>
<container id="qtLinkedList" startPattern="QLinkedList &lt;" inherits="qtContainer" itEndPattern="&gt; :: iterator|const_iterator|reverse_iterator|const_reverse_iterator">
<size>
<function name="erase" action="erase" yields="iterator"/>
<function name="insert" action="insert" yields="iterator"/>
<function name="empty" yields="empty"/>
<function name="push_back" action="push"/>
<function name="push_front" action="push"/>
<function name="prepend" action="push"/>
<function name="pop_back" action="pop"/>
<function name="pop_front" action="pop"/>
<function name="removeAll" action="change"/>
<function name="removeAt" action="pop"/>
<function name="removeFirst" action="pop"/>
<function name="removeLast" action="pop"/>
<function name="removeOne" action="pop"/>
<function name="takeFirst" action="pop"/>
<function name="takeLast" action="pop"/>
</size>
<access>
<function name="front" yields="item"/>
<function name="first" yields="item"/>
<function name="back" yields="item"/>
<function name="last" yields="item"/>
<function name="rbegin" yields="start-iterator"/>
<function name="crbegin" yields="start-iterator"/>
<function name="rend" yields="end-iterator"/>
<function name="crend" yields="end-iterator"/>
</access>
</container>
<container id="qtVector" startPattern="QVector &lt;" inherits="qtContainer" opLessAllowed="true" itEndPattern="&gt; :: iterator|const_iterator|reverse_iterator|const_reverse_iterator">
<size>
<function name="erase" action="erase" yields="iterator"/>

View File

@ -10,6 +10,9 @@
#include <QObject>
#include <QString>
#include <QVector>
#include <QByteArray>
#include <QList>
#include <QLinkedList>
#include <QtPlugin>
#include <QFile>
#include <cstdio>
@ -130,6 +133,42 @@ QList<int>::iterator QList3()
return it;
}
void QLinkedList1()
{
QLinkedList<QString> qstringLinkedList1{"one", "two"};
QLinkedList<QString> qstringLinkedList2 = {"one", "two"};
qstringLinkedList2.clear();
QLinkedList<QString> qstringLinkedList3;
qstringLinkedList3 << "one" << "two";
// cppcheck-suppress ignoredReturnValue
qstringLinkedList3.startsWith("one");
// cppcheck-suppress ignoredReturnValue
qstringLinkedList3.endsWith("one");
// cppcheck-suppress ignoredReturnValue
qstringLinkedList3.count();
// cppcheck-suppress ignoredReturnValue
qstringLinkedList3.size();
QLinkedList<QString> qstringLinkedList4;
qstringLinkedList4.append("a");
qstringLinkedList4.clear();
}
QLinkedList<int>::iterator QLinkedList3()
{
QLinkedList<int> intQLinkedList1;
QLinkedList<int> intQLinkedList2;
// cppcheck-suppress iterators2
for (QLinkedList<int>::iterator it = intQLinkedList1.begin(); it != intQLinkedList2.end(); ++it)
{}
QLinkedList<int>::iterator it = intQLinkedList1.begin();
// TODO: cppcheck-suppress returnDanglingLifetime
return it;
}
void QStringList1(QStringList stringlistArg)
{
for (int i = 0; i <= stringlistArg.size(); ++i) {