/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* text_library.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/10 11:52:30 by maldavid #+# #+# */ /* Updated: 2024/03/25 19:08:03 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> _cache; TextID _current_id = 1; }; } #endif