an idea how to manage info object better

This commit is contained in:
Blue 2023-03-01 22:32:41 +03:00
parent ec362cef55
commit 6f32e99593
Signed by: blue
GPG key ID: 9B203B252A63EE38
12 changed files with 390 additions and 63 deletions

View file

@ -34,16 +34,59 @@ namespace Shared {
class Info {
public:
Info();
Info(const QString& jid, EntryType = EntryType::contact, bool editable = false);
Info(const QString& address, EntryType = EntryType::none);
Info(const Info& other);
~Info();
virtual ~Info();
QString getAddress() const;
const QString& getAddressRef() const;
void setAddress(const QString& address);
EntryType getType() const;
void turnIntoNone();
void turnIntoContact(
const VCard& card = VCard(),
const std::list<KeyInfo>& activeKeys = {},
const std::list<KeyInfo>& inactiveKeys = {}
);
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;
VCard& getVCardRef();
const VCard* getVCard() const;
VCard* getVCard();
const std::list<KeyInfo>& getActiveKeysRef() const;
std::list<KeyInfo>& getActiveKeysRef();
const std::list<KeyInfo>* getActiveKeys() const;
std::list<KeyInfo>* getActiveKeys();
const std::list<KeyInfo>& getInactiveKeysRef() const;
std::list<KeyInfo>& getInactiveKeysRef();
const std::list<KeyInfo>* getInactiveKeys() const;
std::list<KeyInfo>* getInactiveKeys();
private:
EntryType type;
QString jid;
bool editable;
VCard vcard;
std::list<KeyInfo> activeKeys;
std::list<KeyInfo> inactiveKeys;
QString address;
VCard* vcard;
std::list<KeyInfo>* activeKeys;
std::list<KeyInfo>* inactiveKeys;
};
}