summaryrefslogtreecommitdiffstats
path: root/src/util/units.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-04-01 17:00:00 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-04-01 17:00:00 +0000
commit208ccdf9782984702f79b8ba416e67dd1e2c2dfa (patch)
tree79d15123aa526c49c6386db6245fbfc6b7a63eaf /src/util/units.cpp
parentupdate to trunk (diff)
parentpartial 2geom update: (diff)
downloadinkscape-208ccdf9782984702f79b8ba416e67dd1e2c2dfa.tar.gz
inkscape-208ccdf9782984702f79b8ba416e67dd1e2c2dfa.zip
update to trunk
(bzr r12588.1.32)
Diffstat (limited to 'src/util/units.cpp')
-rw-r--r--src/util/units.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 40cce028d..d2053f60b 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -505,16 +505,23 @@ double Quantity::convert(double from_dist, char const *from, char const *to)
return convert(from_dist, unit_table.getUnit(from), unit_table.getUnit(to));
}
-bool Quantity::operator<(Quantity const &other) const
+bool Quantity::operator<(Quantity const &rhs) const
{
- if (unit->type != other.unit->type) {
+ if (unit->type != rhs.unit->type) {
g_warning("Incompatible units");
return false;
}
- return quantity < other.value(unit);
+ return quantity < rhs.value(unit);
}
bool Quantity::operator==(Quantity const &other) const
{
+ /** \fixme This is overly strict. I think we should change this to:
+ if (unit->type != other.unit->type) {
+ g_warning("Incompatible units");
+ return false;
+ }
+ return are_near(quantity, other.value(unit));
+ */
return (*unit == *other.unit) && (quantity == other.quantity);
}