/* * Copyright (c) 2021, Itamar S. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace HackStudio { class ProjectDeclarations { AK_MAKE_NONCOPYABLE(ProjectDeclarations); public: static ProjectDeclarations& the(); template void for_each_declared_symbol(Func); void set_declared_symbols(String const& filename, Vector const&); static Optional get_icon_for(CodeComprehension::DeclarationType); Function on_update = nullptr; private: ProjectDeclarations() = default; HashMap> m_document_to_declarations; }; template void ProjectDeclarations::for_each_declared_symbol(Func f) { for (auto& item : m_document_to_declarations) { for (auto& decl : item.value) { f(decl); } } } }