1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTEXTBLOCK_P_H
5#define QTEXTBLOCK_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qstring.h>
19
20QT_BEGIN_NAMESPACE
21
22namespace Utils {
23
24class TextDocument;
25class TextBlockUserData;
26
27class TextBlock
28{
29public:
30 bool isValid() const;
31
32 void setBlockNumber(int blockNumber);
33 int blockNumber() const;
34
35 void setPosition(int position);
36 int position() const;
37
38 void setLength(int length);
39 int length() const;
40
41 TextBlock next() const;
42 TextBlock previous() const;
43
44 int userState() const;
45 void setUserState(int state);
46
47 bool isVisible() const;
48 void setVisible(bool visible);
49
50 void setLineCount(int count);
51 int lineCount() const;
52
53 void setDocument(TextDocument *document);
54 TextDocument *document() const;
55
56 QString text() const;
57
58 int revision() const;
59 void setRevision(int rev);
60
61 friend bool operator==(const TextBlock &t1, const TextBlock &t2);
62 friend bool operator!=(const TextBlock &t1, const TextBlock &t2);
63
64private:
65 TextDocument *m_document = nullptr;
66 int m_revision = 0;
67
68 int m_position = 0;
69 int m_length = 0;
70 int m_blockNumber = -1;
71};
72
73} // namespace Utils
74
75QT_END_NAMESPACE
76
77#endif // TEXTBLOCK_P_H
78

source code of qtdeclarative/src/qmlls/qtextblock_p.h