mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
73fdbba59c
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <AK/CircularQueue.h>
|
|
#include <AK/RefPtr.h>
|
|
#include <AK/RefCounted.h>
|
|
#include <LibDraw/Color.h>
|
|
|
|
class IRCLogBufferModel;
|
|
|
|
class IRCLogBuffer : public RefCounted<IRCLogBuffer> {
|
|
public:
|
|
static NonnullRefPtr<IRCLogBuffer> create();
|
|
~IRCLogBuffer();
|
|
|
|
struct Message {
|
|
time_t timestamp { 0 };
|
|
char prefix { 0 };
|
|
String sender;
|
|
String text;
|
|
Color color { Color::Black };
|
|
};
|
|
|
|
int count() const { return m_messages.size(); }
|
|
const Message& at(int index) const { return m_messages.at(index); }
|
|
void add_message(char prefix, const String& name, const String& text, Color = Color::Black);
|
|
void add_message(const String& text, Color = Color::Black);
|
|
void dump() const;
|
|
|
|
const IRCLogBufferModel* model() const { return m_model.ptr(); }
|
|
IRCLogBufferModel* model() { return m_model.ptr(); }
|
|
|
|
private:
|
|
IRCLogBuffer();
|
|
NonnullRefPtr<IRCLogBufferModel> m_model;
|
|
CircularQueue<Message, 1000> m_messages;
|
|
};
|