|
RADLib
RADical C++ application framework
|
Text document model with file load/save and modified state. More...
#include <RADWidgets.h>
Inheritance diagram for RADUi::TextDocumentModel:
Collaboration diagram for RADUi::TextDocumentModel:Public Member Functions | |
| const std::string & | text () const |
| Returns document text. More... | |
| void | setText (std::string text) |
| Replaces document text and marks modified. More... | |
| const std::string & | fileName () const |
| Returns associated file path. More... | |
| bool | isModified () const |
| Returns true when text changed since load/save. More... | |
| bool | loadFromFile (const std::string &fileName) |
| Loads text from fileName. More... | |
| bool | save () |
| Saves to the current fileName. More... | |
| bool | saveAs (const std::string &fileName) |
| Saves to fileName and updates the current file. More... | |
| void | clear () |
| Clears text and file state. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Public Attributes | |
| RADCore::Event< void() > | changed |
| Raised when text, filename, or modified state changes. More... | |
Text document model with file load/save and modified state.
| void RADUi::TextDocumentModel::clear | ( | ) |
Clears text and file state.
| const std::string& RADUi::TextDocumentModel::fileName | ( | ) | const |
Returns associated file path.
| bool RADUi::TextDocumentModel::isModified | ( | ) | const |
Returns true when text changed since load/save.
| bool RADUi::TextDocumentModel::loadFromFile | ( | const std::string & | fileName | ) |
Loads text from fileName.
| bool RADUi::TextDocumentModel::save | ( | ) |
Saves to the current fileName.
| bool RADUi::TextDocumentModel::saveAs | ( | const std::string & | fileName | ) |
Saves to fileName and updates the current file.
| void RADUi::TextDocumentModel::setText | ( | std::string | text | ) |
Replaces document text and marks modified.
| const std::string& RADUi::TextDocumentModel::text | ( | ) | const |
Returns document text.
| RADCore::Event<void () > RADUi::TextDocumentModel::changed |
Raised when text, filename, or modified state changes.