mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(ContactId): Add clone function to ChatId interface
So that History can load history messages without needing to know what type of Chat the messages are from.
This commit is contained in:
parent
71c3f997b4
commit
cfe18f8340
|
@ -41,6 +41,7 @@ public:
|
||||||
const uint8_t* getData() const;
|
const uint8_t* getData() const;
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
virtual int getSize() const = 0;
|
virtual int getSize() const = 0;
|
||||||
|
virtual std::unique_ptr<ChatId> clone() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ChatId();
|
ChatId();
|
||||||
|
|
|
@ -67,3 +67,8 @@ int GroupId::getSize() const
|
||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ChatId> GroupId::clone() const
|
||||||
|
{
|
||||||
|
return std::unique_ptr<ChatId>(new GroupId(*this));
|
||||||
|
}
|
||||||
|
|
|
@ -31,4 +31,5 @@ public:
|
||||||
explicit GroupId(const QByteArray& rawId);
|
explicit GroupId(const QByteArray& rawId);
|
||||||
explicit GroupId(const uint8_t* rawId);
|
explicit GroupId(const uint8_t* rawId);
|
||||||
int getSize() const override;
|
int getSize() const override;
|
||||||
|
std::unique_ptr<ChatId> clone() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,3 +87,8 @@ int ToxPk::getSize() const
|
||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ChatId> ToxPk::clone() const
|
||||||
|
{
|
||||||
|
return std::unique_ptr<ChatId>(new ToxPk(*this));
|
||||||
|
}
|
||||||
|
|
|
@ -33,4 +33,5 @@ public:
|
||||||
explicit ToxPk(const uint8_t* rawId);
|
explicit ToxPk(const uint8_t* rawId);
|
||||||
explicit ToxPk(const QString& pk);
|
explicit ToxPk(const QString& pk);
|
||||||
int getSize() const override;
|
int getSize() const override;
|
||||||
|
std::unique_ptr<ChatId> clone() const override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user