Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
114 lines (84 sloc) 2.43 KB
#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QVariant>
#include <QtCore/qstringbuilder.h>
class MyString : public QString {
public:
MyString(QString const &s = QString()) : QString(s) {}
const QString *getConst() const { return this; }
QString *const getConstOther() { return this; }
const QString *const getConstConst() const { return this; }
QString *get() { return this; }
const QString getConstValue() const { return *this; }
};
MyString getMyString() { return MyString(); }
struct SomeStruct {
int i1, i2;
static int stint;
};
int SomeStruct::stint = 42;
void myfun(void *) {}
static const int num = 124;
static thread_local bool toggle = false;
int main(int argc, char **argv) {
QCoreApplication app(argc, argv);
auto f1 = new QFile(&app);
auto f2 = new QFile(&app);
auto f3 = new QFile(&app);
auto f4 = new QFile(&app);
auto f5 = qobject_cast<QFile *>(f2);
auto f6 = dynamic_cast<QFile *>(f2);
auto f7 = static_cast<QFile *>(f2);
auto i = 0;
const auto i2 = 0;
auto b = false;
auto i3 = i;
auto s = app.objectName();
// QString::const_iterator is 'QChar const*'
auto it = s.begin();
auto c1 = *it;
const auto c2 = *it;
auto sz = s.size();
auto combine = sz + i3;
auto var = QVariant::fromValue(s);
const auto var2 = QVariant::fromValue(s);
auto s2 = var.value<QString>();
auto s4 = QString::fromLatin1("foo");
auto s5 = QStringLiteral("foo");
auto ms1 = getMyString();
auto ms2 = ms1;
auto sit = s.begin(), send = s.end();
auto copy1 = ms1.get(), copy2 = ms2.get();
auto cs3 = ms1.get();
auto cs = ms1.getConst();
const auto cs6 = ms1.getConstOther();
const auto cs4 = ms1.getConstConst();
auto cqs = ms1.getConstValue();
auto cs2 = ms1.get();
const auto cs5 = ms1.getConst();
const auto cs7 = ms1.getConstOther();
for (auto it = s.begin(); it != s.end(); ++it) {
}
void (*fn)(void *) = myfun;
void (*fn2)(void *) = fn;
MyString ms3 = s4;
QString s3 = QLatin1String("foo");
unsigned int i4 = var.value<int>();
QString s6 = getMyString();
QString s7 = MyString();
QString s8 = ms1;
SomeStruct result = {4, 5};
QString defaultInit;
QFile uncopyable;
QString multi = s3, another;
int x = 0, y;
int z, w = 0;
unsigned int ui = 9;
unsigned int r = ui, t = 0;
QString copy21 = *ms1.get(), *copy22 = ms2.get();
QString expr_result = copy21 % multi;
try {
} catch (QString s) {
}
return 0;
}