mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #5184
Pavel Karelin (1): fix: Fix PR #5182. Eliminating the 'new' operator at ToxOptionsWrapper
This commit is contained in:
commit
254b861ded
|
@ -123,36 +123,33 @@ namespace {
|
|||
class ToxOptionsWrapper
|
||||
{
|
||||
public:
|
||||
ToxOptionsWrapper(Tox_Options *options, const QByteArray& proxyAddrData) {
|
||||
this->options = options;
|
||||
this->proxyAddrData = new QByteArray(proxyAddrData);
|
||||
}
|
||||
ToxOptionsWrapper(Tox_Options *options, const QByteArray& proxyAddrData)
|
||||
: options(options)
|
||||
, proxyAddrData(proxyAddrData)
|
||||
{}
|
||||
|
||||
~ToxOptionsWrapper() {
|
||||
tox_options_free(options);
|
||||
options = nullptr;
|
||||
delete proxyAddrData;
|
||||
proxyAddrData = nullptr;
|
||||
}
|
||||
|
||||
ToxOptionsWrapper (ToxOptionsWrapper && from) {
|
||||
this->options = from.options;
|
||||
options = from.options;
|
||||
proxyAddrData.swap(from.proxyAddrData);
|
||||
from.options = nullptr;
|
||||
this->proxyAddrData = from.proxyAddrData;
|
||||
from.proxyAddrData = nullptr;
|
||||
from.proxyAddrData.clear();
|
||||
}
|
||||
|
||||
operator Tox_Options* () {
|
||||
return options;
|
||||
}
|
||||
|
||||
const char* getProxyAddrData() {
|
||||
return this->proxyAddrData->data();
|
||||
const char* getProxyAddrData() const {
|
||||
return proxyAddrData.constData();
|
||||
}
|
||||
|
||||
private:
|
||||
Tox_Options *options = nullptr;
|
||||
QByteArray *proxyAddrData = nullptr;
|
||||
QByteArray proxyAddrData;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user