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

#include <juce_CodeDocument.h>

Public Member Functions

 Iterator () noexcept
 Iterator (const CodeDocument &document) noexcept
 Iterator (CodeDocument::Position) noexcept
 ~Iterator () noexcept
 Iterator (const Iterator &)=default
Iteratoroperator= (const Iterator &)=default
juce_wchar nextChar () noexcept
juce_wchar peekNextChar () const noexcept
juce_wchar previousChar () noexcept
juce_wchar peekPreviousChar () const noexcept
void skip () noexcept
int getPosition () const noexcept
void skipWhitespace () noexcept
void skipToEndOfLine () noexcept
void skipToStartOfLine () noexcept
int getLine () const noexcept
bool isEOF () const noexcept
bool isSOF () const noexcept
CodeDocument::Position toPosition () const

Private Member Functions

bool reinitialiseCharPtr () const

Private Attributes

const CodeDocumentdocument
String::CharPointerType charPointer { nullptr }
int line = 0
int position = 0

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]

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!

◆ Iterator() [2/4]

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

◆ Iterator() [3/4]

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

◆ ~Iterator()

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

◆ Iterator() [4/4]

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

Member Function Documentation

◆ getLine()

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

Returns the line number of the next character.

◆ getPosition()

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

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

◆ 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.

◆ 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

◆ operator=()

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

◆ peekNextChar()

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

Reads the next character without moving the current position.

◆ peekPreviousChar()

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

Reads the next character without moving the current position.

◆ 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

◆ reinitialiseCharPtr()

bool juce::CodeDocument::Iterator::reinitialiseCharPtr ( ) const
private

You're trying to use a default constructed iterator. Bad idea!

◆ skip()

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

Advances the position by one character.

◆ skipToEndOfLine()

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

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

◆ skipToStartOfLine()

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

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

◆ skipWhitespace()

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

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

◆ toPosition()

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

Convert this iterator to a CodeDocument::Position.

Member Data Documentation

◆ charPointer

String::CharPointerType juce::CodeDocument::Iterator::charPointer { nullptr }
mutableprivate

◆ document

const CodeDocument* juce::CodeDocument::Iterator::document
private

◆ line

int juce::CodeDocument::Iterator::line = 0
private

◆ position

int juce::CodeDocument::Iterator::position = 0
private

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