1 // Scintilla source code edit control
3 ** Manages data associated with each line of the document
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.
14 * This holds the marker identifier and the marker type to display.
15 * MarkerHandleNumbers are members of lists.
17 struct MarkerHandleNumber
{
20 MarkerHandleNumber(int handle_
, int number_
) noexcept
: handle(handle_
), number(number_
) {}
24 * A marker handle set contains any number of MarkerHandleNumbers.
26 class MarkerHandleSet
{
27 std::forward_list
<MarkerHandleNumber
> mhList
;
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;
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.
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
;
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
;
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
;
84 void InsertLine(Sci::Line line
) override
;
85 void RemoveLine(Sci::Line line
) override
;
87 void ExpandLevels(Sci::Line sizeNew
=-1);
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
;
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
;
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
);
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
;
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;