Skip to content

Commit df5050f

Browse files
[cpp-qt5-client] Fix qt5.15 check (#8711)
* Fix qt5.15 check * Fix check fix
1 parent c916df9 commit df5050f

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ QJsonValue {{prefix}}HttpFileElement::asJsonValue() const {
5757
if (!result) {
5858
qDebug() << "Error opening file " << local_filename;
5959
}
60-
#if QT_VERSION >= 0x051500
60+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
6161
return QJsonDocument::fromJson(bArray.data()).object();
6262
#else
63-
return QJsonDocument::fromBinaryData(bArray.data()).object();
63+
return QJsonDocument::fromBinaryData(bArray.data()).object();
6464
#endif
6565
}
66-
66+
6767
bool {{prefix}}HttpFileElement::fromStringValue(const QString &instr) {
6868
QFile file(local_filename);
6969
bool result = false;
@@ -86,7 +86,7 @@ bool {{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) {
8686
file.remove();
8787
}
8888
result = file.open(QIODevice::WriteOnly);
89-
#if QT_VERSION >= 0x051500
89+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
9090
file.write(QJsonDocument(jval.toObject()).toJson());
9191
#else
9292
file.write(QJsonDocument(jval.toObject()).toBinaryData());

modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <QUrl>
88
#include <QUuid>
99
#include <QtGlobal>
10-
#if QT_VERSION >= 0x051500
10+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
1111
#define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
1212
#else
1313
#define SKIP_EMPTY_PARTS QString::SkipEmptyParts
@@ -52,7 +52,7 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f
5252
{{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager)
5353
: QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) {
5454
55-
#if QT_VERSION >= 0x051500
55+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
5656
randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
5757
#else
5858
qsrand(QDateTime::currentDateTime().toTime_t());
@@ -216,7 +216,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) {
216216
// variable layout is MULTIPART
217217
218218
boundary = QString("__-----------------------%1%2")
219-
#if QT_VERSION >= 0x051500
219+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
220220
.arg(QDateTime::currentDateTime().toSecsSinceEpoch())
221221
.arg(randomGenerator.generate());
222222
#else
@@ -546,7 +546,7 @@ QByteArray {{prefix}}HttpRequestWorker::compress(const QByteArray& input, int le
546546
return output;{{/contentCompression}}{{^contentCompression}}
547547
Q_UNUSED(input);
548548
Q_UNUSED(level);
549-
Q_UNUSED(compressType);
549+
Q_UNUSED(compressType);
550550
return QByteArray();{{/contentCompression}}
551551
}
552552

modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <QObject>
1515
#include <QString>
1616
#include <QTimer>
17-
#if QT_VERSION >= 0x051500
17+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
1818
#include <QRandomGenerator>
1919
#endif
2020

@@ -89,7 +89,7 @@ private:
8989
bool isResponseCompressionEnabled;
9090
bool isRequestCompressionEnabled;
9191
int httpResponseCode;
92-
#if QT_VERSION >= 0x051500
92+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
9393
QRandomGenerator randomGenerator;
9494
#endif
9595

samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ QJsonValue PFXHttpFileElement::asJsonValue() const {
6565
if (!result) {
6666
qDebug() << "Error opening file " << local_filename;
6767
}
68-
#if QT_VERSION >= 0x051500
68+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
6969
return QJsonDocument::fromJson(bArray.data()).object();
7070
#else
71-
return QJsonDocument::fromBinaryData(bArray.data()).object();
71+
return QJsonDocument::fromBinaryData(bArray.data()).object();
7272
#endif
7373
}
74-
74+
7575
bool PFXHttpFileElement::fromStringValue(const QString &instr) {
7676
QFile file(local_filename);
7777
bool result = false;
@@ -94,7 +94,7 @@ bool PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) {
9494
file.remove();
9595
}
9696
result = file.open(QIODevice::WriteOnly);
97-
#if QT_VERSION >= 0x051500
97+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
9898
file.write(QJsonDocument(jval.toObject()).toJson());
9999
#else
100100
file.write(QJsonDocument(jval.toObject()).toBinaryData());

samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <QUrl>
1818
#include <QUuid>
1919
#include <QtGlobal>
20-
#if QT_VERSION >= 0x051500
20+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
2121
#define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
2222
#else
2323
#define SKIP_EMPTY_PARTS QString::SkipEmptyParts
@@ -59,7 +59,7 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename
5959
PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager)
6060
: QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) {
6161

62-
#if QT_VERSION >= 0x051500
62+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
6363
randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
6464
#else
6565
qsrand(QDateTime::currentDateTime().toTime_t());
@@ -223,7 +223,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) {
223223
// variable layout is MULTIPART
224224

225225
boundary = QString("__-----------------------%1%2")
226-
#if QT_VERSION >= 0x051500
226+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
227227
.arg(QDateTime::currentDateTime().toSecsSinceEpoch())
228228
.arg(randomGenerator.generate());
229229
#else
@@ -480,7 +480,7 @@ QByteArray PFXHttpRequestWorker::compress(const QByteArray& input, int level, PF
480480

481481
Q_UNUSED(input);
482482
Q_UNUSED(level);
483-
Q_UNUSED(compressType);
483+
Q_UNUSED(compressType);
484484
return QByteArray();
485485
}
486486

samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <QObject>
2525
#include <QString>
2626
#include <QTimer>
27-
#if QT_VERSION >= 0x051500
27+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
2828
#include <QRandomGenerator>
2929
#endif
3030

@@ -97,7 +97,7 @@ class PFXHttpRequestWorker : public QObject {
9797
bool isResponseCompressionEnabled;
9898
bool isRequestCompressionEnabled;
9999
int httpResponseCode;
100-
#if QT_VERSION >= 0x051500
100+
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
101101
QRandomGenerator randomGenerator;
102102
#endif
103103

0 commit comments

Comments
 (0)