|
| | Position () noexcept |
| | Creates an uninitialised position.
|
| |
| | Position (const CodeDocument &ownerDocument, int charactersFromStartOfDocument) noexcept |
| | Creates a position based on a character index in a document.
|
| |
| | Position (const CodeDocument &ownerDocument, int line, int indexInLine) noexcept |
| | Creates a position based on a line and index in a document.
|
| |
| | Position (const Position &) noexcept |
| | Creates a copy of another position.
|
| |
| | ~Position () |
| | Destructor.
|
| |
| juce_wchar | getCharacter () const |
| | Returns the character in the document at this position.
|
| |
| int | getIndexInLine () const noexcept |
| | Returns the number of characters from the start of the line.
|
| |
| int | getLineNumber () const noexcept |
| | Returns the line number of this position.
|
| |
| String | getLineText () const |
| | Returns the line from the document that this position is within.
|
| |
| int | getPosition () const noexcept |
| | Returns the position as the number of characters from the start of the document.
|
| |
| void | moveBy (int characterDelta) |
| | Moves the position forwards or backwards by the specified number of characters.
|
| |
| Position | movedBy (int characterDelta) const |
| | Returns a position which is the same as this one, moved by the specified number of characters.
|
| |
| Position | movedByLines (int deltaLines) const |
| | Returns a position which is the same as this one, moved up or down by the specified number of lines.
|
| |
| bool | operator!= (const Position &) const noexcept |
| |
| Position & | operator= (const Position &) |
| |
| bool | operator== (const Position &) const noexcept |
| |
| void | setLineAndIndex (int newLineNumber, int newIndexInLine) |
| | Moves the position to a new line and index within the line.
|
| |
| void | setPosition (int charactersFromStartOfDocument) |
| | Points this object at a new position within the document.
|
| |
| void | setPositionMaintained (bool isMaintained) |
| | Allows the position to be automatically updated when the document changes.
|
| |
A position in a code document.
Using this class you can find a position in a code document and quickly get its character position, line, and index. By calling setPositionMaintained (true), the position is automatically updated when text is inserted or deleted in the document, so that it maintains its original place in the text.
| juce::CodeDocument::Position::Position |
( |
const CodeDocument & |
ownerDocument, |
|
|
int |
line, |
|
|
int |
indexInLine |
|
) |
| |
|
noexcept |
Creates a position based on a line and index in a document.
Note that this index is NOT the column number, it's the number of characters from the start of the line. The "column" number isn't quite the same, because if the line contains any tab characters, the relationship of the index to its visual column depends on the number of spaces per tab being used!
Lines are numbered from zero, and if the line or index are beyond the bounds of the document, they will be adjusted to keep them within its limits.
| void juce::CodeDocument::Position::setLineAndIndex |
( |
int |
newLineNumber, |
|
|
int |
newIndexInLine |
|
) |
| |
Moves the position to a new line and index within the line.
Note that the index is NOT the column at which the position appears in an editor. If the line contains any tab characters, the relationship of the index to its visual position depends on the number of spaces per tab being used!
Lines are numbered from zero, and if the line or index are beyond the bounds of the document, they will be adjusted to keep them within its limits.