Qt 4.8
Functions | Variables
qhostinfo.cpp File Reference
#include "qhostinfo.h"
#include "qhostinfo_p.h"
#include "QtCore/qscopedpointer.h"
#include <qabstracteventdispatcher.h>
#include <qcoreapplication.h>
#include <qmetaobject.h>
#include <qstringlist.h>
#include <qthread.h>
#include <qurl.h>
#include <private/qnetworksession_p.h>
#include <unistd.h>

Go to the source code of this file.

Functions

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

Variables

static QBasicAtomicInt theIdCounter = Q_BASIC_ATOMIC_INITIALIZER(1)
 

Function Documentation

◆ qt_qhostinfo_clear_cache()

void 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 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

Variable Documentation

◆ theIdCounter

QBasicAtomicInt theIdCounter = Q_BASIC_ATOMIC_INITIALIZER(1)
static

Definition at line 125 of file qhostinfo.cpp.