qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
This class represents a Tox ID. More...
#include <toxid.h>
Public Member Functions | |
ToxId () | |
The default constructor. Creates an empty Tox ID. More... | |
ToxId (const ToxId &other) | |
The copy constructor. More... | |
ToxId (const QString &id) | |
Create a Tox ID from a QString. More... | |
ToxId (const QByteArray &rawId) | |
Create a Tox ID from a QByteArray. More... | |
ToxId (const uint8_t *rawId, int len) | |
Create a Tox ID from uint8_t bytes and lenght, convenience function for toxcore interface. More... | |
ToxId & | operator= (const ToxId &other)=default |
ToxId & | operator= (ToxId &&other)=default |
bool | operator== (const ToxId &other) const |
Compares the equality of the Public Key. More... | |
bool | operator!= (const ToxId &other) const |
Compares the inequality of the Public Key. More... | |
QString | toString () const |
Returns the Tox ID converted to QString. Is equal to getPublicKey() if the Tox ID was constructed from only a Public Key. More... | |
void | clear () |
Clears all elements of the Tox ID. More... | |
bool | isValid () const |
Check it it's a valid Tox ID by verifying the checksum. More... | |
const uint8_t * | getBytes () const |
Gets the ToxID as bytes, convenience function for toxcore interface. More... | |
QByteArray | getToxId () const |
ToxPk | getPublicKey () const |
Gets the Public Key part of the ToxID. More... | |
QString | getNoSpamString () const |
Returns the NoSpam value converted to QString. More... | |
Static Public Member Functions | |
static bool | isValidToxId (const QString &id) |
Check, that id is a valid Tox ID. More... | |
static bool | isToxId (const QString &id) |
Check, that id is probably a valid Tox ID. More... | |
Static Public Attributes | |
static const QRegularExpression | ToxIdRegEx |
Private Member Functions | |
void | constructToxId (const QByteArray &rawId) |
Private Attributes | |
QByteArray | toxId |
This class represents a Tox ID.
An ID is composed of 32 bytes long public key, 4 bytes long NoSpam and 2 bytes long checksum.
e.g.
ToxId::ToxId | ( | ) |
ToxId::ToxId | ( | const ToxId & | other | ) |
|
explicit |
Create a Tox ID from a QString.
If the given rawId is not a valid Tox ID, but can be a Public Key then: publicKey == rawId and noSpam == 0 == checkSum. If the given rawId isn't a valid Public Key or Tox ID a ToxId with all zero bytes is created.
id | Tox ID string to convert to ToxId object |
Definition at line 83 of file toxid.cpp.
|
explicit |
Create a Tox ID from a QByteArray.
If the given rawId is not a valid Tox ID, but can be a Public Key then: publicKey == rawId and noSpam == 0 == checkSum. If the given rawId isn't a valid Public Key or Tox ID a ToxId with all zero bytes is created.
rawId | Tox ID bytes to convert to ToxId object |
Definition at line 102 of file toxid.cpp.
|
explicit |
Create a Tox ID from uint8_t bytes and lenght, convenience function for toxcore interface.
If the given rawId is not a valid Tox ID, but can be a Public Key then: publicKey == rawId and noSpam == 0 == checkSum. If the given rawId isn't a valid Public Key or Tox ID a ToxId with all zero bytes is created.
rawId | Pointer to bytes to convert to ToxId object |
len | Number of bytes to read. Must be TOX_PUBLIC_KEY_SIZE for a Public Key or TOX_ADDRESS_SIZE for a Tox ID. |
Definition at line 118 of file toxid.cpp.
|
private |
const uint8_t * ToxId::getBytes | ( | ) | const |
QString ToxId::getNoSpamString | ( | ) | const |
ToxPk ToxId::getPublicKey | ( | ) | const |
QByteArray ToxId::getToxId | ( | ) | const |
|
static |
bool ToxId::isValid | ( | ) | const |
|
static |
bool ToxId::operator!= | ( | const ToxId & | other | ) | const |
bool ToxId::operator== | ( | const ToxId & | other | ) | const |
QString ToxId::toString | ( | ) | const |
Returns the Tox ID converted to QString. Is equal to getPublicKey() if the Tox ID was constructed from only a Public Key.
Definition at line 160 of file toxid.cpp.