BsStringTableManager.h 1.1 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.
  9. */
  10. class BS_CORE_EXPORT StringTableManager : public Module<StringTableManager>
  11. {
  12. public:
  13. StringTableManager();
  14. /**
  15. * @brief Gets the currently active language.
  16. */
  17. Language getActiveLanguage() const { return mActiveLanguage; }
  18. /**
  19. * @brief Changes the currently active language.
  20. * Any newly created strings will use this value.
  21. */
  22. void setActiveLanguage(Language language);
  23. /**
  24. * @brief Returns the string table with the specified id.
  25. * If the table doesn't exist new one is created.
  26. */
  27. HStringTable getTable(UINT32 id);
  28. /**
  29. * @brief Removes the string table with the specified id.
  30. */
  31. void removeTable(UINT32 id);
  32. /**
  33. * @brief Registers a new, or replaces an old string table at
  34. * the specified id.
  35. */
  36. void setTable(UINT32 id, HStringTable table);
  37. private:
  38. Language mActiveLanguage;
  39. UnorderedMap<UINT32, HStringTable> mTables;
  40. };
  41. }