1
0
forked from blue/squawk

trying linter settings

This commit is contained in:
Blue 2023-11-17 21:52:33 -03:00
parent 8f5325b291
commit 93c5be412e
Signed by untrusted user: blue
GPG Key ID: 9B203B252A63EE38
3 changed files with 3903 additions and 294 deletions

3640
.uncrustify.cfg Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,13 +17,13 @@
*/ */
#include "info.h" #include "info.h"
Shared::Info::Info (const QString& addr, EntryType tp): Shared::Info::Info (const QString& addr, EntryType tp):
type(tp), type(tp),
address(addr), address(addr),
vcard(nullptr), vcard(nullptr),
activeKeys(nullptr), activeKeys(nullptr),
inactiveKeys(nullptr) { inactiveKeys(nullptr)
{
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
break; break;
@ -50,7 +50,8 @@ type(other.type),
address(other.address), address(other.address),
vcard(nullptr), vcard(nullptr),
activeKeys(nullptr), activeKeys(nullptr),
inactiveKeys(nullptr) { inactiveKeys(nullptr)
{
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
break; break;
@ -70,7 +71,8 @@ type(other.type),
address(other.address), address(other.address),
vcard(other.vcard), vcard(other.vcard),
activeKeys(other.activeKeys), activeKeys(other.activeKeys),
inactiveKeys(other.inactiveKeys) { inactiveKeys(other.inactiveKeys)
{
other.type = EntryType::none; other.type = EntryType::none;
} }
@ -80,16 +82,13 @@ Shared::Info &Shared::Info::operator=(Info &&other) {
vcard = other.vcard; vcard = other.vcard;
activeKeys = other.activeKeys; activeKeys = other.activeKeys;
inactiveKeys = other.inactiveKeys; inactiveKeys = other.inactiveKeys;
other.type = EntryType::none; other.type = EntryType::none;
return *this; return *this;
} }
Shared::Info& Shared::Info::operator = (const Info& other) { Shared::Info& Shared::Info::operator = (const Info& other) {
type = other.type; type = other.type;
address = other.address; address = other.address;
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
break; break;
@ -102,11 +101,11 @@ Shared::Info &Shared::Info::operator=(const Info &other) {
default: default:
throw 351; throw 351;
} }
return *this; return *this;
} }
Shared::Info::~Info() { Shared::Info::~Info ()
{
turnIntoNone(); turnIntoNone();
} }
@ -129,9 +128,7 @@ void Shared::Info::turnIntoNone() {
type = EntryType::none; type = EntryType::none;
} }
void Shared::Info::turnIntoContact( void Shared::Info::turnIntoContact (const Shared::VCard& crd, const std::list<KeyInfo>& aks, const std::list<KeyInfo>& iaks) {
const Shared::VCard &crd, const std::list<KeyInfo> &aks, const std::list<KeyInfo> &iaks
) {
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
vcard = new VCard(crd); vcard = new VCard(crd);
@ -147,7 +144,6 @@ void Shared::Info::turnIntoContact(
default: default:
break; break;
} }
type = EntryType::contact; type = EntryType::contact;
} }
@ -167,13 +163,10 @@ void Shared::Info::turnIntoContact(Shared::VCard *crd, std::list<KeyInfo> *aks,
default: default:
break; break;
} }
type = EntryType::contact; type = EntryType::contact;
} }
void Shared::Info::turnIntoOwnAccount( void Shared::Info::turnIntoOwnAccount (const Shared::VCard& crd, const std::list<KeyInfo>& aks, const std::list<KeyInfo>& iaks) {
const Shared::VCard &crd, const std::list<KeyInfo> &aks, const std::list<KeyInfo> &iaks
) {
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
vcard = new VCard(crd); vcard = new VCard(crd);
@ -189,7 +182,6 @@ void Shared::Info::turnIntoOwnAccount(
default: default:
break; break;
} }
type = EntryType::ownAccount; type = EntryType::ownAccount;
} }
@ -209,7 +201,6 @@ void Shared::Info::turnIntoOwnAccount(Shared::VCard *crd, std::list<KeyInfo> *ak
default: default:
break; break;
} }
type = EntryType::ownAccount; type = EntryType::ownAccount;
} }

View File

@ -25,62 +25,41 @@
#include <list> #include <list>
namespace Shared { namespace Shared {
/** /**
* This class should contain all nessesary data to display * This class should contain all nessesary data to display
* roster element info (contact, or out of roster contact, or MUC, or MIX in the future) * roster element info (contact, or out of roster contact, or MUC, or MIX in the future)
* *
* under development yet * under development yet
*/ */
class Info { class Info : public QObject, public VCard {
public: public:
Info (); Info ();
Info (const QString& address, EntryType = EntryType::none); Info (const QString& address, EntryType = EntryType::none);
Info (const Info& other); Info (const Info& other);
Info (Info&& other); Info (Info&& other);
virtual ~Info (); virtual ~Info ();
Info& operator = (const Info& other); Info& operator = (const Info& other);
Info& operator = (Info&& other); Info& operator = (Info&& other);
QString getAddress () const; QString getAddress () const;
const QString& getAddressRef () const; const QString& getAddressRef () const;
void setAddress (const QString& address); void setAddress (const QString& address);
EntryType getType () const; EntryType getType () const;
void turnIntoNone (); void turnIntoNone ();
void turnIntoContact( void turnIntoContact (const VCard& card = VCard(), const std::list<KeyInfo>& activeKeys = {}, const std::list<KeyInfo>& inactiveKeys = {});
const VCard& card = VCard(), void turnIntoContact (VCard* card = new VCard, std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>, std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>);
const std::list<KeyInfo>& activeKeys = {}, void turnIntoOwnAccount (const VCard& card = VCard(), const std::list<KeyInfo>& activeKeys = {}, const std::list<KeyInfo>& inactiveKeys = {});
const std::list<KeyInfo>& inactiveKeys = {} void turnIntoOwnAccount (VCard* card = new VCard, std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>, std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>);
);
void turnIntoContact(
VCard* card = new VCard,
std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>,
std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>
);
void turnIntoOwnAccount(
const VCard& card = VCard(),
const std::list<KeyInfo>& activeKeys = {},
const std::list<KeyInfo>& inactiveKeys = {}
);
void turnIntoOwnAccount(
VCard* card = new VCard,
std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>,
std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>
);
const VCard& getVCardRef () const; const VCard& getVCardRef () const;
VCard& getVCardRef (); VCard& getVCardRef ();
const VCard* getVCard () const; const VCard* getVCard () const;
VCard* getVCard (); VCard* getVCard ();
void setVCard (Shared::VCard* card); void setVCard (Shared::VCard* card);
const std::list<KeyInfo>& getActiveKeysRef () const; const std::list<KeyInfo>& getActiveKeysRef () const;
std::list<KeyInfo>& getActiveKeysRef (); std::list<KeyInfo>& getActiveKeysRef ();
const std::list<KeyInfo>* getActiveKeys () const; const std::list<KeyInfo>* getActiveKeys () const;
std::list<KeyInfo>* getActiveKeys (); std::list<KeyInfo>* getActiveKeys ();
void setActiveKeys (std::list<KeyInfo>* keys); void setActiveKeys (std::list<KeyInfo>* keys);
const std::list<KeyInfo>& getInactiveKeysRef () const; const std::list<KeyInfo>& getInactiveKeysRef () const;
std::list<KeyInfo>& getInactiveKeysRef (); std::list<KeyInfo>& getInactiveKeysRef ();
const std::list<KeyInfo>* getInactiveKeys () const; const std::list<KeyInfo>* getInactiveKeys () const;
@ -89,7 +68,6 @@ public:
private: private:
EntryType type; EntryType type;
QString address; QString address;
VCard* vcard; VCard* vcard;
std::list<KeyInfo>* activeKeys; std::list<KeyInfo>* activeKeys;
std::list<KeyInfo>* inactiveKeys; std::list<KeyInfo>* inactiveKeys;