mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-14 07:02:54 +00:00
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2021, Itamar S. <itamar8910@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Function.h>
|
|
#include <AK/HashMap.h>
|
|
#include <AK/Noncopyable.h>
|
|
#include <AK/String.h>
|
|
#include <LibGUI/AutocompleteProvider.h>
|
|
#include <LibGUI/Icon.h>
|
|
|
|
namespace HackStudio {
|
|
|
|
class ProjectDeclarations {
|
|
AK_MAKE_NONCOPYABLE(ProjectDeclarations);
|
|
|
|
public:
|
|
static ProjectDeclarations& the();
|
|
template<typename Func>
|
|
void for_each_declared_symbol(Func);
|
|
|
|
void set_declared_symbols(const String& filename, const Vector<GUI::AutocompleteProvider::Declaration>&);
|
|
|
|
static Optional<GUI::Icon> get_icon_for(GUI::AutocompleteProvider::DeclarationType);
|
|
|
|
Function<void()> on_update = nullptr;
|
|
|
|
private:
|
|
ProjectDeclarations() = default;
|
|
HashMap<String, Vector<GUI::AutocompleteProvider::Declaration>> m_document_to_declarations;
|
|
};
|
|
|
|
template<typename Func>
|
|
void ProjectDeclarations::for_each_declared_symbol(Func f)
|
|
{
|
|
for (auto& item : m_document_to_declarations) {
|
|
for (auto& decl : item.value) {
|
|
f(decl);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|