summaryrefslogtreecommitdiffstats
path: root/sigmod/Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmod/Object.cpp')
-rw-r--r--sigmod/Object.cpp40
1 files changed, 14 insertions, 26 deletions
diff --git a/sigmod/Object.cpp b/sigmod/Object.cpp
index 99e42f16..35e68b8d 100644
--- a/sigmod/Object.cpp
+++ b/sigmod/Object.cpp
@@ -44,15 +44,11 @@ const Sigmod::Sigmod* Sigmod::Object::sigmod() const
return qobject_cast<const Sigmod*>(this);
}
-int Sigmod::Object::id() const
-{
- return m_id;
-}
+GETTER(Object, int, id)
-void Sigmod::Object::setId(const int id)
-{
- CHECK(id);
-}
+SETTER(Object, int, Id, id)
+
+CHECK_BOUNDS(Object, int, id, 0, INT_MAX)
QDomDocument Sigmod::Object::xml(const Object* object)
{
@@ -73,40 +69,32 @@ QString Sigmod::Object::unused(const QString& variable)
QString Sigmod::Object::bounds(const QString& variable, const int min, const int max, const int value)
{
- QString msg = QString("Value for %1 out-of-bounds (%2 -- %3) (%4)");
- msg.arg(variable);
+ QString msg = QString("Value for %1 out-of-bounds (%2 -- %3) (%4)").arg(variable);
if (min == INT_MIN)
- msg.arg(QString::fromUtf8("-∞"));
+ msg = msg.arg(QString::fromUtf8("-∞"));
else
- msg.arg(min);
+ msg = msg.arg(min);
if (max == INT_MAX)
- msg.arg(QString::fromUtf8("∞"));
+ msg = msg.arg(QString::fromUtf8("∞"));
else
- msg.arg(max);
+ msg = msg.arg(max);
return msg.arg(value);
}
QString Sigmod::Object::bounds(const QString& variable, const int min, const int max, const Sigcore::Fraction& value)
{
- QString msg("Value for %1 out-of-bounds (%2 -- %3) (%4 / %5)");
- msg.arg(variable);
+ QString msg = QString("Value for %1 out-of-bounds (%2 -- %3) (%4 / %5)").arg(variable);
if (min == INT_MIN)
- msg.arg(QString::fromUtf8("-∞"));
+ msg = msg.arg(QString::fromUtf8("-∞"));
else
- msg.arg(min);
+ msg = msg.arg(min);
if (max == INT_MAX)
- msg.arg(QString::fromUtf8("∞"));
+ msg = msg.arg(QString::fromUtf8("∞"));
else
- msg.arg(max);
+ msg = msg.arg(max);
return msg.arg(value.numerator()).arg(value.denominator());
}
-QString Sigmod::Object::bounds(const QString& variable, const QPoint& min, const QPoint& max, const QPoint& value)
-{
- QString msg("Value for %1 out-of-bounds ((%2, %3) -- (%4, %5)) (%6 / %7)");
- return msg.arg(variable).arg(min.x()).arg(min.y()).arg(max.x()).arg(max.y()).arg(value.x()).arg(value.y());
-}
-
QString Sigmod::Object::bounds(const QString& variable, const QString& min, const QString& max, const int value)
{
return QString("Value for %1 out-of-bounds (%2 -- %3) (%4)").arg(variable).arg(min).arg(max).arg(value);