/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* TextLibrary.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/10 11:52:30 by maldavid #+# #+# */ /* Updated: 2024/03/28 22:26:10 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_TEXT_LIBRARY__ #define __MLX_TEXT_LIBRARY__ #include #include #include #include #include namespace mlx { using TextID = std::uint32_t; constexpr TextID nulltext = 0; class TextLibrary : public Singleton { friend class Singleton; public: std::shared_ptr GetTextData(TextID id); TextID AddTextToLibrary(std::shared_ptr text); void RemoveTextFromLibrary(TextID id); void ClearLibrary(); private: TextLibrary() = default; ~TextLibrary() = default; private: std::unordered_map> m_cache; TextID m_current_id = 1; }; } #endif