Main application class for the C/C++ editor backend.
More...
#include <undoAppCpp.hpp>
|
| bool | initialize () |
| | Initialize the C/C++ editor (idempotent)
|
| |
| void | shutdown () |
| | Shutdown the C/C++ editor.
|
| |
| void | openFile (const std::string &path) |
| | Open a file and load it into the editor.
|
| |
| void | renameFileTo (const std::string &path) |
| | Record that the file this editor holds has moved on disk.
|
| |
| void | saveFile () |
| | Write the editor's current text back to m_currentFilePath.
|
| |
| void | closeFile () |
| | Clear the editor and forget the current file.
|
| |
| void | renderEditorPanel () |
| | Render the editor inside the unified "Editor" ImGui window.
|
| |
| void | setDocument (const std::string &path, const std::string &text) |
| | Put what is on screen back into an editor, under a new file name.
|
| |
| void | document (std::string &path, std::string &text) const |
| | The editor's text and the file it belongs to.
|
| |
| bool | hasUnsavedChanges () const |
| | Whether the text on screen differs from the file on disk.
|
| |
|
| void | setupEditor () |
| | (Re)create the TextEditor widget with C++ language definition
|
| |
| std::string | getLanguageLabel (const std::string &path) const |
| | Get the language label based on file extension.
|
| |
Main application class for the C/C++ editor backend.
This is one of the backends owned by undoApp::Editor::EditorApp. It is not registered as an ImGui panel on its own: the EditorApp routes its single "Editor" panel here when the current file is a C or C++ source or header file.
◆ closeFile()
| void undoApp::CppApp::closeFile |
( |
| ) |
|
Clear the editor and forget the current file.
◆ document()
| void undoApp::CppApp::document |
( |
std::string & |
path, |
|
|
std::string & |
text |
|
) |
| const |
The editor's text and the file it belongs to.
◆ getInstance()
| static CppApp & undoApp::CppApp::getInstance |
( |
| ) |
|
|
static |
Get the singleton instance of CppApp.
◆ getLanguageLabel()
| std::string undoApp::CppApp::getLanguageLabel |
( |
const std::string & |
path | ) |
const |
|
private |
Get the language label based on file extension.
◆ hasUnsavedChanges()
| bool undoApp::CppApp::hasUnsavedChanges |
( |
| ) |
const |
|
inline |
Whether the text on screen differs from the file on disk.
Sticky for the same reason as the text backend's: the editor's own flag is cleared by the next Render(), and an answer that expires cannot be what a tab's unsaved mark is drawn from.
◆ initialize()
| bool undoApp::CppApp::initialize |
( |
| ) |
|
Initialize the C/C++ editor (idempotent)
◆ openFile()
| void undoApp::CppApp::openFile |
( |
const std::string & |
path | ) |
|
Open a file and load it into the editor.
◆ renameFileTo()
| void undoApp::CppApp::renameFileTo |
( |
const std::string & |
path | ) |
|
Record that the file this editor holds has moved on disk.
Only the path, never the text: the editor is still showing the same file, and without this a save after a rename writes a second copy at the old path.
- Parameters
-
| path | Where the file now is |
◆ renderEditorPanel()
| void undoApp::CppApp::renderEditorPanel |
( |
| ) |
|
Render the editor inside the unified "Editor" ImGui window.
◆ saveFile()
| void undoApp::CppApp::saveFile |
( |
| ) |
|
Write the editor's current text back to m_currentFilePath.
◆ setDocument()
| void undoApp::CppApp::setDocument |
( |
const std::string & |
path, |
|
|
const std::string & |
text |
|
) |
| |
Put what is on screen back into an editor, under a new file name.
The two ends of switching tabs: a backend holds one file, so several open means taking the text out before the next is loaded and putting it back when this one is shown again. The path comes separately from the text because it is where a later save goes, and re-reading it from disk would lose anything not written yet.
- Parameters
-
| path | The file the text belongs to |
| text | The text as it is now, unsaved changes included |
◆ setupEditor()
| void undoApp::CppApp::setupEditor |
( |
| ) |
|
|
private |
(Re)create the TextEditor widget with C++ language definition
◆ shutdown()
| void undoApp::CppApp::shutdown |
( |
| ) |
|
Shutdown the C/C++ editor.
◆ m_currentFilePath
| std::string undoApp::CppApp::m_currentFilePath |
|
private |
◆ m_editor
| std::unique_ptr<TextEditor> undoApp::CppApp::m_editor |
|
private |
◆ m_initialized
| bool undoApp::CppApp::m_initialized = false |
|
private |
◆ m_isDirty
| bool undoApp::CppApp::m_isDirty = false |
|
private |
Editor text differs from the file on disk.
◆ m_outputLines
| std::vector<std::string> undoApp::CppApp::m_outputLines |
|
private |
The documentation for this class was generated from the following file: