diff options
Diffstat (limited to 'Userland/DevTools/HackStudio/ToDoEntries.cpp')
-rw-r--r-- | Userland/DevTools/HackStudio/ToDoEntries.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/ToDoEntries.cpp b/Userland/DevTools/HackStudio/ToDoEntries.cpp new file mode 100644 index 0000000000..00c27cd8d2 --- /dev/null +++ b/Userland/DevTools/HackStudio/ToDoEntries.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021, Federico Guerinoni <guerinoni.federico@gmail.com> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include "ToDoEntries.h" + +namespace HackStudio { + +ToDoEntries& HackStudio::ToDoEntries::the() +{ + static ToDoEntries s_instance; + return s_instance; +} + +void ToDoEntries::set_entries(const String& filename, const Vector<String>&& entries) +{ + m_document_to_entries.set(filename, move(entries)); + if (on_update) + on_update(); +} + +Vector<ToDoEntryPair> ToDoEntries::get_entries() +{ + Vector<ToDoEntryPair> ret; + for (auto& it : m_document_to_entries) + for (auto& entry : it.value) + ret.append({ it.key, entry }); + + return ret; +} + +} |