Qt 4.8
Classes | Functions
qhostinfo_p.h File Reference
#include "QtCore/qcoreapplication.h"
#include "private/qcoreapplication_p.h"
#include "QtNetwork/qhostinfo.h"
#include "QtCore/qmutex.h"
#include "QtCore/qwaitcondition.h"
#include "QtCore/qobject.h"
#include "QtCore/qpointer.h"
#include "QtCore/qthread.h"
#include "QtCore/qthreadpool.h"
#include "QtCore/qrunnable.h"
#include "QtCore/qlist.h"
#include "QtCore/qqueue.h"
#include <QElapsedTimer>
#include <QCache>
#include <QNetworkSession>
#include <QSharedPointer>

Go to the source code of this file.

Classes

class  QAbstractHostInfoLookupManager
 
class  QHostInfoAgent
 
class  QHostInfoCache
 
struct  QHostInfoCache::QHostInfoCacheElement
 
class  QHostInfoLookupManager
 
class  QHostInfoPrivate
 
class  QHostInfoResult
 
class  QHostInfoRunnable
 

Functions

void Q_AUTOTEST_EXPORT qt_qhostinfo_clear_cache ()
 
void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache (bool e)
 
QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup (const QString &name, QObject *receiver, const char *member, bool *valid, int *id)
 

Function Documentation

◆ qt_qhostinfo_clear_cache()

void Q_AUTOTEST_EXPORT qt_qhostinfo_clear_cache ( )

Definition at line 747 of file qhostinfo.cpp.

748 {
749  QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager();
750  if (manager) {
751  manager->clear();
752  }
753 }

◆ qt_qhostinfo_enable_cache()

void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache ( bool  e)

Definition at line 755 of file qhostinfo.cpp.

756 {
757  QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager();
758  if (manager) {
759  manager->cache.setEnabled(e);
760  }
761 }
void setEnabled(bool e)
Definition: qhostinfo.cpp:779

◆ qt_qhostinfo_lookup()

QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup ( const QString name,
QObject receiver,
const char *  member,
bool *  valid,
int *  id 
)

Definition at line 726 of file qhostinfo.cpp.

Referenced by QAbstractSocket::connectToHostImplementation().

727 {
728  *valid = false;
729  *id = -1;
730 
731  // check cache
732  QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager();
733  if (manager && manager->cache.isEnabled()) {
734  QHostInfo info = manager->cache.get(name, valid);
735  if (*valid) {
736  return info;
737  }
738  }
739 
740  // was not in cache, trigger lookup
741  *id = QHostInfo::lookupHost(name, receiver, member);
742 
743  // return empty response, valid==false
744  return QHostInfo();
745 }
static mach_timebase_info_data_t info
bool isEnabled()
Definition: qhostinfo.cpp:772
The QHostInfo class provides static functions for host name lookups.
Definition: qhostinfo.h:58
static int lookupHost(const QString &name, QObject *receiver, const char *member)
Looks up the IP address(es) associated with host name name, and returns an ID for the lookup...
Definition: qhostinfo.cpp:156
QHostInfo get(const QString &name, bool *valid)
Definition: qhostinfo.cpp:785