ladybird/Userland/DevTools/HackStudio/ToDoEntries.cpp
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

40 lines
873 B
C++

/*
* 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(DeprecatedString const& filename, Vector<CodeComprehension::TodoEntry> const&& entries)
{
m_document_to_entries.set(filename, move(entries));
if (on_update)
on_update();
}
Vector<CodeComprehension::TodoEntry> ToDoEntries::get_entries()
{
Vector<CodeComprehension::TodoEntry> ret;
for (auto& it : m_document_to_entries) {
for (auto& entry : it.value)
ret.append({ entry.content, it.key, entry.line, entry.column });
}
return ret;
}
void ToDoEntries::clear_entries()
{
m_document_to_entries.clear();
}
}