FileBasedDocument — document model with save/load/dirty tracking.
More...
#include <code_editor.hpp>
|
| | FileBasedDocument ()=default |
| virtual | ~FileBasedDocument ()=default |
| bool | load (std::string_view path) |
| | Load from a file path.
|
| bool | save () |
| | Save to the current path.
|
| bool | save_as (std::string_view path) |
| | Save to a new path.
|
| bool | is_dirty () const |
| | Whether the document has unsaved changes.
|
| void | set_dirty (bool d=true) |
| const std::string & | file_path () const |
| | Current file path.
|
| std::string | title () const |
| | Document title (filename without extension).
|
| virtual bool | load_from_file (std::string_view path)=0 |
| | Override to implement loading.
|
| virtual bool | save_to_file (std::string_view path)=0 |
| | Override to implement saving.
|
FileBasedDocument — document model with save/load/dirty tracking.
◆ FileBasedDocument()
| pulp::view::FileBasedDocument::FileBasedDocument |
( |
| ) |
|
|
default |
◆ ~FileBasedDocument()
| virtual pulp::view::FileBasedDocument::~FileBasedDocument |
( |
| ) |
|
|
virtualdefault |
◆ file_path()
| const std::string & pulp::view::FileBasedDocument::file_path |
( |
| ) |
const |
|
inline |
◆ is_dirty()
| bool pulp::view::FileBasedDocument::is_dirty |
( |
| ) |
const |
|
inline |
Whether the document has unsaved changes.
◆ load()
| bool pulp::view::FileBasedDocument::load |
( |
std::string_view | path | ) |
|
◆ load_from_file()
| virtual bool pulp::view::FileBasedDocument::load_from_file |
( |
std::string_view | path | ) |
|
|
pure virtual |
Override to implement loading.
◆ save()
| bool pulp::view::FileBasedDocument::save |
( |
| ) |
|
Save to the current path.
◆ save_as()
| bool pulp::view::FileBasedDocument::save_as |
( |
std::string_view | path | ) |
|
◆ save_to_file()
| virtual bool pulp::view::FileBasedDocument::save_to_file |
( |
std::string_view | path | ) |
|
|
pure virtual |
Override to implement saving.
◆ set_dirty()
| void pulp::view::FileBasedDocument::set_dirty |
( |
bool | d = true | ) |
|
|
inline |
◆ title()
| std::string pulp::view::FileBasedDocument::title |
( |
| ) |
const |
Document title (filename without extension).
◆ on_dirty_changed
| std::function<void(bool is_dirty)> pulp::view::FileBasedDocument::on_dirty_changed |
Called when dirty state changes.
The documentation for this class was generated from the following file: