forked from blue/squawk
trying linter settings
This commit is contained in:
parent
8f5325b291
commit
93c5be412e
3640
.uncrustify.cfg
Normal file
3640
.uncrustify.cfg
Normal file
File diff suppressed because it is too large
Load Diff
117
shared/info.cpp
117
shared/info.cpp
@ -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;
|
||||||
@ -38,19 +38,20 @@ inactiveKeys(nullptr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shared::Info::Info():
|
Shared::Info::Info ():
|
||||||
type(EntryType::none),
|
type(EntryType::none),
|
||||||
address(""),
|
address(""),
|
||||||
vcard(nullptr),
|
vcard(nullptr),
|
||||||
activeKeys(nullptr),
|
activeKeys(nullptr),
|
||||||
inactiveKeys(nullptr) {}
|
inactiveKeys(nullptr) {}
|
||||||
|
|
||||||
Shared::Info::Info(const Shared::Info &other):
|
Shared::Info::Info (const Shared::Info& other):
|
||||||
type(other.type),
|
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;
|
||||||
@ -65,31 +66,29 @@ inactiveKeys(nullptr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shared::Info::Info(Info &&other):
|
Shared::Info::Info (Info&& other):
|
||||||
type(other.type),
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
Shared::Info &Shared::Info::operator=(Info &&other) {
|
Shared::Info& Shared::Info::operator = (Info&& other) {
|
||||||
type = other.type;
|
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;
|
||||||
|
|
||||||
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,15 +101,15 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shared::Info::turnIntoNone() {
|
void Shared::Info::turnIntoNone () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::none:
|
case EntryType::none:
|
||||||
break;
|
break;
|
||||||
@ -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,11 +144,10 @@ void Shared::Info::turnIntoContact(
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = EntryType::contact;
|
type = EntryType::contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shared::Info::turnIntoContact(Shared::VCard *crd, std::list<KeyInfo> *aks, std::list<KeyInfo> *iaks) {
|
void Shared::Info::turnIntoContact (Shared::VCard* crd, std::list<KeyInfo>* aks, std::list<KeyInfo>* iaks) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -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,11 +182,10 @@ void Shared::Info::turnIntoOwnAccount(
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = EntryType::ownAccount;
|
type = EntryType::ownAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shared::Info::turnIntoOwnAccount(Shared::VCard *crd, std::list<KeyInfo> *aks, std::list<KeyInfo> *iaks) {
|
void Shared::Info::turnIntoOwnAccount (Shared::VCard* crd, std::list<KeyInfo>* aks, std::list<KeyInfo>* iaks) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -209,27 +201,26 @@ void Shared::Info::turnIntoOwnAccount(Shared::VCard *crd, std::list<KeyInfo> *ak
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = EntryType::ownAccount;
|
type = EntryType::ownAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shared::Info::setAddress(const QString &addr) {
|
void Shared::Info::setAddress (const QString& addr) {
|
||||||
address = addr;
|
address = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Shared::Info::getAddress() const {
|
QString Shared::Info::getAddress () const {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Shared::Info::getAddressRef() const {
|
const QString& Shared::Info::getAddressRef () const {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
Shared::EntryType Shared::Info::getType() const {
|
Shared::EntryType Shared::Info::getType () const {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<Shared::KeyInfo> &Shared::Info::getActiveKeysRef() {
|
std::list<Shared::KeyInfo>& Shared::Info::getActiveKeysRef () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -240,7 +231,7 @@ std::list<Shared::KeyInfo> &Shared::Info::getActiveKeysRef() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<Shared::KeyInfo> &Shared::Info::getActiveKeysRef() const {
|
const std::list<Shared::KeyInfo>& Shared::Info::getActiveKeysRef () const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -251,7 +242,7 @@ const std::list<Shared::KeyInfo> &Shared::Info::getActiveKeysRef() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<Shared::KeyInfo> *Shared::Info::getActiveKeys() {
|
std::list<Shared::KeyInfo>* Shared::Info::getActiveKeys () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -262,7 +253,7 @@ std::list<Shared::KeyInfo> *Shared::Info::getActiveKeys() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<Shared::KeyInfo> *Shared::Info::getActiveKeys() const {
|
const std::list<Shared::KeyInfo>* Shared::Info::getActiveKeys () const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -273,7 +264,7 @@ const std::list<Shared::KeyInfo> *Shared::Info::getActiveKeys() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<Shared::KeyInfo> &Shared::Info::getInactiveKeysRef() {
|
std::list<Shared::KeyInfo>& Shared::Info::getInactiveKeysRef () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -284,7 +275,7 @@ std::list<Shared::KeyInfo> &Shared::Info::getInactiveKeysRef() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<Shared::KeyInfo> &Shared::Info::getInactiveKeysRef() const {
|
const std::list<Shared::KeyInfo>& Shared::Info::getInactiveKeysRef () const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -295,7 +286,7 @@ const std::list<Shared::KeyInfo> &Shared::Info::getInactiveKeysRef() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<Shared::KeyInfo> *Shared::Info::getInactiveKeys() {
|
std::list<Shared::KeyInfo>* Shared::Info::getInactiveKeys () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -306,7 +297,7 @@ std::list<Shared::KeyInfo> *Shared::Info::getInactiveKeys() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<Shared::KeyInfo> *Shared::Info::getInactiveKeys() const {
|
const std::list<Shared::KeyInfo>* Shared::Info::getInactiveKeys () const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -317,7 +308,7 @@ const std::list<Shared::KeyInfo> *Shared::Info::getInactiveKeys() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Shared::VCard &Shared::Info::getVCardRef() const {
|
const Shared::VCard& Shared::Info::getVCardRef () const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -328,7 +319,7 @@ const Shared::VCard &Shared::Info::getVCardRef() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shared::VCard &Shared::Info::getVCardRef() {
|
Shared::VCard& Shared::Info::getVCardRef () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -339,7 +330,7 @@ Shared::VCard &Shared::Info::getVCardRef() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Shared::VCard *Shared::Info::getVCard() const {
|
const Shared::VCard* Shared::Info::getVCard () const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -350,7 +341,7 @@ const Shared::VCard *Shared::Info::getVCard() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shared::VCard *Shared::Info::getVCard() {
|
Shared::VCard* Shared::Info::getVCard () {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -361,7 +352,7 @@ Shared::VCard *Shared::Info::getVCard() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shared::Info::setActiveKeys(std::list<KeyInfo> *keys) {
|
void Shared::Info::setActiveKeys (std::list<KeyInfo>* keys) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
@ -372,7 +363,7 @@ void Shared::Info::setActiveKeys(std::list<KeyInfo> *keys) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shared::Info::setVCard(Shared::VCard *card) {
|
void Shared::Info::setVCard (Shared::VCard* card) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntryType::contact:
|
case EntryType::contact:
|
||||||
case EntryType::ownAccount:
|
case EntryType::ownAccount:
|
||||||
|
@ -25,71 +25,49 @@
|
|||||||
#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;
|
||||||
|
void turnIntoNone ();
|
||||||
EntryType getType() const;
|
void turnIntoContact (const VCard& card = VCard(), const std::list<KeyInfo>& activeKeys = {}, const std::list<KeyInfo>& inactiveKeys = {});
|
||||||
void turnIntoNone();
|
void turnIntoContact (VCard* card = new VCard, std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>, std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>);
|
||||||
void turnIntoContact(
|
void turnIntoOwnAccount (const VCard& card = VCard(), const std::list<KeyInfo>& activeKeys = {}, const std::list<KeyInfo>& inactiveKeys = {});
|
||||||
const VCard& card = VCard(),
|
void turnIntoOwnAccount (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 = {},
|
const VCard& getVCardRef () const;
|
||||||
const std::list<KeyInfo>& inactiveKeys = {}
|
VCard& getVCardRef ();
|
||||||
);
|
const VCard* getVCard () const;
|
||||||
void turnIntoContact(
|
VCard* getVCard ();
|
||||||
VCard* card = new VCard,
|
void setVCard (Shared::VCard* card);
|
||||||
std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>,
|
const std::list<KeyInfo>& getActiveKeysRef () const;
|
||||||
std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>
|
std::list<KeyInfo>& getActiveKeysRef ();
|
||||||
);
|
const std::list<KeyInfo>* getActiveKeys () const;
|
||||||
void turnIntoOwnAccount(
|
std::list<KeyInfo>* getActiveKeys ();
|
||||||
const VCard& card = VCard(),
|
void setActiveKeys (std::list<KeyInfo>* keys);
|
||||||
const std::list<KeyInfo>& activeKeys = {},
|
const std::list<KeyInfo>& getInactiveKeysRef () const;
|
||||||
const std::list<KeyInfo>& inactiveKeys = {}
|
std::list<KeyInfo>& getInactiveKeysRef ();
|
||||||
);
|
const std::list<KeyInfo>* getInactiveKeys () const;
|
||||||
void turnIntoOwnAccount(
|
std::list<KeyInfo>* getInactiveKeys ();
|
||||||
VCard* card = new VCard,
|
|
||||||
std::list<KeyInfo>* activeKeys = new std::list<KeyInfo>,
|
|
||||||
std::list<KeyInfo>* inactiveKeys = new std::list<KeyInfo>
|
|
||||||
);
|
|
||||||
|
|
||||||
const VCard& getVCardRef() const;
|
|
||||||
VCard& getVCardRef();
|
|
||||||
const VCard* getVCard() const;
|
|
||||||
VCard* getVCard();
|
|
||||||
void setVCard(Shared::VCard* card);
|
|
||||||
|
|
||||||
const std::list<KeyInfo>& getActiveKeysRef() const;
|
|
||||||
std::list<KeyInfo>& getActiveKeysRef();
|
|
||||||
const std::list<KeyInfo>* getActiveKeys() const;
|
|
||||||
std::list<KeyInfo>* getActiveKeys();
|
|
||||||
void setActiveKeys(std::list<KeyInfo>* keys);
|
|
||||||
|
|
||||||
const std::list<KeyInfo>& getInactiveKeysRef() const;
|
|
||||||
std::list<KeyInfo>& getInactiveKeysRef();
|
|
||||||
const std::list<KeyInfo>* getInactiveKeys() const;
|
|
||||||
std::list<KeyInfo>* getInactiveKeys();
|
|
||||||
|
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user