BsStringTableManager.h 1.2 KB

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