|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
A position in a code document. More...
#include "juce_CodeDocument.h"
Public Member Functions | |
| Position () noexcept | |
| Creates an uninitialised position. | |
| Position (const CodeDocument &ownerDocument, int line, int indexInLine) noexcept | |
| Creates a position based on a line and index in a document. | |
| Position (const CodeDocument &ownerDocument, int charactersFromStartOfDocument) noexcept | |
| Creates a position based on a character index in a document. | |
| Position (const Position &) noexcept | |
| Creates a copy of another position. | |
| ~Position () | |
| Destructor. | |
| Position & | operator= (const Position &) |
| bool | operator== (const Position &) const noexcept |
| bool | operator!= (const Position &) const noexcept |
| void | setPosition (int charactersFromStartOfDocument) |
| Points this object at a new position within the document. | |
| int | getPosition () const noexcept |
| Returns the position as the number of characters from the start of the document. | |
| void | setLineAndIndex (int newLineNumber, int newIndexInLine) |
| Moves the position to a new line and index within the line. | |
| int | getLineNumber () const noexcept |
| Returns the line number of this position. | |
| int | getIndexInLine () const noexcept |
| Returns the number of characters from the start of the line. | |
| void | setPositionMaintained (bool isMaintained) |
| Allows the position to be automatically updated when the document changes. | |
| 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. | |
| juce_wchar | getCharacter () const |
| Returns the character in the document at this position. | |
| String | getLineText () const |
| Returns the line from the document that this position is within. | |
Friends | |
| class | CodeDocument |
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.
Definition at line 62 of file juce_CodeDocument.h.
|
noexcept |
Creates an uninitialised position.
Don't attempt to call any methods on this until you've given it an owner document to refer to!
Definition at line 333 of file juce_CodeDocument.cpp.
|
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.
Definition at line 337 of file juce_CodeDocument.cpp.
|
noexcept |
Creates a position based on a character index in a document.
This position is placed at the specified number of characters from the start of the document. The line and column are auto-calculated.
If the position is beyond the range of the document, it'll be adjusted to keep it inside.
Definition at line 345 of file juce_CodeDocument.cpp.
Creates a copy of another position.
This will copy the position, but the new object will not be set to maintain its position, even if the source object was set to do so.
Definition at line 351 of file juce_CodeDocument.cpp.
| juce::CodeDocument::Position::~Position | ( | ) |
Destructor.
Definition at line 358 of file juce_CodeDocument.cpp.
| juce_wchar juce::CodeDocument::Position::getCharacter | ( | ) | const |
Returns the character in the document at this position.
Definition at line 516 of file juce_CodeDocument.cpp.
|
noexcept |
Returns the number of characters from the start of the line.
Note that this value 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!
Definition at line 144 of file juce_CodeDocument.h.
|
noexcept |
Returns the line number of this position.
The first line in the document is numbered zero, not one!
Definition at line 136 of file juce_CodeDocument.h.
| String juce::CodeDocument::Position::getLineText | ( | ) | const |
Returns the line from the document that this position is within.
Definition at line 524 of file juce_CodeDocument.cpp.
|
noexcept |
Returns the position as the number of characters from the start of the document.
Definition at line 120 of file juce_CodeDocument.h.
Moves the position forwards or backwards by the specified number of characters.
Definition at line 480 of file juce_CodeDocument.cpp.
| CodeDocument::Position juce::CodeDocument::Position::movedBy | ( | int | characterDelta | ) | const |
Returns a position which is the same as this one, moved by the specified number of characters.
Definition at line 502 of file juce_CodeDocument.cpp.
| CodeDocument::Position juce::CodeDocument::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.
Definition at line 509 of file juce_CodeDocument.cpp.
Definition at line 394 of file juce_CodeDocument.cpp.
| CodeDocument::Position & juce::CodeDocument::Position::operator= | ( | const Position & | other | ) |
Definition at line 363 of file juce_CodeDocument.cpp.
Definition at line 383 of file juce_CodeDocument.cpp.
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.
Definition at line 399 of file juce_CodeDocument.cpp.
Points this object at a new position within the document.
If the position is beyond the range of the document, it'll be adjusted to keep it inside.
Definition at line 435 of file juce_CodeDocument.cpp.
Allows the position to be automatically updated when the document changes.
If this is set to true, the position will register with its document so that when the document has text inserted or deleted, this position will be automatically moved to keep it at the same position in the text.
Definition at line 532 of file juce_CodeDocument.cpp.
|
friend |
Definition at line 187 of file juce_CodeDocument.h.