src/network/kernel/qnetworkinterface.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
     8 **
     8 **
   539 */
   539 */
   540 QList<QNetworkInterface> QNetworkInterface::allInterfaces()
   540 QList<QNetworkInterface> QNetworkInterface::allInterfaces()
   541 {
   541 {
   542     QList<QSharedDataPointer<QNetworkInterfacePrivate> > privs = manager()->allInterfaces();
   542     QList<QSharedDataPointer<QNetworkInterfacePrivate> > privs = manager()->allInterfaces();
   543     QList<QNetworkInterface> result;
   543     QList<QNetworkInterface> result;
   544     foreach (QSharedDataPointer<QNetworkInterfacePrivate> p, privs) {
   544     foreach (const QSharedDataPointer<QNetworkInterfacePrivate> &p, privs) {
   545         QNetworkInterface item;
   545         QNetworkInterface item;
   546         item.d = p;
   546         item.d = p;
   547         result << item;
   547         result << item;
   548     }
   548     }
   549 
   549 
   558 */
   558 */
   559 QList<QHostAddress> QNetworkInterface::allAddresses()
   559 QList<QHostAddress> QNetworkInterface::allAddresses()
   560 {
   560 {
   561     QList<QSharedDataPointer<QNetworkInterfacePrivate> > privs = manager()->allInterfaces();
   561     QList<QSharedDataPointer<QNetworkInterfacePrivate> > privs = manager()->allInterfaces();
   562     QList<QHostAddress> result;
   562     QList<QHostAddress> result;
   563     foreach (const QSharedDataPointer<QNetworkInterfacePrivate> p, privs) {
   563     foreach (const QSharedDataPointer<QNetworkInterfacePrivate> &p, privs) {
   564         foreach (const QNetworkAddressEntry &entry, p->addressEntries)
   564         foreach (const QNetworkAddressEntry &entry, p->addressEntries)
   565             result += entry.ip();
   565             result += entry.ip();
   566     }
   566     }
   567 
   567 
   568     return result;
   568     return result;