Chatterino
MessageThread.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QString>
4 
5 #include <memory>
6 #include <vector>
7 
8 namespace chatterino {
9 struct Message;
10 
12 {
13 public:
14  MessageThread(std::shared_ptr<const Message> rootMessage);
16 
17  void addToThread(const std::shared_ptr<const Message> &message);
18  void addToThread(const std::weak_ptr<const Message> &message);
19 
21  size_t liveCount() const;
22 
24  size_t liveCount(const std::shared_ptr<const Message> &exclude) const;
25 
26  bool participated() const;
27 
28  void markParticipated();
29 
30  const QString &rootId() const
31  {
32  return rootMessageId_;
33  }
34 
35  const std::shared_ptr<const Message> &root() const
36  {
37  return rootMessage_;
38  }
39 
40  const std::vector<std::weak_ptr<const Message>> &replies() const
41  {
42  return replies_;
43  }
44 
45 private:
46  const QString rootMessageId_;
47  const std::shared_ptr<const Message> rootMessage_;
48  std::vector<std::weak_ptr<const Message>> replies_;
49  bool participated_ = false;
50 };
51 
52 } // namespace chatterino
void markParticipated()
Definition: MessageThread.cpp:66
Definition: MessageThread.hpp:11
Definition: Application.cpp:48
const QString & rootId() const
Definition: MessageThread.hpp:30
const std::vector< std::weak_ptr< const Message > > & replies() const
Definition: MessageThread.hpp:40
void addToThread(const std::shared_ptr< const Message > &message)
Definition: MessageThread.cpp:22
~MessageThread()
Definition: MessageThread.cpp:17
const std::shared_ptr< const Message > & root() const
Definition: MessageThread.hpp:35
size_t liveCount() const
Returns the number of live reply references.
Definition: MessageThread.cpp:32
MessageThread(std::shared_ptr< const Message > rootMessage)
Definition: MessageThread.cpp:10
bool participated() const
Definition: MessageThread.cpp:61