BsStringTableManager.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsModule.h"
  4. #include "BsStringTable.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Manages string tables used for localizing text. Allows you to add
  9. * and remove different tables and change the active language.
  10. */
  11. class BS_CORE_EXPORT StringTableManager : public Module<StringTableManager>
  12. {
  13. public:
  14. StringTableManager();
  15. /**
  16. * @brief Gets the currently active language.
  17. */
  18. Language getActiveLanguage() const { return mActiveLanguage; }
  19. /**
  20. * @brief Changes the currently active language.
  21. * Any newly created strings will use this value.
  22. */
  23. void setActiveLanguage(Language language);
  24. /**
  25. * @brief Returns the string table with the specified id.
  26. * If the table doesn't exist new one is created.
  27. */
  28. HStringTable getTable(UINT32 id);
  29. /**
  30. * @brief Removes the string table with the specified id.
  31. */
  32. void removeTable(UINT32 id);
  33. /**
  34. * @brief Registers a new string table or replaces an old one at the specified id.
  35. */
  36. void setTable(UINT32 id, HStringTable table);
  37. private:
  38. Language mActiveLanguage;
  39. UnorderedMap<UINT32, HStringTable> mTables;
  40. };
  41. }