Merge pull request #2212 from TwlyY29/bibtex-parser
[geany-mirror.git] / scintilla / src / PerLine.h
blob94dc17a2040256906f41215aa1a4579450adef0d
1 // Scintilla source code edit control
2 /** @file PerLine.h
3 ** Manages data associated with each line of the document
4 **/
5 // Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #ifndef PERLINE_H
9 #define PERLINE_H
11 namespace Scintilla {
13 /**
14 * This holds the marker identifier and the marker type to display.
15 * MarkerHandleNumbers are members of lists.
17 struct MarkerHandleNumber {
18 int handle;
19 int number;
20 MarkerHandleNumber(int handle_, int number_) noexcept : handle(handle_), number(number_) {}
23 /**
24 * A marker handle set contains any number of MarkerHandleNumbers.
26 class MarkerHandleSet {
27 std::forward_list<MarkerHandleNumber> mhList;
29 public:
30 MarkerHandleSet();
31 // Deleted so MarkerHandleSet objects can not be copied.
32 MarkerHandleSet(const MarkerHandleSet &) = delete;
33 MarkerHandleSet(MarkerHandleSet &&) = delete;
34 void operator=(const MarkerHandleSet &) = delete;
35 void operator=(MarkerHandleSet &&) = delete;
36 ~MarkerHandleSet();
37 bool Empty() const noexcept;
38 int MarkValue() const noexcept; ///< Bit set of marker numbers.
39 bool Contains(int handle) const noexcept;
40 bool InsertHandle(int handle, int markerNum);
41 void RemoveHandle(int handle);
42 bool RemoveNumber(int markerNum, bool all);
43 void CombineWith(MarkerHandleSet *other);
46 class LineMarkers : public PerLine {
47 SplitVector<std::unique_ptr<MarkerHandleSet>> markers;
48 /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
49 int handleCurrent;
50 public:
51 LineMarkers() : handleCurrent(0) {
53 // Deleted so LineMarkers objects can not be copied.
54 LineMarkers(const LineMarkers &) = delete;
55 LineMarkers(LineMarkers &&) = delete;
56 void operator=(const LineMarkers &) = delete;
57 void operator=(LineMarkers &&) = delete;
58 ~LineMarkers() override;
59 void Init() override;
60 void InsertLine(Sci::Line line) override;
61 void RemoveLine(Sci::Line line) override;
63 int MarkValue(Sci::Line line) noexcept;
64 Sci::Line MarkerNext(Sci::Line lineStart, int mask) const;
65 int AddMark(Sci::Line line, int markerNum, Sci::Line lines);
66 void MergeMarkers(Sci::Line line);
67 bool DeleteMark(Sci::Line line, int markerNum, bool all);
68 void DeleteMarkFromHandle(int markerHandle);
69 Sci::Line LineFromHandle(int markerHandle);
72 class LineLevels : public PerLine {
73 SplitVector<int> levels;
74 public:
75 LineLevels() {
77 // Deleted so LineLevels objects can not be copied.
78 LineLevels(const LineLevels &) = delete;
79 LineLevels(LineLevels &&) = delete;
80 void operator=(const LineLevels &) = delete;
81 void operator=(LineLevels &&) = delete;
82 ~LineLevels() override;
83 void Init() override;
84 void InsertLine(Sci::Line line) override;
85 void RemoveLine(Sci::Line line) override;
87 void ExpandLevels(Sci::Line sizeNew=-1);
88 void ClearLevels();
89 int SetLevel(Sci::Line line, int level, Sci::Line lines);
90 int GetLevel(Sci::Line line) const;
93 class LineState : public PerLine {
94 SplitVector<int> lineStates;
95 public:
96 LineState() {
98 // Deleted so LineState objects can not be copied.
99 LineState(const LineState &) = delete;
100 LineState(LineState &&) = delete;
101 void operator=(const LineState &) = delete;
102 void operator=(LineState &&) = delete;
103 ~LineState() override;
104 void Init() override;
105 void InsertLine(Sci::Line line) override;
106 void RemoveLine(Sci::Line line) override;
108 int SetLineState(Sci::Line line, int state);
109 int GetLineState(Sci::Line line);
110 Sci::Line GetMaxLineState() const;
113 class LineAnnotation : public PerLine {
114 SplitVector<std::unique_ptr<char []>> annotations;
115 public:
116 LineAnnotation() {
118 // Deleted so LineAnnotation objects can not be copied.
119 LineAnnotation(const LineAnnotation &) = delete;
120 LineAnnotation(LineAnnotation &&) = delete;
121 void operator=(const LineAnnotation &) = delete;
122 void operator=(LineAnnotation &&) = delete;
123 ~LineAnnotation() override;
124 void Init() override;
125 void InsertLine(Sci::Line line) override;
126 void RemoveLine(Sci::Line line) override;
128 bool MultipleStyles(Sci::Line line) const;
129 int Style(Sci::Line line) const;
130 const char *Text(Sci::Line line) const;
131 const unsigned char *Styles(Sci::Line line) const;
132 void SetText(Sci::Line line, const char *text);
133 void ClearAll();
134 void SetStyle(Sci::Line line, int style);
135 void SetStyles(Sci::Line line, const unsigned char *styles);
136 int Length(Sci::Line line) const;
137 int Lines(Sci::Line line) const;
140 typedef std::vector<int> TabstopList;
142 class LineTabstops : public PerLine {
143 SplitVector<std::unique_ptr<TabstopList>> tabstops;
144 public:
145 LineTabstops() {
147 // Deleted so LineTabstops objects can not be copied.
148 LineTabstops(const LineTabstops &) = delete;
149 LineTabstops(LineTabstops &&) = delete;
150 void operator=(const LineTabstops &) = delete;
151 void operator=(LineTabstops &&) = delete;
152 ~LineTabstops() override;
153 void Init() override;
154 void InsertLine(Sci::Line line) override;
155 void RemoveLine(Sci::Line line) override;
157 bool ClearTabstops(Sci::Line line);
158 bool AddTabstop(Sci::Line line, int x);
159 int GetNextTabstop(Sci::Line line, int x) const;
164 #endif