summaryrefslogtreecommitdiffstatshomepage
path: root/DocumentBuffer.h
blob: 5e499b7c17b83ae53a56e21c3ee00819da45c458 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef DOCUMENTBUFFER_H
#define DOCUMENTBUFFER_H

#include <QLinkedList>
#include <QList>
#include <QString>
#include <QChar>
#include <QPair>

class DocumentBuffer
{
public:
	void insertCharacterAt(QChar character, int row, int col);
	QPair<int, int> setText(const QString &string, int width);
	QChar topCharacterAt(int row, int col) const;
	QString topLineAt(int row) const;
	QString topDocument() const;
	const QLinkedList<QChar>& charactersAt(int row, int col) const;
	const QList<QLinkedList<QChar > >& lineAt(int row) const;
	const QList<QList<QLinkedList<QChar> > >& document() const;
	int lineSize(int row) const;
	int linesCount() const;
	QVariant toVariant() const;
	static DocumentBuffer* fromVariant(const QVariant &variant);

private:
	QList<QList<QLinkedList<QChar> > > m_document;
};

#endif // DOCUMENTBUFFER_H