2009-04-24 23:35:41 +00:00
|
|
|
/** @file RunStyles.h
|
|
|
|
** Data structure used to store sparse styles.
|
|
|
|
**/
|
|
|
|
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
|
|
|
|
// The License.txt file describes the conditions under which this software may be distributed.
|
|
|
|
|
|
|
|
/// Styling buffer using one element for each run rather than using
|
|
|
|
/// a filled buffer.
|
|
|
|
|
2009-04-25 23:38:15 +00:00
|
|
|
#ifndef RUNSTYLES_H
|
|
|
|
#define RUNSTYLES_H
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
namespace Scintilla {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class RunStyles {
|
2011-07-17 22:30:49 +00:00
|
|
|
private:
|
2009-04-24 23:35:41 +00:00
|
|
|
Partitioning *starts;
|
|
|
|
SplitVector<int> *styles;
|
2011-07-17 22:30:49 +00:00
|
|
|
int RunFromPosition(int position) const;
|
2009-04-24 23:35:41 +00:00
|
|
|
int SplitRun(int position);
|
|
|
|
void RemoveRun(int run);
|
|
|
|
void RemoveRunIfEmpty(int run);
|
|
|
|
void RemoveRunIfSameAsPrevious(int run);
|
2013-08-28 00:44:27 +00:00
|
|
|
// Private so RunStyles objects can not be copied
|
|
|
|
RunStyles(const RunStyles &);
|
2009-04-24 23:35:41 +00:00
|
|
|
public:
|
|
|
|
RunStyles();
|
|
|
|
~RunStyles();
|
|
|
|
int Length() const;
|
|
|
|
int ValueAt(int position) const;
|
2013-08-28 00:44:27 +00:00
|
|
|
int FindNextChange(int position, int end) const;
|
|
|
|
int StartRun(int position) const;
|
|
|
|
int EndRun(int position) const;
|
2009-04-24 23:35:41 +00:00
|
|
|
// Returns true if some values may have changed
|
|
|
|
bool FillRange(int &position, int value, int &fillLength);
|
|
|
|
void SetValueAt(int position, int value);
|
|
|
|
void InsertSpace(int position, int insertLength);
|
|
|
|
void DeleteAll();
|
|
|
|
void DeleteRange(int position, int deleteLength);
|
2011-07-17 22:30:49 +00:00
|
|
|
int Runs() const;
|
|
|
|
bool AllSame() const;
|
|
|
|
bool AllSameAs(int value) const;
|
|
|
|
int Find(int value, int start) const;
|
2013-08-28 00:44:27 +00:00
|
|
|
|
|
|
|
void Check() const;
|
2009-04-24 23:35:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
}
|
|
|
|
#endif
|
2009-04-25 23:38:15 +00:00
|
|
|
|
|
|
|
#endif
|