CPropertyBoolean.cpp 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <sstream>
  2. #include "CPropertyBoolean.h"
  3. #include "WallpaperEngine/Core/Core.h"
  4. using namespace WallpaperEngine::Core::Projects;
  5. CPropertyBoolean* CPropertyBoolean::fromJSON (json data, const std::string& name)
  6. {
  7. json::const_iterator value = data.find ("value");
  8. std::string text = jsonFindDefault <std::string> (data, "text", "");
  9. return new CPropertyBoolean (
  10. *value,
  11. name,
  12. text
  13. );
  14. }
  15. bool CPropertyBoolean::getValue ()
  16. {
  17. return this->m_value;
  18. }
  19. std::string CPropertyBoolean::dump () const
  20. {
  21. std::stringstream ss;
  22. ss
  23. << this->m_name << " - boolean" << std::endl
  24. << "\t" << "Description: " << this->m_text << std::endl
  25. << "\t" << "Value: " << this->m_value;
  26. return ss.str();
  27. }
  28. CPropertyBoolean::CPropertyBoolean (bool value, const std::string& name, const std::string& text) :
  29. CProperty (name, Type, text),
  30. m_value (value)
  31. {
  32. }
  33. const std::string CPropertyBoolean::Type = "bool";