|
RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
|
#include <NotesManager.h>
Public Member Functions | |
| NotesManager (NotesManagerConfig cfg, std::shared_ptr< ImGuiToaster > toaster) | |
| void | loadAllFromDisk () |
| void | loadFromGlobal () |
| void | loadFromTable (const std::string &tableName) |
| std::string | createNote (std::string title, std::string author, std::optional< std::string > tableName=std::nullopt) |
| bool | saveNote (const std::string &uuid) |
| bool | saveNoteAs (const std::string &uuid, const std::filesystem::path &absolutePath) |
| bool | deleteNote (const std::string &uuid, bool deleteFromDisk) |
| std::shared_ptr< Note > | getNote (const std::string &uuid) |
| std::shared_ptr< const Note > | getNote (const std::string &uuid) const |
| std::vector< std::shared_ptr< Note > > | listAll () |
| std::vector< std::shared_ptr< Note > > | listMyNotes () |
| std::vector< std::shared_ptr< Note > > | listInbox () |
| void | setTitle (const std::string &uuid, std::string title) |
| void | setContent (const std::string &uuid, std::string md) |
| void | setAuthor (const std::string &uuid, std::string author) |
| std::string | upsertSharedIncoming (std::string uuid, std::string title, std::string author, std::string markdown, std::optional< std::string > fromPeerName) |
| bool | saveInboxToLocal (const std::string &uuid, std::optional< std::string > tableName=std::nullopt) |
| std::filesystem::path | defaultSavePath (const Note ¬e) const |
| std::shared_ptr< Note > | getByUuid (const std::string &uuid) const |
| std::string | resolveRef (const std::string &ref) const |
| void | indexNote (const std::shared_ptr< Note > &n) |
| void | removeFromIndex (const std::string &uuid) |
Static Public Member Functions | |
| static std::string | generateUUID () |
| static std::string | slugify (const std::string &title) |
| static int64_t | toEpochMillis (std::chrono::system_clock::time_point tp) |
| static std::chrono::system_clock::time_point | fromEpochMillis (int64_t ms) |
| static bool | parseMarkdownFile (const std::filesystem::path &path, Note &outNote) |
| static bool | writeMarkdownFile (const std::filesystem::path &path, const Note ¬e) |
Private Member Functions | |
| void | scanFolderForMd_ (const std::filesystem::path &dir, std::optional< std::string > tableName) |
| void | toastInfo (const std::string &msg) const |
| void | toastGood (const std::string &msg) const |
| void | toastWarn (const std::string &msg) const |
| void | toastError (const std::string &msg) const |
Static Private Member Functions | |
| static bool | looksLikeUuid_ (const std::string &s) |
| static bool | looksLikeShortHex_ (const std::string &s) |
| static std::string | toLower_ (const std::string &s) |
Private Attributes | |
| std::unordered_map< std::string, std::shared_ptr< Note > > | notesByUuid_ |
| std::unordered_map< std::string, std::string > | titleToUuid_ |
| NotesManagerConfig | cfg_ |
| std::shared_ptr< ImGuiToaster > | toaster_ |
| std::mutex | mtx_ |
| std::unordered_map< std::string, std::shared_ptr< Note > > | notesById_ |
Definition at line 49 of file NotesManager.h.
| NotesManager::NotesManager | ( | NotesManagerConfig | cfg, |
| std::shared_ptr< ImGuiToaster > | toaster ) |
Definition at line 20 of file NotesManager.cpp.
| std::string NotesManager::createNote | ( | std::string | title, |
| std::string | author, | ||
| std::optional< std::string > | tableName = std::nullopt ) |
Definition at line 95 of file NotesManager.cpp.
| std::filesystem::path NotesManager::defaultSavePath | ( | const Note & | note | ) | const |
Definition at line 347 of file NotesManager.cpp.
| bool NotesManager::deleteNote | ( | const std::string & | uuid, |
| bool | deleteFromDisk ) |
Definition at line 173 of file NotesManager.cpp.
|
static |
Definition at line 390 of file NotesManager.cpp.
|
static |
Definition at line 357 of file NotesManager.cpp.
| std::shared_ptr< Note > NotesManager::getByUuid | ( | const std::string & | uuid | ) | const |
Definition at line 551 of file NotesManager.cpp.
| std::shared_ptr< Note > NotesManager::getNote | ( | const std::string & | uuid | ) |
Definition at line 190 of file NotesManager.cpp.
| std::shared_ptr< const Note > NotesManager::getNote | ( | const std::string & | uuid | ) | const |
Definition at line 197 of file NotesManager.cpp.
| void NotesManager::indexNote | ( | const std::shared_ptr< Note > & | n | ) |
Definition at line 557 of file NotesManager.cpp.
| std::vector< std::shared_ptr< Note > > NotesManager::listAll | ( | ) |
Definition at line 204 of file NotesManager.cpp.
| std::vector< std::shared_ptr< Note > > NotesManager::listInbox | ( | ) |
Definition at line 227 of file NotesManager.cpp.
| std::vector< std::shared_ptr< Note > > NotesManager::listMyNotes | ( | ) |
Definition at line 214 of file NotesManager.cpp.
| void NotesManager::loadAllFromDisk | ( | ) |
Definition at line 30 of file NotesManager.cpp.
| void NotesManager::loadFromGlobal | ( | ) |
Definition at line 51 of file NotesManager.cpp.
| void NotesManager::loadFromTable | ( | const std::string & | tableName | ) |
Definition at line 58 of file NotesManager.cpp.
|
staticprivate |
Definition at line 666 of file NotesManager.cpp.
|
staticprivate |
Definition at line 645 of file NotesManager.cpp.
|
static |
Definition at line 396 of file NotesManager.cpp.
| void NotesManager::removeFromIndex | ( | const std::string & | uuid | ) |
Definition at line 570 of file NotesManager.cpp.
| std::string NotesManager::resolveRef | ( | const std::string & | ref | ) | const |
Definition at line 589 of file NotesManager.cpp.
| bool NotesManager::saveInboxToLocal | ( | const std::string & | uuid, |
| std::optional< std::string > | tableName = std::nullopt ) |
Definition at line 316 of file NotesManager.cpp.
| bool NotesManager::saveNote | ( | const std::string & | uuid | ) |
Definition at line 120 of file NotesManager.cpp.
| bool NotesManager::saveNoteAs | ( | const std::string & | uuid, |
| const std::filesystem::path & | absolutePath ) |
Definition at line 148 of file NotesManager.cpp.
|
private |
Definition at line 66 of file NotesManager.cpp.
| void NotesManager::setAuthor | ( | const std::string & | uuid, |
| std::string | author ) |
Definition at line 262 of file NotesManager.cpp.
| void NotesManager::setContent | ( | const std::string & | uuid, |
| std::string | md ) |
Definition at line 251 of file NotesManager.cpp.
| void NotesManager::setTitle | ( | const std::string & | uuid, |
| std::string | title ) |
Definition at line 240 of file NotesManager.cpp.
|
static |
Definition at line 368 of file NotesManager.cpp.
|
private |
Definition at line 545 of file NotesManager.cpp.
|
private |
Definition at line 535 of file NotesManager.cpp.
|
private |
Definition at line 530 of file NotesManager.cpp.
|
private |
Definition at line 540 of file NotesManager.cpp.
|
static |
Definition at line 386 of file NotesManager.cpp.
|
staticprivate |
Definition at line 680 of file NotesManager.cpp.
| std::string NotesManager::upsertSharedIncoming | ( | std::string | uuid, |
| std::string | title, | ||
| std::string | author, | ||
| std::string | markdown, | ||
| std::optional< std::string > | fromPeerName ) |
Definition at line 273 of file NotesManager.cpp.
|
static |
Definition at line 506 of file NotesManager.cpp.
|
private |
Definition at line 123 of file NotesManager.h.
|
mutableprivate |
Definition at line 126 of file NotesManager.h.
|
private |
Definition at line 127 of file NotesManager.h.
|
private |
Definition at line 113 of file NotesManager.h.
|
private |
Definition at line 116 of file NotesManager.h.
|
private |
Definition at line 124 of file NotesManager.h.