mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
#include <sstream>
|
|
#include <utility>
|
|
|
|
#include "CPropertyBoolean.h"
|
|
|
|
using namespace WallpaperEngine::Core::Projects;
|
|
|
|
std::shared_ptr<CPropertyBoolean> CPropertyBoolean::fromJSON (const JSON& data, std::string name) {
|
|
return std::make_shared <CPropertyBoolean> (
|
|
data.require ("value", "Boolean property must have a value"),
|
|
std::move(name),
|
|
data.optional <std::string> ("text", "")
|
|
);
|
|
}
|
|
|
|
|
|
void CPropertyBoolean::set (const std::string& value) {
|
|
this->update (value == "1" || value == "true" || value == "on");
|
|
}
|
|
|
|
std::string CPropertyBoolean::dump () const {
|
|
std::stringstream ss;
|
|
|
|
ss << this->m_name << " - boolean" << std::endl
|
|
<< "\t"
|
|
<< "Description: " << this->m_text << std::endl
|
|
<< "\t"
|
|
<< "Value: " << &this->getBool ();
|
|
|
|
return ss.str ();
|
|
}
|
|
|
|
const char* CPropertyBoolean::getPropertyType () const {
|
|
return "bool";
|
|
}
|
|
|
|
CPropertyBoolean::CPropertyBoolean (bool value, std::string name, std::string text) :
|
|
CProperty (std::move(name), std::move(text)) {}
|