diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2023-02-27 17:41:41 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2023-03-02 12:08:10 +0100 |
commit | a6dc86091510ce40105db3b57c637d699046ced9 (patch) | |
tree | 1f56c3d1cfc4f1f6017dcd1fba344308e01ceb48 /examples | |
parent | b300c6b777cda86782b35976fa8babdc238984ce (diff) |
DNS Lookup: reflow some code to avoid exceeding column limit
Task-number: QTBUG-108873
Pick-to: 6.5
Change-Id: Ic17ded256152f7d89bd200ea0e163f2b8f1ea70a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/network/dnslookup/dnslookup.cpp | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/examples/network/dnslookup/dnslookup.cpp b/examples/network/dnslookup/dnslookup.cpp index 183f191727..1fe2eaceb9 100644 --- a/examples/network/dnslookup/dnslookup.cpp +++ b/examples/network/dnslookup/dnslookup.cpp @@ -126,35 +126,47 @@ void DnsManager::showResults() // CNAME records const QList<QDnsDomainNameRecord> cnameRecords = dns->canonicalNameRecords(); - for (const QDnsDomainNameRecord &record : cnameRecords) - printf("%s\t%i\tIN\tCNAME\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(record.value())); + for (const QDnsDomainNameRecord &record : cnameRecords) { + printf("%s\t%i\tIN\tCNAME\t%s\n", qPrintable(record.name()), record.timeToLive(), + qPrintable(record.value())); + } // A and AAAA records const QList<QDnsHostAddressRecord> aRecords = dns->hostAddressRecords(); for (const QDnsHostAddressRecord &record : aRecords) { - const char *type = (record.value().protocol() == QAbstractSocket::IPv6Protocol) ? "AAAA" : "A"; - printf("%s\t%i\tIN\t%s\t%s\n", qPrintable(record.name()), record.timeToLive(), type, qPrintable(record.value().toString())); + const char *type = + (record.value().protocol() == QAbstractSocket::IPv6Protocol) ? "AAAA" : "A"; + printf("%s\t%i\tIN\t%s\t%s\n", qPrintable(record.name()), record.timeToLive(), type, + qPrintable(record.value().toString())); } // MX records const QList<QDnsMailExchangeRecord> mxRecords = dns->mailExchangeRecords(); - for (const QDnsMailExchangeRecord &record : mxRecords) - printf("%s\t%i\tIN\tMX\t%u %s\n", qPrintable(record.name()), record.timeToLive(), record.preference(), qPrintable(record.exchange())); + for (const QDnsMailExchangeRecord &record : mxRecords) { + printf("%s\t%i\tIN\tMX\t%u %s\n", qPrintable(record.name()), record.timeToLive(), + record.preference(), qPrintable(record.exchange())); + } // NS records const QList<QDnsDomainNameRecord> nsRecords = dns->nameServerRecords(); - for (const QDnsDomainNameRecord &record : nsRecords) - printf("%s\t%i\tIN\tNS\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(record.value())); + for (const QDnsDomainNameRecord &record : nsRecords) { + printf("%s\t%i\tIN\tNS\t%s\n", qPrintable(record.name()), record.timeToLive(), + qPrintable(record.value())); + } // PTR records const QList<QDnsDomainNameRecord> ptrRecords = dns->pointerRecords(); - for (const QDnsDomainNameRecord &record : ptrRecords) - printf("%s\t%i\tIN\tPTR\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(record.value())); + for (const QDnsDomainNameRecord &record : ptrRecords) { + printf("%s\t%i\tIN\tPTR\t%s\n", qPrintable(record.name()), record.timeToLive(), + qPrintable(record.value())); + } // SRV records const QList<QDnsServiceRecord> srvRecords = dns->serviceRecords(); - for (const QDnsServiceRecord &record : srvRecords) - printf("%s\t%i\tIN\tSRV\t%u %u %u %s\n", qPrintable(record.name()), record.timeToLive(), record.priority(), record.weight(), record.port(), qPrintable(record.target())); + for (const QDnsServiceRecord &record : srvRecords) { + printf("%s\t%i\tIN\tSRV\t%u %u %u %s\n", qPrintable(record.name()), record.timeToLive(), + record.priority(), record.weight(), record.port(), qPrintable(record.target())); + } // TXT records const QList<QDnsTextRecord> txtRecords = dns->textRecords(); @@ -163,7 +175,8 @@ void DnsManager::showResults() const QList<QByteArray> dnsRecords = record.values(); for (const QByteArray &ba : dnsRecords) values << "\"" + QString::fromLatin1(ba) + "\""; - printf("%s\t%i\tIN\tTXT\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(values.join(' '))); + printf("%s\t%i\tIN\tTXT\t%s\n", qPrintable(record.name()), record.timeToLive(), + qPrintable(values.join(' '))); } QCoreApplication::instance()->quit(); @@ -175,9 +188,12 @@ int main(int argc, char *argv[]) //! [1] QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCoreApplication::setApplicationName(QCoreApplication::translate("QDnsLookupExample", "DNS Lookup Example")); + QCoreApplication::setApplicationName(QCoreApplication::translate("QDnsLookupExample", + "DNS Lookup Example")); QCommandLineParser parser; - parser.setApplicationDescription(QCoreApplication::translate("QDnsLookupExample", "An example demonstrating the class QDnsLookup.")); + parser.setApplicationDescription(QCoreApplication::translate("QDnsLookupExample", + "An example demonstrating the " + "class QDnsLookup.")); DnsQuery query; QString errorMessage; switch (parseCommandLine(parser, &query, &errorMessage)) { |