2222 * IN THE SOFTWARE.
2323 */
2424
25+ #include < utility>
26+
2527#include < qmdnsengine/abstractserver.h>
2628#include < qmdnsengine/browser.h>
2729#include < qmdnsengine/cache.h>
@@ -89,7 +91,11 @@ bool BrowserPrivate::updateService(const QByteArray &fqName)
8991 QList<Record> txtRecords;
9092 if (cache->lookupRecords (fqName, TXT, txtRecords)) {
9193 QMap<QByteArray, QByteArray> attributes;
92- for (const Record &record : qAsConst (txtRecords)) {
94+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
95+ for (const Record &record : std::as_const (txtRecords)) {
96+ #else
97+ for (const Record &record : qAsConst (txtRecords)) {
98+ #endif
9399 for (auto i = record.attributes ().constBegin ();
94100 i != record.attributes ().constEnd (); ++i) {
95101 attributes.insert (i.key (), i.value ());
@@ -154,7 +160,11 @@ void BrowserPrivate::onMessageReceived(const Message &message)
154160 // For each of the services marked to be updated, perform the update and
155161 // make a list of all missing SRV records
156162 QSet<QByteArray> queryNames;
157- for (const QByteArray &name : qAsConst (updateNames)) {
163+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
164+ for (const QByteArray &name : std::as_const (updateNames)) {
165+ #else
166+ for (const QByteArray &name : qAsConst (updateNames)) {
167+ #endif
158168 if (updateService (name)) {
159169 queryNames.insert (name);
160170 }
@@ -178,7 +188,11 @@ void BrowserPrivate::onMessageReceived(const Message &message)
178188 // Build and send a query for all of the SRV and TXT records
179189 if (queryNames.count ()) {
180190 Message queryMessage;
181- for (const QByteArray &name : qAsConst (queryNames)) {
191+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
192+ for (const QByteArray &name : std::as_const (queryNames)) {
193+ #else
194+ for (const QByteArray &name : qAsConst (queryNames)) {
195+ #endif
182196 Query query;
183197 query.setName (name);
184198 query.setType (SRV);
@@ -240,7 +254,11 @@ void BrowserPrivate::onQueryTimeout()
240254 // Include PTR records for the target that are already known
241255 QList<Record> records;
242256 if (cache->lookupRecords (query.name (), PTR, records)) {
243- for (const Record &record : qAsConst (records)) {
257+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
258+ for (const Record &record : std::as_const (records)) {
259+ #else
260+ for (const Record &record : qAsConst (records)) {
261+ #endif
244262 message.addRecord (record);
245263 }
246264 }
@@ -253,8 +271,11 @@ void BrowserPrivate::onServiceTimeout()
253271{
254272 if (ptrTargets.count ()) {
255273 Message message;
256- for (const QByteArray &target : qAsConst (ptrTargets)) {
257-
274+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
275+ for (const QByteArray &target : std::as_const (ptrTargets)) {
276+ #else
277+ for (const QByteArray &target : qAsConst (ptrTargets)) {
278+ #endif
258279 // Add a query for PTR records
259280 Query query;
260281 query.setName (target);
@@ -264,7 +285,11 @@ void BrowserPrivate::onServiceTimeout()
264285 // Include PTR records for the target that are already known
265286 QList<Record> records;
266287 if (cache->lookupRecords (target, PTR, records)) {
267- for (const Record &record : qAsConst (records)) {
288+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
289+ for (const Record &record : std::as_const (records)) {
290+ #else
291+ for (const Record &record : qAsConst (records)) {
292+ #endif
268293 message.addRecord (record);
269294 }
270295 }
0 commit comments