mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
30 lines
612 B
C
30 lines
612 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <AK/ByteBuffer.h>
|
||
|
|
#include <AK/NonnullRefPtr.h>
|
||
|
|
#include <AK/RefCounted.h>
|
||
|
|
#include <AK/String.h>
|
||
|
|
|
||
|
|
class TextDocument : public RefCounted<TextDocument> {
|
||
|
|
public:
|
||
|
|
static NonnullRefPtr<TextDocument> construct_with_name(const String& name)
|
||
|
|
{
|
||
|
|
return adopt(*new TextDocument(name));
|
||
|
|
}
|
||
|
|
|
||
|
|
const String& name() const { return m_name; }
|
||
|
|
|
||
|
|
const ByteBuffer& contents() const;
|
||
|
|
|
||
|
|
Vector<int> find(const StringView&) const;
|
||
|
|
|
||
|
|
private:
|
||
|
|
explicit TextDocument(const String& name)
|
||
|
|
: m_name(name)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
String m_name;
|
||
|
|
mutable ByteBuffer m_contents;
|
||
|
|
};
|