ToDoEntries.cpp 863 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2021, Federico Guerinoni <guerinoni.federico@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "ToDoEntries.h"
  7. namespace HackStudio {
  8. ToDoEntries& HackStudio::ToDoEntries::the()
  9. {
  10. static ToDoEntries s_instance;
  11. return s_instance;
  12. }
  13. void ToDoEntries::set_entries(String const& filename, Vector<CodeComprehension::TodoEntry> const&& entries)
  14. {
  15. m_document_to_entries.set(filename, move(entries));
  16. if (on_update)
  17. on_update();
  18. }
  19. Vector<CodeComprehension::TodoEntry> ToDoEntries::get_entries()
  20. {
  21. Vector<CodeComprehension::TodoEntry> ret;
  22. for (auto& it : m_document_to_entries) {
  23. for (auto& entry : it.value)
  24. ret.append({ entry.content, it.key, entry.line, entry.column });
  25. }
  26. return ret;
  27. }
  28. void ToDoEntries::clear_entries()
  29. {
  30. m_document_to_entries.clear();
  31. }
  32. }