mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-28 11:02:36 +00:00 
			
		
		
		
	 6e19ab2bbc
			
		
	
	
		6e19ab2bbc
		
	
	
	
	
		
			
			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 :^)
		
			
				
	
	
		
			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/DeprecatedString.h>
 | |
| #include <AK/Function.h>
 | |
| #include <AK/HashMap.h>
 | |
| #include <AK/Noncopyable.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(DeprecatedString const& filename, Vector<CodeComprehension::Declaration> const&);
 | |
| 
 | |
|     static Optional<GUI::Icon> get_icon_for(CodeComprehension::DeclarationType);
 | |
| 
 | |
|     Function<void()> on_update = nullptr;
 | |
| 
 | |
| private:
 | |
|     ProjectDeclarations() = default;
 | |
|     HashMap<DeprecatedString, Vector<CodeComprehension::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);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| }
 |