188 lines
4.2 KiB
C++
188 lines
4.2 KiB
C++
/**
|
|
* Jungfraujoch
|
|
* Jungfraujoch Broker Web API
|
|
*
|
|
* The version of the OpenAPI document: 1.0.1
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
#include "Preview_settings.h"
|
|
#include "Helpers.h"
|
|
|
|
#include <sstream>
|
|
|
|
namespace org::openapitools::server::model
|
|
{
|
|
|
|
Preview_settings::Preview_settings()
|
|
{
|
|
m_Saturation = 0L;
|
|
m_Show_spots = true;
|
|
m_Show_spotsIsSet = false;
|
|
m_Jpeg_quality = 0L;
|
|
m_Jpeg_qualityIsSet = false;
|
|
|
|
}
|
|
|
|
void Preview_settings::validate() const
|
|
{
|
|
std::stringstream msg;
|
|
if (!validate(msg))
|
|
{
|
|
throw org::openapitools::server::helpers::ValidationException(msg.str());
|
|
}
|
|
}
|
|
|
|
bool Preview_settings::validate(std::stringstream& msg) const
|
|
{
|
|
return validate(msg, "");
|
|
}
|
|
|
|
bool Preview_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
|
|
{
|
|
bool success = true;
|
|
const std::string _pathPrefix = pathPrefix.empty() ? "Preview_settings" : pathPrefix;
|
|
|
|
|
|
|
|
/* Saturation */ {
|
|
const int64_t& value = m_Saturation;
|
|
const std::string currentValuePath = _pathPrefix + ".saturation";
|
|
|
|
|
|
if (value < 0ll)
|
|
{
|
|
success = false;
|
|
msg << currentValuePath << ": must be greater than or equal to 0;";
|
|
}
|
|
if (value > 65535ll)
|
|
{
|
|
success = false;
|
|
msg << currentValuePath << ": must be less than or equal to 65535;";
|
|
}
|
|
|
|
}
|
|
|
|
if (jpegQualityIsSet())
|
|
{
|
|
const int64_t& value = m_Jpeg_quality;
|
|
const std::string currentValuePath = _pathPrefix + ".jpegQuality";
|
|
|
|
|
|
if (value < 0ll)
|
|
{
|
|
success = false;
|
|
msg << currentValuePath << ": must be greater than or equal to 0;";
|
|
}
|
|
if (value > 100ll)
|
|
{
|
|
success = false;
|
|
msg << currentValuePath << ": must be less than or equal to 100;";
|
|
}
|
|
|
|
}
|
|
|
|
return success;
|
|
}
|
|
|
|
bool Preview_settings::operator==(const Preview_settings& rhs) const
|
|
{
|
|
return
|
|
|
|
|
|
(getSaturation() == rhs.getSaturation())
|
|
&&
|
|
|
|
|
|
((!showSpotsIsSet() && !rhs.showSpotsIsSet()) || (showSpotsIsSet() && rhs.showSpotsIsSet() && isShowSpots() == rhs.isShowSpots())) &&
|
|
|
|
|
|
((!jpegQualityIsSet() && !rhs.jpegQualityIsSet()) || (jpegQualityIsSet() && rhs.jpegQualityIsSet() && getJpegQuality() == rhs.getJpegQuality()))
|
|
|
|
;
|
|
}
|
|
|
|
bool Preview_settings::operator!=(const Preview_settings& rhs) const
|
|
{
|
|
return !(*this == rhs);
|
|
}
|
|
|
|
void to_json(nlohmann::json& j, const Preview_settings& o)
|
|
{
|
|
j = nlohmann::json();
|
|
j["saturation"] = o.m_Saturation;
|
|
if(o.showSpotsIsSet())
|
|
j["show_spots"] = o.m_Show_spots;
|
|
if(o.jpegQualityIsSet())
|
|
j["jpeg_quality"] = o.m_Jpeg_quality;
|
|
|
|
}
|
|
|
|
void from_json(const nlohmann::json& j, Preview_settings& o)
|
|
{
|
|
j.at("saturation").get_to(o.m_Saturation);
|
|
if(j.find("show_spots") != j.end())
|
|
{
|
|
j.at("show_spots").get_to(o.m_Show_spots);
|
|
o.m_Show_spotsIsSet = true;
|
|
}
|
|
if(j.find("jpeg_quality") != j.end())
|
|
{
|
|
j.at("jpeg_quality").get_to(o.m_Jpeg_quality);
|
|
o.m_Jpeg_qualityIsSet = true;
|
|
}
|
|
|
|
}
|
|
|
|
int64_t Preview_settings::getSaturation() const
|
|
{
|
|
return m_Saturation;
|
|
}
|
|
void Preview_settings::setSaturation(int64_t const value)
|
|
{
|
|
m_Saturation = value;
|
|
}
|
|
bool Preview_settings::isShowSpots() const
|
|
{
|
|
return m_Show_spots;
|
|
}
|
|
void Preview_settings::setShowSpots(bool const value)
|
|
{
|
|
m_Show_spots = value;
|
|
m_Show_spotsIsSet = true;
|
|
}
|
|
bool Preview_settings::showSpotsIsSet() const
|
|
{
|
|
return m_Show_spotsIsSet;
|
|
}
|
|
void Preview_settings::unsetShow_spots()
|
|
{
|
|
m_Show_spotsIsSet = false;
|
|
}
|
|
int64_t Preview_settings::getJpegQuality() const
|
|
{
|
|
return m_Jpeg_quality;
|
|
}
|
|
void Preview_settings::setJpegQuality(int64_t const value)
|
|
{
|
|
m_Jpeg_quality = value;
|
|
m_Jpeg_qualityIsSet = true;
|
|
}
|
|
bool Preview_settings::jpegQualityIsSet() const
|
|
{
|
|
return m_Jpeg_qualityIsSet;
|
|
}
|
|
void Preview_settings::unsetJpeg_quality()
|
|
{
|
|
m_Jpeg_qualityIsSet = false;
|
|
}
|
|
|
|
|
|
} // namespace org::openapitools::server::model
|
|
|