-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomText.hpp
41 lines (35 loc) · 1018 Bytes
/
CustomText.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "Script.hpp"
namespace Big
{
class CustomText
{
public:
explicit CustomText() = default;
~CustomText() noexcept = default;
CustomText(CustomText const&) = delete;
CustomText(CustomText&&) = delete;
CustomText& operator=(CustomText const&) = delete;
CustomText& operator=(CustomText&&) = delete;
/**
* \brief Registers custom text
* \param hash The hash of the label to register
* \param text The content of the custom text
*/
void AddText(std::uint32_t hash, const char* text);
/**
* \brief Unregisters custom text
* \param hash The hash of the label to unregister
*/
void RemoveText(std::uint32_t hash);
/**
* \brief Retrieves custom text
* \param hash The hash of the label
* \return A pointer to the string if it's registered, nullptr otherwise
*/
const char* GetText(std::uint32_t hash);
private:
std::unordered_map<std::uint32_t, std::unique_ptr<char[]>> m_TextMap;
};
inline std::unique_ptr<CustomText> g_CustomText;
}