IP2CUpdater Class Reference

IP2CUpdater is responsible for downloading a new version of database from the site. More...

#include <ip2cupdater.h>

+ Inheritance diagram for IP2CUpdater:

Signals

void databaseDownloadFinished (const QByteArray &downloadedData)
 In case of failure the downloadedData array will be empty. More...
 
void downloadProgress (qint64 value, qint64 max)
 

Public Member Functions

void downloadDatabase (const QUrl &netLocation)
 
const QByteArray & downloadedData ()
 
const QString & filePath () const
 
bool getRollbackData ()
 Obtains rollback data from pathToFile file. More...
 
bool hasDownloadedData () const
 
bool hasRollbackData () const
 
bool rollback ()
 Saves data to the pathToFile file. This data must be first obtained through the rollback method. More...
 
bool saveDownloadedData ()
 Saves recently downloaded data to the pathToFile file. More...
 
void setFilePath (const QString &filePath)
 

Static Public Member Functions

static bool needsUpdate (const QString &filePath, unsigned minimumUpdateAge)
 Checks if IP2C file must be updated. More...
 

Detailed Description

IP2CUpdater is responsible for downloading a new version of database from the site.

WWW class from Wadseeker library is used to communicate with WWW site. Since IP2C class remains the core of the whole system for more information refer there.

Definition at line 42 of file ip2cupdater.h.

Member Function Documentation

void IP2CUpdater::databaseDownloadFinished ( const QByteArray &  downloadedData)
signal

In case of failure the downloadedData array will be empty.

bool IP2CUpdater::getRollbackData ( )

Obtains rollback data from pathToFile file.

This will always clear previous rollback data. You can keep only one instance of rollback file at a time.

Returns
True if rollback data was obtained, false otherwise. Old rollback data will be cleared anyway.
See Also
rollback()

Definition at line 123 of file ip2cupdater.cpp.

bool IP2CUpdater::needsUpdate ( const QString &  filePath,
unsigned  minimumUpdateAge 
)
static

Checks if IP2C file must be updated.

Parameters
filePath- Path to the file. It is assumed that this is the IP2Country database file.
minimumUpdateAge- Maximum age of the file for which this method will return false. Cannot be 0.

Definition at line 144 of file ip2cupdater.cpp.

bool IP2CUpdater::rollback ( )

Saves data to the pathToFile file. This data must be first obtained through the rollback method.

If there is nothing to rollback this will do nothing. This will also clear previously obtained rollback data.

Returns
True if rollback succeeded, false if there was nothing to rollback to or the save failed.
See Also
getRollbackData()

Definition at line 176 of file ip2cupdater.cpp.

bool IP2CUpdater::saveDownloadedData ( )

Saves recently downloaded data to the pathToFile file.

This will do nothing if there is no downloaded data.

Returns
True if save succeeded, false if there was nothing to save or the save failed.

Definition at line 203 of file ip2cupdater.cpp.


The documentation for this class was generated from the following files: