4#include <unordered_map>
62 std::optional<std::string> tableName = std::nullopt);
63 bool saveNote(
const std::string& uuid);
64 bool saveNoteAs(
const std::string& uuid,
const std::filesystem::path& absolutePath);
65 bool deleteNote(
const std::string& uuid,
bool deleteFromDisk);
68 std::shared_ptr<Note>
getNote(
const std::string& uuid);
69 std::shared_ptr<const Note>
getNote(
const std::string& uuid)
const;
71 std::vector<std::shared_ptr<Note>>
listAll();
73 std::vector<std::shared_ptr<Note>>
listInbox();
76 void setTitle(
const std::string& uuid, std::string title);
77 void setContent(
const std::string& uuid, std::string md);
78 void setAuthor(
const std::string& uuid, std::string author);
85 std::optional<std::string> fromPeerName);
88 std::optional<std::string> tableName = std::nullopt);
92 static std::string
slugify(
const std::string& title);
93 static int64_t
toEpochMillis(std::chrono::system_clock::time_point tp);
94 static std::chrono::system_clock::time_point
fromEpochMillis(int64_t ms);
102 std::shared_ptr<Note>
getByUuid(
const std::string& uuid)
const;
105 std::string
resolveRef(
const std::string& ref)
const;
108 void indexNote(
const std::shared_ptr<Note>& n);
121 static std::string
toLower_(
const std::string& s);
127 std::unordered_map<std::string, std::shared_ptr<Note>>
notesById_;
130 std::optional<std::string> tableName);
static bool parseMarkdownFile(const std::filesystem::path &path, Note &outNote)
bool saveInboxToLocal(const std::string &uuid, std::optional< std::string > tableName=std::nullopt)
static bool looksLikeShortHex_(const std::string &s)
static std::string toLower_(const std::string &s)
void toastGood(const std::string &msg) const
void setTitle(const std::string &uuid, std::string title)
std::string createNote(std::string title, std::string author, std::optional< std::string > tableName=std::nullopt)
static std::string slugify(const std::string &title)
std::vector< std::shared_ptr< Note > > listInbox()
std::unordered_map< std::string, std::string > titleToUuid_
NotesManager(NotesManagerConfig cfg, std::shared_ptr< ImGuiToaster > toaster)
std::string resolveRef(const std::string &ref) const
std::unordered_map< std::string, std::shared_ptr< Note > > notesByUuid_
std::shared_ptr< Note > getByUuid(const std::string &uuid) const
void removeFromIndex(const std::string &uuid)
void toastWarn(const std::string &msg) const
bool deleteNote(const std::string &uuid, bool deleteFromDisk)
void indexNote(const std::shared_ptr< Note > &n)
std::vector< std::shared_ptr< Note > > listMyNotes()
bool saveNote(const std::string &uuid)
void setContent(const std::string &uuid, std::string md)
bool saveNoteAs(const std::string &uuid, const std::filesystem::path &absolutePath)
void setAuthor(const std::string &uuid, std::string author)
void toastError(const std::string &msg) const
static std::string generateUUID()
std::string upsertSharedIncoming(std::string uuid, std::string title, std::string author, std::string markdown, std::optional< std::string > fromPeerName)
void scanFolderForMd_(const std::filesystem::path &dir, std::optional< std::string > tableName)
static bool looksLikeUuid_(const std::string &s)
std::vector< std::shared_ptr< Note > > listAll()
void toastInfo(const std::string &msg) const
static std::chrono::system_clock::time_point fromEpochMillis(int64_t ms)
std::shared_ptr< ImGuiToaster > toaster_
std::shared_ptr< Note > getNote(const std::string &uuid)
static int64_t toEpochMillis(std::chrono::system_clock::time_point tp)
void loadFromTable(const std::string &tableName)
std::unordered_map< std::string, std::shared_ptr< Note > > notesById_
std::filesystem::path defaultSavePath(const Note ¬e) const
static bool writeMarkdownFile(const std::filesystem::path &path, const Note ¬e)
std::optional< std::string > shared_from
std::optional< std::string > table_name
std::chrono::system_clock::time_point last_update_ts
std::chrono::system_clock::time_point creation_ts
std::string markdown_text
std::filesystem::path file_path
std::filesystem::path gameTablesRootDir
std::filesystem::path globalNotesDir