Skip to content

Commit 7ef044b

Browse files
updated
1 parent d83ef05 commit 7ef044b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+47
-887
lines changed

src/corelib.pro

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ TEMPLATE = lib
33
CONFIG += shared console
44
CONFIG -= lib_bundle
55
QT += sql network xml qml
6-
lessThan(QT_MINOR_VERSION, 3) {
7-
# Qt6.2
8-
CONFIG += c++17
9-
windows:QMAKE_CXXFLAGS += /std:c++17
10-
} else {
11-
CONFIG += c++20
12-
windows:QMAKE_CXXFLAGS += /Zc:__cplusplus /std:c++20 /permissive-
13-
}
6+
7+
# C++ Standards Support
8+
CONFIG += c++20
9+
windows:QMAKE_CXXFLAGS += /Zc:__cplusplus /std:c++20 /permissive-
1410

1511
DEFINES *= QT_USE_QSTRINGBUILDER
1612
DEFINES += TF_MAKEDLL

src/tcriteriaconverter.h

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ class T_CORE_EXPORT TCriteriaData {
2727
bool isEmpty() const;
2828

2929
int property {-1};
30-
#if QT_VERSION < 0x060000
31-
QVariant::Type varType {QVariant::Invalid};
32-
#else
3330
QMetaType varType {QMetaType::UnknownType};
34-
#endif
3531
int op1 {TSql::Invalid};
3632
int op2 {TSql::Invalid};
3733
QVariant val1;
@@ -88,24 +84,15 @@ class TCriteriaConverter {
8884
TCriteriaConverter(const TCriteria &cri, const QSqlDatabase &db, const QString &aliasTableName = QString()) :
8985
criteria(cri), database(db), tableAlias(aliasTableName) { }
9086
QString toString() const;
91-
#if QT_VERSION < 0x060000
92-
QVariant::Type variantType(int property) const;
93-
#else
9487
QMetaType variantType(int property) const;
95-
#endif
9688
QString propertyName(int property, const QSqlDriver *driver, const QString &aliasTableName = QString()) const;
9789
static QString getPropertyName(int property, const QSqlDriver *driver, const QString &aliasTableName = QString());
9890

9991
protected:
10092
static QString getPropertyName(const QMetaObject *metaObject, int property, const QSqlDriver *driver, const QString &aliasTableName);
10193
QString criteriaToString(const QVariant &cri) const;
102-
#if QT_VERSION < 0x060000
103-
static QString criteriaToString(const QString &propertyName, QVariant::Type varType, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2, const QSqlDatabase &database);
104-
static QString criteriaToString(const QString &propertyName, QVariant::Type varType, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val, const QSqlDatabase &database);
105-
#else
10694
static QString criteriaToString(const QString &propertyName, const QMetaType &varType, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2, const QSqlDatabase &database);
10795
static QString criteriaToString(const QString &propertyName, const QMetaType &varType, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val, const QSqlDatabase &database);
108-
#endif
10996
static QString concat(const QString &s1, TCriteria::LogicalOperator op, const QString &s2);
11097

11198
private:
@@ -198,11 +185,7 @@ inline QString TCriteriaConverter<T>::criteriaToString(const QVariant &var) cons
198185
break;
199186
}
200187

201-
#if QT_VERSION >= 0x050400
202188
if (lst.count() <= LIMIT_WORDS_IN_CLAUSE || database.driver()->dbmsType() == QSqlDriver::MySqlServer) {
203-
#else
204-
if (lst.count() <= LIMIT_WORDS_IN_CLAUSE || database.driverName().toUpper() == QLatin1String("QMYSQL")) {
205-
#endif
206189
QString str = inclause(lst, 0, lst.count());
207190
sqlString += name;
208191
sqlString += TSql::formatArg(cri.op1, str);
@@ -296,39 +279,19 @@ inline QString TCriteriaConverter<T>::getPropertyName(int property, const QSqlDr
296279
return getPropertyName(T().metaObject(), property, driver, aliasTableName);
297280
}
298281

299-
#if QT_VERSION < 0x060000
300-
template <class T>
301-
inline QVariant::Type TCriteriaConverter<T>::variantType(int property) const
302-
{
303-
const QMetaObject *metaObject = obj.metaObject();
304-
return (metaObject) ? metaObject->property(metaObject->propertyOffset() + property).type() : QVariant::Invalid;
305-
}
306-
#else
307282
template <class T>
308283
inline QMetaType TCriteriaConverter<T>::variantType(int property) const
309284
{
310285
const QMetaObject *metaObject = obj.metaObject();
311286
return (metaObject) ? metaObject->property(metaObject->propertyOffset() + property).metaType() : QMetaType(QMetaType::UnknownType);
312287
}
313-
#endif
314288

315-
#if QT_VERSION < 0x060000
316-
template <class T>
317-
inline QString TCriteriaConverter<T>::criteriaToString(const QString &propertyName, QVariant::Type varType, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2, const QSqlDatabase &database)
318-
#else
319289
template <class T>
320290
inline QString TCriteriaConverter<T>::criteriaToString(const QString &propertyName, const QMetaType &varType, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2, const QSqlDatabase &database)
321-
#endif
322291
{
323292
QString sqlString;
324-
325-
#if QT_VERSION < 0x060000
326-
QString v1 = TSqlQuery::formatValue(val1, (QVariant::Type)varType, database);
327-
QString v2 = TSqlQuery::formatValue(val2, (QVariant::Type)varType, database);
328-
#else
329293
QString v1 = TSqlQuery::formatValue(val1, varType, database);
330294
QString v2 = TSqlQuery::formatValue(val2, varType, database);
331-
#endif
332295

333296
if (!v1.isEmpty() && !v2.isEmpty()) {
334297
switch (op) {
@@ -354,14 +317,8 @@ inline QString TCriteriaConverter<T>::criteriaToString(const QString &propertyNa
354317
return sqlString;
355318
}
356319

357-
358-
#if QT_VERSION < 0x060000
359-
template <class T>
360-
inline QString TCriteriaConverter<T>::criteriaToString(const QString &propertyName, QVariant::Type varType, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val, const QSqlDatabase &database)
361-
#else
362320
template <class T>
363321
inline QString TCriteriaConverter<T>::criteriaToString(const QString &propertyName, const QMetaType &varType, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val, const QSqlDatabase &database)
364-
#endif
365322
{
366323
QString sqlString;
367324
if (op1 != TSql::Invalid && op2 != TSql::Invalid && !val.isNull()) {

src/tdebug.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,6 @@ class T_CORE_EXPORT TDebug {
113113
ts << t;
114114
return *this;
115115
}
116-
#if QT_VERSION < 0x060000
117-
inline TDebug &operator<<(const QStringRef &t)
118-
{
119-
ts << t.toString();
120-
return *this;
121-
}
122-
#endif
123116
inline TDebug &operator<<(const QLatin1String &t)
124117
{
125118
ts << t;

src/test/buildtest/foo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ QList<Foo> Foo::getAll()
127127
return tfGetModelListByMongoCriteria<Foo, FooObject>(TCriteria());
128128
}
129129

130-
#if QT_VERSION >= 0x050000
131130
QJsonArray Foo::getAllJson()
132131
{
133132
QJsonArray array;
@@ -140,7 +139,6 @@ QJsonArray Foo::getAllJson()
140139
}
141140
return array;
142141
}
143-
#endif
144142

145143
TModelObject *Foo::modelData()
146144
{

src/test/buildtest/foo.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ class T_MODEL_EXPORT Foo : public TAbstractModel
4444
static Foo get(const QString &id, int lockRevision);
4545
static int count();
4646
static QList<Foo> getAll();
47-
#if QT_VERSION >= 0x050000
4847
static QJsonArray getAllJson();
49-
#endif
5048

5149
private:
5250
QSharedDataPointer<FooObject> d;

src/test/buildtest/main.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
#include <TSqlJoin>
66
#include <TMongoODMapper>
77
#include <TModelUtil>
8-
#if QT_VERSION >= 0x050000
9-
# include <TJsonUtil>
10-
#endif
8+
#include <TJsonUtil>
119
#include <tglobal.h>
1210
#include <tatomicptr.h>
1311
#include <tatomic.h>
@@ -200,18 +198,14 @@ void build_check_TModelUtil()
200198

201199
QList<Blog> list;
202200
tfConvertToJsonArray(list);
203-
#if QT_VERSION >= 0x050c00 // 5.12.0
204201
tfConvertToCborArray(list);
205-
#endif
206202
}
207203

208-
#if QT_VERSION >= 0x050000
209204
void build_check_TJsonUtil()
210205
{
211206
QList<Foo> fooList;
212207
tfModelListToJsonArray<Foo>(fooList);
213208
}
214-
#endif
215209

216210
void atomic_ptr()
217211
{

src/test/httpheader/main.cpp

Lines changed: 1 addition & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <THttpRequest>
33
#include "thttpheader.h"
44

5-
#if QT_VERSION >= 0x050000
5+
66
class TestHttpHeader : public QObject
77
{
88
Q_OBJECT
@@ -210,126 +210,5 @@ void TestHttpHeader::parseRequestVariantMap()
210210
QCOMPARE(vmap[key1].toString(), val1);
211211
}
212212

213-
214-
#else // QT_VERSION < 0x050000
215-
216-
#include <QHttpHeader>
217-
218-
219-
class TestHttpHeader : public QObject
220-
{
221-
Q_OBJECT
222-
private slots:
223-
void parseHttpRequestHeader_data();
224-
void parseHttpRequestHeader();
225-
void parseHttpResponseHeader_data();
226-
void parseHttpResponseHeader();
227-
};
228-
229-
230-
void TestHttpHeader::parseHttpRequestHeader_data()
231-
{
232-
QTest::addColumn<QString>("data");
233-
QTest::newRow("1") <<
234-
"GET /generate_204 HTTP/2.2\r\n"
235-
"Content-Length: 0\r\n"
236-
"Content-Type: text/html\r\n"
237-
"Date: Sun, 27 Mar 2011 11:48:42 GMT\r\n"
238-
"Server: GFE/2.0\r\n";
239-
240-
QTest::newRow("2") <<
241-
"GET /generate_204 HTTP/2.2\r\n"
242-
"Content-Length: 0";
243-
244-
QTest::newRow("3") <<
245-
"GET /ge HTTP/1.1\r\n"
246-
"Accept-Encoding: gzip,deflate\r\n"
247-
"Accept-Charset: UTF-8,*\r\n"
248-
"Keep-Alive: 115\r\n"
249-
"Connection: alive\r\n";
250-
251-
QTest::newRow("4") <<
252-
"GET /ge HTTP/1.1\r\n"
253-
"Accept-Encoding: gzip,deflate\r\n"
254-
"Accept-Charset: UTF-8,*\r\n"
255-
"Keep-Alive: 115\r\n"
256-
"Connection: kdd\r\n"
257-
"Received: fr\r\n"
258-
" by hoge.hoge.123.com\r\n"
259-
" by hoge.hoga.com";
260-
}
261-
262-
263-
void TestHttpHeader::parseHttpRequestHeader()
264-
{
265-
QFETCH(QString, data);
266-
QHttpRequestHeader qhttp(data);
267-
THttpRequestHeader thttp(data.toLatin1());
268-
// qDebug("Qt: {}", qUtf8Printable(qhttp.toString()));
269-
// qDebug("Tf: {}", thttp.toByteArray().data());
270-
271-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
272-
QCOMPARE(qhttp.contentType().toLatin1(), thttp.contentType());
273-
QCOMPARE(qhttp.contentLength(), thttp.contentLength());
274-
QCOMPARE(qhttp.hasKey("date"), thttp.hasRawHeader("date"));
275-
QCOMPARE(qhttp.hasKey("Date"), thttp.hasRawHeader("Date"));
276-
QCOMPARE(qhttp.hasKey("hoge"), thttp.hasRawHeader("hoge"));
277-
QCOMPARE(qhttp.value("server").toLatin1(), thttp.rawHeader("server"));
278-
QCOMPARE(qhttp.keys().count(), thttp.rawHeaderList().count());
279-
280-
qhttp.setValue("Connection", "keep-alive");
281-
thttp.setRawHeader("Connection", "keep-alive");
282-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
283-
284-
qhttp.addValue("Connection", "keep-alive222");
285-
thttp.addRawHeader("Connection", "keep-alive222");
286-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
287-
288-
qhttp.setValue("Hoge", "hoge");
289-
thttp.setRawHeader("Hoge", "hoge");
290-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
291-
292-
qhttp.setValue("Hoge", "");
293-
thttp.setRawHeader("Hoge", "");
294-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
295-
296-
qhttp.removeAllValues("connection");
297-
thttp.removeAllRawHeaders("connection");
298-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
299-
QCOMPARE(qhttp.majorVersion(), thttp.majorVersion());
300-
QCOMPARE(qhttp.minorVersion(), thttp.minorVersion());
301-
}
302-
303-
304-
void TestHttpHeader::parseHttpResponseHeader_data()
305-
{
306-
QTest::addColumn<QString>("data");
307-
QTest::newRow("1") <<
308-
"HTTP/1.1 204 No Content\r\n"
309-
"Content-Length: 0\r\n";
310-
311-
QTest::newRow("2") <<
312-
"HTTP/3.3 204 No Content\r\n"
313-
"Content-Length: 0\r\n"
314-
"Content-Type: text/html\r\n"
315-
"Date: Sun, 27 Mar 2011 11:48:42 GMT\r\n"
316-
"Server: GFE/2.0\r\n\r\n";
317-
}
318-
319-
320-
void TestHttpHeader::parseHttpResponseHeader()
321-
{
322-
QFETCH(QString, data);
323-
QHttpResponseHeader qhttp(data);
324-
THttpResponseHeader thttp(data.toLatin1());
325-
// qDebug("Qt: {}", qUtf8Printable(qhttp.toString()));
326-
// qDebug("Tf: {}", thttp.toByteArray().data());
327-
QCOMPARE(qhttp.toString().toLatin1(), thttp.toByteArray());
328-
QCOMPARE(qhttp.majorVersion(), thttp.majorVersion());
329-
QCOMPARE(qhttp.minorVersion(), thttp.minorVersion());
330-
}
331-
332-
#endif // QT_VERSION < 0x050000
333-
334213
TF_TEST_MAIN(TestHttpHeader)
335214
#include "main.moc"

0 commit comments

Comments
 (0)