Loading...
Searching...
No Matches
juce::CodeDocument::Iterator Class Reference

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

Public Member Functions

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

Constructors and Destructors

◆ Iterator() [1/4]

juce::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!

Referenced by Iterator(), Iterator(), Iterator(), operator=(), and ~Iterator().

◆ Iterator() [2/4]

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

◆ Iterator() [3/4]

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

◆ ~Iterator()

juce::CodeDocument::Iterator::~Iterator ( )
noexcept

References Iterator().

◆ Iterator() [4/4]

juce::CodeDocument::Iterator::Iterator ( const Iterator & )
default

References Iterator().

Member Functions

◆ operator=()

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

References Iterator().

◆ nextChar()

juce_wchar juce::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

References nextChar().

Referenced by nextChar().

◆ peekNextChar()

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

Reads the next character without moving the current position.

References peekNextChar().

Referenced by peekNextChar().

◆ previousChar()

juce_wchar juce::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

References previousChar().

Referenced by previousChar().

◆ peekPreviousChar()

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

Reads the next character without moving the current position.

References peekPreviousChar().

Referenced by peekPreviousChar().

◆ skip()

void juce::CodeDocument::Iterator::skip ( )
noexcept

Advances the position by one character.

References skip().

Referenced by skip().

◆ getPosition()

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

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

References getPosition().

Referenced by getPosition().

◆ skipWhitespace()

void juce::CodeDocument::Iterator::skipWhitespace ( )
noexcept

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

◆ skipToEndOfLine()

void juce::CodeDocument::Iterator::skipToEndOfLine ( )
noexcept

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

References skipToEndOfLine().

Referenced by skipToEndOfLine().

◆ skipToStartOfLine()

void juce::CodeDocument::Iterator::skipToStartOfLine ( )
noexcept

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

References skipToStartOfLine().

Referenced by skipToStartOfLine().

◆ getLine()

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

Returns the line number of the next character.

References getLine().

Referenced by getLine().

◆ isEOF()

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

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

◆ isSOF()

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

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

References isSOF().

Referenced by isSOF().

◆ toPosition()

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

Convert this iterator to a CodeDocument::Position.

References juce::CodeDocument::CodeDocument(), and toPosition().

Referenced by toPosition().

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram