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)  

Scintilla::CellBuffer Class Reference

Holder for an expandable array of characters that supports undo and line markers. More...

#include <CellBuffer.h>

Collaboration diagram for Scintilla::CellBuffer:
[legend]

Public Member Functions

 CellBuffer (bool hasStyles_, bool largeDocument_)
 
 CellBuffer (const CellBuffer &)=delete
 
 CellBuffer (CellBuffer &&)=delete
 
void operator= (const CellBuffer &)=delete
 
void operator= (CellBuffer &&)=delete
 
 ~CellBuffer ()
 
char CharAt (Sci::Position position) const noexcept
 Retrieving positions outside the range of the buffer works and returns 0. More...
 
unsigned char UCharAt (Sci::Position position) const noexcept
 
void GetCharRange (char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const
 
char StyleAt (Sci::Position position) const noexcept
 
void GetStyleRange (unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const
 
const char * BufferPointer ()
 
const char * RangePointer (Sci::Position position, Sci::Position rangeLength) noexcept
 
Sci::Position GapPosition () const noexcept
 
Sci::Position Length () const noexcept
 
void Allocate (Sci::Position newSize)
 
void SetUTF8Substance (bool utf8Substance_) noexcept
 
int GetLineEndTypes () const noexcept
 
void SetLineEndTypes (int utf8LineEnds_)
 
bool ContainsLineEnd (const char *s, Sci::Position length) const noexcept
 
void SetPerLine (PerLine *pl) noexcept
 
int LineCharacterIndex () const noexcept
 
void AllocateLineCharacterIndex (int lineCharacterIndex)
 
void ReleaseLineCharacterIndex (int lineCharacterIndex)
 
Sci::Line Lines () const noexcept
 
Sci::Position LineStart (Sci::Line line) const noexcept
 
Sci::Position IndexLineStart (Sci::Line line, int lineCharacterIndex) const noexcept
 
Sci::Line LineFromPosition (Sci::Position pos) const noexcept
 
Sci::Line LineFromPositionIndex (Sci::Position pos, int lineCharacterIndex) const noexcept
 
void InsertLine (Sci::Line line, Sci::Position position, bool lineStart)
 
void RemoveLine (Sci::Line line)
 
const char * InsertString (Sci::Position position, const char *s, Sci::Position insertLength, bool &startSequence)
 
bool SetStyleAt (Sci::Position position, char styleValue) noexcept
 Setting styles for positions outside the range of the buffer is safe and has no effect. More...
 
bool SetStyleFor (Sci::Position position, Sci::Position lengthStyle, char styleValue) noexcept
 
const char * DeleteChars (Sci::Position position, Sci::Position deleteLength, bool &startSequence)
 
bool IsReadOnly () const noexcept
 
void SetReadOnly (bool set) noexcept
 
bool IsLarge () const noexcept
 
bool HasStyles () const noexcept
 
void SetSavePoint ()
 The save point is a marker in the undo stack where the container has stated that the buffer was saved. More...
 
bool IsSavePoint () const noexcept
 
void TentativeStart ()
 
void TentativeCommit ()
 
bool TentativeActive () const noexcept
 
int TentativeSteps () noexcept
 
bool SetUndoCollection (bool collectUndo)
 
bool IsCollectingUndo () const noexcept
 
void BeginUndoAction ()
 
void EndUndoAction ()
 
void AddUndoAction (Sci::Position token, bool mayCoalesce)
 
void DeleteUndoHistory ()
 
bool CanUndo () const noexcept
 To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is called that many times. More...
 
int StartUndo ()
 
const ActionGetUndoStep () const
 
void PerformUndoStep ()
 
bool CanRedo () const noexcept
 
int StartRedo ()
 
const ActionGetRedoStep () const
 
void PerformRedoStep ()
 

Private Member Functions

bool UTF8LineEndOverlaps (Sci::Position position) const noexcept
 
bool UTF8IsCharacterBoundary (Sci::Position position) const
 
void ResetLineEnds ()
 
void RecalculateIndexLineStarts (Sci::Line lineFirst, Sci::Line lineLast)
 
bool MaintainingLineCharacterIndex () const noexcept
 
void BasicInsertString (Sci::Position position, const char *s, Sci::Position insertLength)
 Actions without undo. More...
 
void BasicDeleteChars (Sci::Position position, Sci::Position deleteLength)
 

Private Attributes

bool hasStyles
 
bool largeDocument
 
SplitVector< char > substance
 
SplitVector< char > style
 
bool readOnly
 
bool utf8Substance
 
int utf8LineEnds
 
bool collectingUndo
 
UndoHistory uh
 
std::unique_ptr< ILineVectorplv
 

Detailed Description

Holder for an expandable array of characters that supports undo and line markers.

Based on article "Data Structures in a Bit-Mapped Text Editor" by Wilfred J. Hansen, Byte January 1987, page 183.

Definition at line 110 of file CellBuffer.h.

Constructor & Destructor Documentation

◆ CellBuffer() [1/3]

CellBuffer::CellBuffer ( bool  hasStyles_,
bool  largeDocument_ 
)

Definition at line 567 of file CellBuffer.cxx.

References collectingUndo, largeDocument, plv, readOnly, utf8LineEnds, and utf8Substance.

◆ CellBuffer() [2/3]

Scintilla::CellBuffer::CellBuffer ( const CellBuffer )
delete

◆ CellBuffer() [3/3]

Scintilla::CellBuffer::CellBuffer ( CellBuffer &&  )
delete

◆ ~CellBuffer()

CellBuffer::~CellBuffer ( )

Definition at line 579 of file CellBuffer.cxx.

Member Function Documentation

◆ AddUndoAction()

void CellBuffer::AddUndoAction ( Sci::Position  token,
bool  mayCoalesce 
)

◆ Allocate()

void CellBuffer::Allocate ( Sci::Position  newSize)

Definition at line 709 of file CellBuffer.cxx.

References hasStyles, style, and substance.

Referenced by Scintilla::Document::Allocate().

◆ AllocateLineCharacterIndex()

void CellBuffer::AllocateLineCharacterIndex ( int  lineCharacterIndex)

◆ BasicDeleteChars()

◆ BasicInsertString()

◆ BeginUndoAction()

void CellBuffer::BeginUndoAction ( )

Definition at line 1236 of file CellBuffer.cxx.

References Scintilla::UndoHistory::BeginUndoAction(), and uh.

Referenced by Scintilla::Document::BeginUndoAction().

◆ BufferPointer()

const char * CellBuffer::BufferPointer ( )

Definition at line 628 of file CellBuffer.cxx.

References substance.

Referenced by Scintilla::Document::BufferPointer().

◆ CanRedo()

bool CellBuffer::CanRedo ( ) const
noexcept

Definition at line 1279 of file CellBuffer.cxx.

References Scintilla::UndoHistory::CanRedo(), and uh.

Referenced by Scintilla::Document::CanRedo().

◆ CanUndo()

bool CellBuffer::CanUndo ( ) const
noexcept

To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is called that many times.

Similarly for redo.

Definition at line 1253 of file CellBuffer.cxx.

References Scintilla::UndoHistory::CanUndo(), and uh.

Referenced by Scintilla::Document::CanUndo().

◆ CharAt()

◆ ContainsLineEnd()

bool CellBuffer::ContainsLineEnd ( const char *  s,
Sci::Position  length 
) const
noexcept

Definition at line 729 of file CellBuffer.cxx.

References Scintilla::UTF8IsMultibyteLineEnd().

Referenced by Scintilla::Document::ContainsLineEnd().

◆ DeleteChars()

const char * CellBuffer::DeleteChars ( Sci::Position  position,
Sci::Position  deleteLength,
bool &  startSequence 
)

◆ DeleteUndoHistory()

void CellBuffer::DeleteUndoHistory ( )

◆ EndUndoAction()

void CellBuffer::EndUndoAction ( )

Definition at line 1240 of file CellBuffer.cxx.

References Scintilla::UndoHistory::EndUndoAction(), and uh.

Referenced by Scintilla::Document::EndUndoAction().

◆ GapPosition()

Sci::Position CellBuffer::GapPosition ( ) const
noexcept

Definition at line 636 of file CellBuffer.cxx.

References substance.

Referenced by Scintilla::Document::GapPosition().

◆ GetCharRange()

void CellBuffer::GetCharRange ( char *  buffer,
Sci::Position  position,
Sci::Position  lengthRetrieve 
) const

◆ GetLineEndTypes()

int Scintilla::CellBuffer::GetLineEndTypes ( ) const
inlinenoexcept

◆ GetRedoStep()

const Action & CellBuffer::GetRedoStep ( ) const

Definition at line 1287 of file CellBuffer.cxx.

References Scintilla::UndoHistory::GetRedoStep(), and uh.

Referenced by Scintilla::Document::Redo().

◆ GetStyleRange()

void CellBuffer::GetStyleRange ( unsigned char *  buffer,
Sci::Position  position,
Sci::Position  lengthRetrieve 
) const

◆ GetUndoStep()

const Action & CellBuffer::GetUndoStep ( ) const

◆ HasStyles()

bool CellBuffer::HasStyles ( ) const
noexcept

Definition at line 805 of file CellBuffer.cxx.

References hasStyles.

Referenced by Scintilla::Document::Options().

◆ IndexLineStart()

Sci::Position CellBuffer::IndexLineStart ( Sci::Line  line,
int  lineCharacterIndex 
) const
noexcept

Definition at line 785 of file CellBuffer.cxx.

References line.

◆ InsertLine()

void CellBuffer::InsertLine ( Sci::Line  line,
Sci::Position  position,
bool  lineStart 
)

Definition at line 835 of file CellBuffer.cxx.

References line, plv, and position.

Referenced by BasicInsertString(), and ResetLineEnds().

◆ InsertString()

const char * CellBuffer::InsertString ( Sci::Position  position,
const char *  s,
Sci::Position  insertLength,
bool &  startSequence 
)

◆ IsCollectingUndo()

◆ IsLarge()

bool CellBuffer::IsLarge ( ) const
noexcept

Definition at line 801 of file CellBuffer.cxx.

References largeDocument.

Referenced by Scintilla::Document::IsLarge().

◆ IsReadOnly()

◆ IsSavePoint()

◆ Length()

Sci::Position CellBuffer::Length ( ) const
noexcept

◆ LineCharacterIndex()

int CellBuffer::LineCharacterIndex ( ) const
noexcept

Definition at line 751 of file CellBuffer.cxx.

References plv.

Referenced by Scintilla::Document::LineCharacterIndex().

◆ LineFromPosition()

Sci::Line CellBuffer::LineFromPosition ( Sci::Position  pos) const
noexcept

Definition at line 781 of file CellBuffer.cxx.

References pos.

Referenced by Scintilla::Document::LineFromPosition().

◆ LineFromPositionIndex()

Sci::Line CellBuffer::LineFromPositionIndex ( Sci::Position  pos,
int  lineCharacterIndex 
) const
noexcept

Definition at line 789 of file CellBuffer.cxx.

References pos.

◆ Lines()

Sci::Line CellBuffer::Lines ( ) const
noexcept

Definition at line 768 of file CellBuffer.cxx.

References plv.

Referenced by AllocateLineCharacterIndex(), and Scintilla::Document::LinesTotal().

◆ LineStart()

Sci::Position CellBuffer::LineStart ( Sci::Line  line) const
noexcept

Definition at line 772 of file CellBuffer.cxx.

References line.

Referenced by Scintilla::Document::LineStart(), and RecalculateIndexLineStarts().

◆ MaintainingLineCharacterIndex()

bool CellBuffer::MaintainingLineCharacterIndex ( ) const
privatenoexcept

Definition at line 936 of file CellBuffer.cxx.

References plv, and SC_LINECHARACTERINDEX_NONE.

Referenced by BasicDeleteChars(), and BasicInsertString().

◆ operator=() [1/2]

void Scintilla::CellBuffer::operator= ( CellBuffer &&  )
delete

◆ operator=() [2/2]

void Scintilla::CellBuffer::operator= ( const CellBuffer )
delete

◆ PerformRedoStep()

◆ PerformUndoStep()

◆ RangePointer()

const char * CellBuffer::RangePointer ( Sci::Position  position,
Sci::Position  rangeLength 
)
noexcept

Definition at line 632 of file CellBuffer.cxx.

References position.

Referenced by Scintilla::Document::RangePointer().

◆ RecalculateIndexLineStarts()

void CellBuffer::RecalculateIndexLineStarts ( Sci::Line  lineFirst,
Sci::Line  lineLast 
)
private

Definition at line 940 of file CellBuffer.cxx.

References GetCharRange(), line, LineStart(), plv, and text.

Referenced by AllocateLineCharacterIndex(), BasicDeleteChars(), and BasicInsertString().

◆ ReleaseLineCharacterIndex()

void CellBuffer::ReleaseLineCharacterIndex ( int  lineCharacterIndex)

Definition at line 764 of file CellBuffer.cxx.

References plv.

Referenced by Scintilla::Document::ReleaseLineCharacterIndex().

◆ RemoveLine()

void CellBuffer::RemoveLine ( Sci::Line  line)

Definition at line 839 of file CellBuffer.cxx.

References line, and plv.

Referenced by BasicDeleteChars(), and BasicInsertString().

◆ ResetLineEnds()

void CellBuffer::ResetLineEnds ( )
private

◆ SetLineEndTypes()

void CellBuffer::SetLineEndTypes ( int  utf8LineEnds_)

◆ SetPerLine()

void CellBuffer::SetPerLine ( PerLine pl)
noexcept

Definition at line 747 of file CellBuffer.cxx.

Referenced by Scintilla::Document::Document().

◆ SetReadOnly()

void CellBuffer::SetReadOnly ( bool  set)
noexcept

Definition at line 797 of file CellBuffer.cxx.

References set.

Referenced by Scintilla::Document::SetReadOnly().

◆ SetSavePoint()

void CellBuffer::SetSavePoint ( )

The save point is a marker in the undo stack where the container has stated that the buffer was saved.

Undo and redo can move over the save point.

Definition at line 809 of file CellBuffer.cxx.

References Scintilla::UndoHistory::SetSavePoint(), and uh.

Referenced by Scintilla::Document::SetSavePoint().

◆ SetStyleAt()

bool CellBuffer::SetStyleAt ( Sci::Position  position,
char  styleValue 
)
noexcept

Setting styles for positions outside the range of the buffer is safe and has no effect.

Returns
true if the style of a character is changed.

Definition at line 656 of file CellBuffer.cxx.

References position.

Referenced by Scintilla::Document::SetStyles().

◆ SetStyleFor()

bool CellBuffer::SetStyleFor ( Sci::Position  position,
Sci::Position  lengthStyle,
char  styleValue 
)
noexcept

Definition at line 669 of file CellBuffer.cxx.

References PLATFORM_ASSERT, and position.

Referenced by Scintilla::Document::SetStyleFor().

◆ SetUndoCollection()

bool CellBuffer::SetUndoCollection ( bool  collectUndo)

◆ SetUTF8Substance()

void CellBuffer::SetUTF8Substance ( bool  utf8Substance_)
noexcept

◆ StartRedo()

int CellBuffer::StartRedo ( )

Definition at line 1283 of file CellBuffer.cxx.

References Scintilla::UndoHistory::StartRedo(), and uh.

Referenced by Scintilla::Document::Redo().

◆ StartUndo()

int CellBuffer::StartUndo ( )

Definition at line 1257 of file CellBuffer.cxx.

References Scintilla::UndoHistory::StartUndo(), and uh.

Referenced by Scintilla::Document::Undo().

◆ StyleAt()

char CellBuffer::StyleAt ( Sci::Position  position) const
noexcept

Definition at line 605 of file CellBuffer.cxx.

References position.

Referenced by Scintilla::Document::StyleAt(), and Scintilla::Document::StyleIndexAt().

◆ TentativeActive()

bool CellBuffer::TentativeActive ( ) const
noexcept

Definition at line 829 of file CellBuffer.cxx.

References Scintilla::UndoHistory::TentativeActive(), and uh.

Referenced by Scintilla::Document::TentativeActive().

◆ TentativeCommit()

void CellBuffer::TentativeCommit ( )

◆ TentativeStart()

void CellBuffer::TentativeStart ( )

Definition at line 817 of file CellBuffer.cxx.

References Scintilla::UndoHistory::TentativeStart(), and uh.

Referenced by Scintilla::Document::TentativeStart().

◆ TentativeSteps()

int CellBuffer::TentativeSteps ( )
noexcept

Definition at line 825 of file CellBuffer.cxx.

References Scintilla::UndoHistory::TentativeSteps(), and uh.

Referenced by Scintilla::Document::TentativeUndo().

◆ UCharAt()

unsigned char CellBuffer::UCharAt ( Sci::Position  position) const
noexcept

◆ UTF8IsCharacterBoundary()

bool CellBuffer::UTF8IsCharacterBoundary ( Sci::Position  position) const
private

◆ UTF8LineEndOverlaps()

bool CellBuffer::UTF8LineEndOverlaps ( Sci::Position  position) const
privatenoexcept

Member Data Documentation

◆ collectingUndo

bool Scintilla::CellBuffer::collectingUndo
private

◆ hasStyles

bool Scintilla::CellBuffer::hasStyles
private

Definition at line 112 of file CellBuffer.h.

Referenced by Allocate(), BasicDeleteChars(), BasicInsertString(), GetStyleRange(), and HasStyles().

◆ largeDocument

bool Scintilla::CellBuffer::largeDocument
private

Definition at line 113 of file CellBuffer.h.

Referenced by CellBuffer(), and IsLarge().

◆ plv

◆ readOnly

bool Scintilla::CellBuffer::readOnly
private

Definition at line 116 of file CellBuffer.h.

Referenced by CellBuffer(), DeleteChars(), InsertString(), and IsReadOnly().

◆ style

SplitVector<char> Scintilla::CellBuffer::style
private

Definition at line 115 of file CellBuffer.h.

Referenced by Allocate(), BasicDeleteChars(), BasicInsertString(), and GetStyleRange().

◆ substance

◆ uh

◆ utf8LineEnds

int Scintilla::CellBuffer::utf8LineEnds
private

◆ utf8Substance

bool Scintilla::CellBuffer::utf8Substance
private

The documentation for this class was generated from the following files: