TextIdentifier.h 837 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * TextIdentifier.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. VCMI_LIB_NAMESPACE_BEGIN
  12. class TextIdentifier
  13. {
  14. std::string identifier;
  15. public:
  16. const std::string & get() const
  17. {
  18. return identifier;
  19. }
  20. TextIdentifier(const char * id):
  21. identifier(id)
  22. {}
  23. TextIdentifier(const std::string & id):
  24. identifier(id)
  25. {}
  26. template<typename... T>
  27. TextIdentifier(const std::string & id, size_t index, T... rest):
  28. TextIdentifier(id + '.' + std::to_string(index), rest...)
  29. {}
  30. template<typename... T>
  31. TextIdentifier(const std::string & id, const std::string & id2, T... rest):
  32. TextIdentifier(id + '.' + id2, rest...)
  33. {}
  34. };
  35. VCMI_LIB_NAMESPACE_END