IP2CUpdater Class Reference

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

#include <ip2cupdater.h>

+ Inheritance diagram for IP2CUpdater:

Public Types

enum  UpdateStatus { UpToDate, UpdateNeeded, UpdateCheckError }
 

Signals

void databaseDownloadFinished (const QByteArray &downloadedData)
 In case of failure the downloadedData array will be empty.
 
void downloadProgress (qint64 value, qint64 max)
 
void updateNeeded (int status)
 Emitted status is one of UpdateStatus enum values.
 

Public Member Functions

 IP2CUpdater (QObject *parent=nullptr)
 
void downloadDatabase (const QString &savePath)
 
const QByteArray & downloadedData ()
 
bool getRollbackData (const QString &databasePath)
 Obtains rollback data from specified file.
 
bool hasDownloadedData () const
 
bool hasRollbackData () const
 
bool isWorking () const
 
void needsUpdate (const QString &filePath)
 Checks if IP2C file must be updated.
 
bool rollback (const QString &savePath)
 Saves rollback data to the specified file. This data must be first obtained through the getRollbackData() method.
 
bool saveDownloadedData (const QString &savePath)
 Saves recently downloaded data to the specified file.
 

Detailed Description

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

As IP2C class remains the core of the whole system for more information refer to there.

Definition at line 37 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 ( const QString &  databasePath)

Obtains rollback data from specified 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 179 of file ip2cupdater.cpp.

void IP2CUpdater::needsUpdate ( const QString &  filePath)

Checks if IP2C file must be updated.

The call is asynchronous as the locally stored database is compared against the one hosted online on Doomseeker's web page. Once it completes, an updateNeeded() signal is emitted.

Parameters
filePath- Path to the file. It is assumed that this is the IP2Country database file.

Definition at line 197 of file ip2cupdater.cpp.

bool IP2CUpdater::rollback ( const QString &  savePath)

Saves rollback data to the specified file. This data must be first obtained through the getRollbackData() 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 211 of file ip2cupdater.cpp.

bool IP2CUpdater::saveDownloadedData ( const QString &  savePath)

Saves recently downloaded data to the specified 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 234 of file ip2cupdater.cpp.

void IP2CUpdater::updateNeeded ( int  status)
signal

Emitted status is one of UpdateStatus enum values.


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