Enroute Flight Navigation
A navigation app for VFR pilots
Traffic::PasswordDB Class Reference

Password database. More...

#include <PasswordDB.h>

Signals

void emptyChanged ()
 Notifier signal.
 

Public Member Functions

 PasswordDB (QObject *parent=nullptr)
 Default constructor.
 
auto empty () const -> bool
 Getter method for property with the same name.
 
Q_INVOKABLE void clear ()
 Clear database.
 
Q_INVOKABLE bool contains (const QString &key) const
 Check if database contains a given key.
 
Q_INVOKABLE QString getPassword (const QString &key) const
 Find password for a given key.
 
Q_INVOKABLE void removePassword (const QString &key)
 Remove key/password.
 
Q_INVOKABLE void setPassword (const QString &key, const QString &password)
 Set key/password.
 

Properties

bool empty
 Empty.
 

Detailed Description

Password database.

This simple class provides access to a password database, which is in essence a glorified QHash<QString, QString>, where keys are network SSIDs and values are passwords.

Definition at line 37 of file PasswordDB.h.

Constructor & Destructor Documentation

◆ PasswordDB()

Traffic::PasswordDB::PasswordDB ( QObject * parent = nullptr)

Default constructor.

This default constructor will read the database from a file into memory.

Parameters
parentThe standard QObject parent pointer

Member Function Documentation

◆ clear()

Q_INVOKABLE void Traffic::PasswordDB::clear ( )

Clear database.

This method clears the database and saves it to the disk.

◆ contains()

Q_INVOKABLE bool Traffic::PasswordDB::contains ( const QString & key) const
inlinenodiscard

Check if database contains a given key.

Parameters
keyKey to look up
Returns
True if database contains the key

Definition at line 99 of file PasswordDB.h.

◆ empty()

auto Traffic::PasswordDB::empty ( ) const -> bool
inlinenodiscard

Getter method for property with the same name.

Returns
Property empty

Definition at line 77 of file PasswordDB.h.

◆ getPassword()

Q_INVOKABLE QString Traffic::PasswordDB::getPassword ( const QString & key) const
inlinenodiscard

Find password for a given key.

Parameters
keyKey to look up
Returns
Password, or an empty string if the database does not contain the key

Definition at line 111 of file PasswordDB.h.

◆ removePassword()

Q_INVOKABLE void Traffic::PasswordDB::removePassword ( const QString & key)

Remove key/password.

This method removes a key/password from the database and saves the database to the disk.

Parameters
keyKey for password to be removed.

◆ setPassword()

Q_INVOKABLE void Traffic::PasswordDB::setPassword ( const QString & key,
const QString & password )

Set key/password.

This method adds a key/password to the database and saves the database to the disk. If a password already exists for the given key, then it will be overwritten.

Parameters
keyKey to be added
passwordPassword to be added

Property Documentation

◆ empty

bool Traffic::PasswordDB::empty
read

Empty.

This proerty contains true if the password database is empty.

Definition at line 71 of file PasswordDB.h.


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