geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Go to the documentation of this file.
1/** @file RunStyles.h
2 ** Data structure used to store sparse styles.
3 **/
4// Copyright 1998-2007 by Neil Hodgson <>
5// The License.txt file describes the conditions under which this software may be distributed.
7/// Styling buffer using one element for each run rather than using
8/// a filled buffer.
10#ifndef RUNSTYLES_H
11#define RUNSTYLES_H
13namespace Scintilla {
15// Return for RunStyles::FillRange reports if anything was changed and the
16// range that was changed. This may be trimmed from the requested range
17// when some of the requested range already had the requested value.
18template <typename DISTANCE>
19struct FillResult {
20 bool changed;
21 DISTANCE position;
22 DISTANCE fillLength;
25template <typename DISTANCE, typename STYLE>
26class RunStyles {
28 std::unique_ptr<Partitioning<DISTANCE>> starts;
29 std::unique_ptr<SplitVector<STYLE>> styles;
30 DISTANCE RunFromPosition(DISTANCE position) const noexcept;
31 DISTANCE SplitRun(DISTANCE position);
32 void RemoveRun(DISTANCE run);
33 void RemoveRunIfEmpty(DISTANCE run);
34 void RemoveRunIfSameAsPrevious(DISTANCE run);
36 RunStyles();
37 // Deleted so RunStyles objects can not be copied.
38 RunStyles(const RunStyles &) = delete;
39 RunStyles(RunStyles &&) = delete;
40 void operator=(const RunStyles &) = delete;
41 void operator=(RunStyles &&) = delete;
42 ~RunStyles();
43 DISTANCE Length() const noexcept;
44 STYLE ValueAt(DISTANCE position) const noexcept;
45 DISTANCE FindNextChange(DISTANCE position, DISTANCE end) const noexcept;
46 DISTANCE StartRun(DISTANCE position) const noexcept;
47 DISTANCE EndRun(DISTANCE position) const noexcept;
48 // Returns changed=true if some values may have changed
49 FillResult<DISTANCE> FillRange(DISTANCE position, STYLE value, DISTANCE fillLength);
50 void SetValueAt(DISTANCE position, STYLE value);
51 void InsertSpace(DISTANCE position, DISTANCE insertLength);
52 void DeleteAll();
53 void DeleteRange(DISTANCE position, DISTANCE deleteLength);
54 DISTANCE Runs() const noexcept;
55 bool AllSame() const noexcept;
56 bool AllSameAs(STYLE value) const noexcept;
57 DISTANCE Find(STYLE value, DISTANCE start) const noexcept;
59 void Check() const;
DISTANCE StartRun(DISTANCE position) const noexcept
Definition: RunStyles.cxx:121
void RemoveRunIfSameAsPrevious(DISTANCE run)
Definition: RunStyles.cxx:71
DISTANCE RunFromPosition(DISTANCE position) const noexcept
Definition: RunStyles.cxx:32
void Check() const
Definition: RunStyles.cxx:281
RunStyles(RunStyles &&)=delete
std::unique_ptr< Partitioning< DISTANCE > > starts
Definition: RunStyles.h:28
STYLE ValueAt(DISTANCE position) const noexcept
Definition: RunStyles.cxx:96
RunStyles(const RunStyles &)=delete
DISTANCE Runs() const noexcept
Definition: RunStyles.cxx:246
void RemoveRun(DISTANCE run)
Definition: RunStyles.cxx:56
DISTANCE SplitRun(DISTANCE position)
Definition: RunStyles.cxx:43
DISTANCE EndRun(DISTANCE position) const noexcept
Definition: RunStyles.cxx:126
DISTANCE FindNextChange(DISTANCE position, DISTANCE end) const noexcept
Definition: RunStyles.cxx:101
void operator=(RunStyles &&)=delete
FillResult< DISTANCE > FillRange(DISTANCE position, STYLE value, DISTANCE fillLength)
Definition: RunStyles.cxx:131
void RemoveRunIfEmpty(DISTANCE run)
Definition: RunStyles.cxx:62
void operator=(const RunStyles &)=delete
bool AllSame() const noexcept
Definition: RunStyles.cxx:251
DISTANCE Find(STYLE value, DISTANCE start) const noexcept
Definition: RunStyles.cxx:265
bool AllSameAs(STYLE value) const noexcept
Definition: RunStyles.cxx:260
void DeleteRange(DISTANCE position, DISTANCE deleteLength)
Definition: RunStyles.cxx:224
void InsertSpace(DISTANCE position, DISTANCE insertLength)
Definition: RunStyles.cxx:188
DISTANCE Length() const noexcept
Definition: RunStyles.cxx:91
void SetValueAt(DISTANCE position, STYLE value)
Definition: RunStyles.cxx:183
std::unique_ptr< SplitVector< STYLE > > styles
Definition: RunStyles.h:29
Styling buffer using one element for each run rather than using a filled buffer.
Definition: Converter.h:9
gint position[2]
Definition: search.c:120