|
LMMS
|
#include <juce_CodeDocument.h>
Classes | |
| class | Position |
| class | Listener |
| class | Iterator |
| struct | InsertAction |
| struct | DeleteAction |
Private Member Functions | |
| void | insert (const String &text, int insertPos, bool undoable) |
| void | remove (int startPos, int endPos, bool undoable) |
| void | checkLastLineStatus () |
Private Attributes | |
| OwnedArray< CodeDocumentLine > | lines |
| Array< Position * > | positionsToMaintain |
| UndoManager | undoManager |
| int | currentActionIndex = 0 |
| int | indexOfSavedState = -1 |
| int | maximumLineLength = -1 |
| ListenerList< Listener > | listeners |
| String | newLineChars { "\r\n" } |
Friends | |
| class | Iterator |
| class | Position |
A class for storing and manipulating a source code file.
When using a CodeEditorComponent, it takes one of these as its source object.
The CodeDocument stores its content as an array of lines, which makes it quick to insert and delete.
@tags{GUI}
| juce::CodeDocument::CodeDocument | ( | ) |
Creates a new, empty document.
| juce::CodeDocument::~CodeDocument | ( | ) |
Destructor.
| void juce::CodeDocument::addListener | ( | CodeDocument::Listener * | l | ) |
Registers a listener object to receive callbacks when the document changes. If the listener is already registered, this method has no effect.
Analyses the changes between the current content and some new text, and applies those changes.
|
private |
| void juce::CodeDocument::clearUndoHistory | ( | ) |
Clears the undo history.
| void juce::CodeDocument::deleteSection | ( | const Position & | startPosition, |
| const Position & | endPosition ) |
Deletes a section of the text. This operation is undoable.
Deletes a section of the text. This operation is undoable.
|
noexcept |
Finds the line that contains the given position.
|
noexcept |
Finds the token that contains the given position.
|
noexcept |
Searches for a word-break.
|
noexcept |
Searches for a word-break.
| String juce::CodeDocument::getAllContent | ( | ) | const |
Returns the full text of the document.
Returns a line from the document.
|
noexcept |
Returns the number of characters in the longest line of the document.
|
inlinenoexcept |
Returns the preferred new-line characters for the document. This will be either "\\n", "\\r\\n", or (rarely) "\\r".
|
noexcept |
Returns the number of characters in the document.
|
inlinenoexcept |
Returns the number of lines in the document.
Returns a section of the document's text.
|
inlinenoexcept |
Returns the document's UndoManager
|
noexcept |
Returns true if the state of the document differs from the state it was in when setSavePoint() was last called.
Inserts some text into the document at a given position. This operation is undoable.
Inserts some text into the document at a given position. This operation is undoable.
| bool juce::CodeDocument::loadFromStream | ( | InputStream & | stream | ) |
Replaces the editor's contents with the contents of a stream. This will also reset the undo history and save point marker.
| void juce::CodeDocument::newTransaction | ( | ) |
Begins a new undo transaction.
The document itself will not call this internally, so relies on whatever is using the document to periodically call this to break up the undo sequence into sensible chunks.
| void juce::CodeDocument::redo | ( | ) |
Redo the last operation.
| void juce::CodeDocument::removeListener | ( | CodeDocument::Listener * | l | ) |
Deregisters a listener.
Clears the document and replaces it with some new text.
This operation is undoable - if you're trying to completely reset the document, you might want to also call clearUndoHistory() and setSavePoint() after using this method.
Replaces a section of the text with a new string. This operation is undoable.
Sets the new-line characters that the document should use. The string must be either "\\n", "\\r\\n", or (rarely) "\\r".
|
noexcept |
Makes a note that the document's current state matches the one that is saved.
After this has been called, hasChangedSinceSavePoint() will return false until the document has been altered, and then it'll start returning true. If the document is altered, but then undone until it gets back to this state, hasChangedSinceSavePoint() will again return false.
| void juce::CodeDocument::undo | ( | ) |
Undo the last operation.
| bool juce::CodeDocument::writeToStream | ( | OutputStream & | stream | ) |
Writes the editor's current contents to a stream.
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |