CBind.cpp 727 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "CBind.h"
  2. #include <utility>
  3. using namespace WallpaperEngine::Core::Objects::Effects;
  4. CBind::CBind (std::string name, irr::u32 index) :
  5. m_name (std::move(name)),
  6. m_index (index)
  7. {
  8. }
  9. CBind* CBind::fromJSON (json data)
  10. {
  11. auto name_it = data.find ("name");
  12. auto index_it = data.find ("index");
  13. if (name_it == data.end ())
  14. {
  15. throw std::runtime_error ("bind must have texture name");
  16. }
  17. if (index_it == data.end ())
  18. {
  19. throw std::runtime_error ("bind must have index");
  20. }
  21. return new CBind (*name_it, *index_it);
  22. }
  23. const std::string& CBind::getName () const
  24. {
  25. return this->m_name;
  26. }
  27. const irr::u32& CBind::getIndex () const
  28. {
  29. return this->m_index;
  30. }