JUCE
Public Member Functions | List of all members
CodeDocument::Iterator Class Reference

Iterates the text in a CodeDocument. More...

Public Member Functions

 Iterator () noexcept
 Creates an uninitialised iterator. More...
 
 Iterator (const CodeDocument &document) noexcept
 
 Iterator (CodeDocument::Position) noexcept
 
 ~Iterator () noexcept
 
 Iterator (const Iterator &)=default
 
Iteratoroperator= (const Iterator &)=default
 
juce_wchar nextChar () noexcept
 Reads the next character and returns it. More...
 
juce_wchar peekNextChar () const noexcept
 Reads the next character without moving the current position. More...
 
juce_wchar previousChar () noexcept
 Reads the previous character and returns it. More...
 
juce_wchar peekPreviousChar () const noexcept
 Reads the next character without moving the current position. More...
 
void skip () noexcept
 Advances the position by one character. More...
 
int getPosition () const noexcept
 Returns the position as the number of characters from the start of the document. More...
 
void skipWhitespace () noexcept
 Skips over any whitespace characters until the next character is non-whitespace. More...
 
void skipToEndOfLine () noexcept
 Skips forward until the next character will be the first character on the next line. More...
 
void skipToStartOfLine () noexcept
 Skips backward until the next character will be the first character on this line. More...
 
int getLine () const noexcept
 Returns the line number of the next character. More...
 
bool isEOF () const noexcept
 Returns true if the iterator has reached the end of the document. More...
 
bool isSOF () const noexcept
 Returns true if the iterator is at the start of the document. More...
 
CodeDocument::Position toPosition () const
 Convert this iterator to a CodeDocument::Position. More...
 

Detailed Description

Iterates the text in a CodeDocument.

This class lets you read characters from a CodeDocument. It's designed to be used by a CodeTokeniser object.

See also
CodeDocument

Constructor & Destructor Documentation

◆ Iterator() [1/4]

CodeDocument::Iterator::Iterator ( )
noexcept

Creates an uninitialised iterator.

Don't attempt to call any methods on this until you've given it an owner document to refer to!

◆ Iterator() [2/4]

CodeDocument::Iterator::Iterator ( const CodeDocument document)
noexcept

◆ Iterator() [3/4]

CodeDocument::Iterator::Iterator ( CodeDocument::Position  )
noexcept

◆ ~Iterator()

CodeDocument::Iterator::~Iterator ( )
noexcept

◆ Iterator() [4/4]

CodeDocument::Iterator::Iterator ( const Iterator )
default

Member Function Documentation

◆ operator=()

Iterator& CodeDocument::Iterator::operator= ( const Iterator )
default

◆ nextChar()

juce_wchar CodeDocument::Iterator::nextChar ( )
noexcept

Reads the next character and returns it.

Returns 0 if you try to read past the document's end.

See also
peekNextChar, previousChar

◆ peekNextChar()

juce_wchar CodeDocument::Iterator::peekNextChar ( ) const
noexcept

Reads the next character without moving the current position.

◆ previousChar()

juce_wchar CodeDocument::Iterator::previousChar ( )
noexcept

Reads the previous character and returns it.

Returns 0 if you try to read past the document's start.

See also
isSOF, peekPreviousChar, nextChar

◆ peekPreviousChar()

juce_wchar CodeDocument::Iterator::peekPreviousChar ( ) const
noexcept

Reads the next character without moving the current position.

◆ skip()

void CodeDocument::Iterator::skip ( )
noexcept

Advances the position by one character.

◆ getPosition()

int CodeDocument::Iterator::getPosition ( ) const
noexcept

Returns the position as the number of characters from the start of the document.

◆ skipWhitespace()

void CodeDocument::Iterator::skipWhitespace ( )
noexcept

Skips over any whitespace characters until the next character is non-whitespace.

◆ skipToEndOfLine()

void CodeDocument::Iterator::skipToEndOfLine ( )
noexcept

Skips forward until the next character will be the first character on the next line.

◆ skipToStartOfLine()

void CodeDocument::Iterator::skipToStartOfLine ( )
noexcept

Skips backward until the next character will be the first character on this line.

◆ getLine()

int CodeDocument::Iterator::getLine ( ) const
noexcept

Returns the line number of the next character.

◆ isEOF()

bool CodeDocument::Iterator::isEOF ( ) const
noexcept

Returns true if the iterator has reached the end of the document.

◆ isSOF()

bool CodeDocument::Iterator::isSOF ( ) const
noexcept

Returns true if the iterator is at the start of the document.

◆ toPosition()

CodeDocument::Position CodeDocument::Iterator::toPosition ( ) const

Convert this iterator to a CodeDocument::Position.


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