19 #include <QJsonDocument>
20 #include <QJsonObject>
24 const std::string text_limitless =
"limitless";
25 const std::string text_positive =
"positive";
26 const std::string text_nonnegative =
"nonnegative";
27 const std::string text_lowerlimited =
"lowerlimited";
28 const std::string text_upperlimited =
"upperlimited";
29 const std::string text_limited =
"limited";
30 const std::string separator =
" ";
37 QJsonObject json_source = converter->to_json(model);
38 QJsonDocument document(json_source);
39 return QString(document.toJson(QJsonDocument::Indented)).toStdString();
45 return text_limitless;
49 return text_nonnegative;
51 return text_lowerlimited;
53 return text_upperlimited;
57 throw std::runtime_error(
"JsonUtils::ToString() -> Unknown type");
62 if (text == text_limitless)
64 else if (text == text_positive)
66 else if (text == text_nonnegative)
68 else if (text == text_lowerlimited)
70 else if (text == text_upperlimited)
72 else if (text == text_limited)
75 throw std::runtime_error(
"JsonUtils::CreateLimits -> Unknown type");
static RealLimits upperLimited(double bound_value)
Creates an object bounded from the right.
bool isLowerLimited() const
static RealLimits lowerLimited(double bound_value)
Creates an object bounded from the left.
static RealLimits positive()
Creates an object which can have only positive values (>0., zero is not included)
bool isNonnegative() const
static RealLimits nonnegative()
Creates an object which can have only positive values with 0. included.
bool isUpperLimited() const
static RealLimits limited(double left_bound_value, double right_bound_value)
Creates an object bounded from the left and right.
Main class to hold hierarchy of SessionItem objects.
MVVM_MODEL_EXPORT RealLimits CreateLimits(const std::string &text, double min=0.0, double max=0.0)
MVVM_MODEL_EXPORT std::string ToString(const RealLimits &limits)
Returns string representation of RealLimits.
MVVM_MODEL_EXPORT std::string ModelToJsonString(const SessionModel &model)
Returns multiline string representing model content as json.
materialitems.h Collection of materials to populate MaterialModel.
MVVM_MODEL_EXPORT std::unique_ptr< JsonModelConverterInterface > CreateModelCopyConverter()
Creates a JSON model converter intended for model copying.