On 28-8-2013 18:57, mathog wrote:
On 27-Aug-2013 18:56, Matthew Petroff wrote:
On Tue, Aug 27, 2013 at 7:06 PM, mathog <mathog@...1176... [1]>
Wouldn't all the way to an object oriented programming style be:
p0 = p0.in2px();
It seems like halfway between C and C++ because it is. That syntax is used in older parts of the code that dont use the new Quantity class objects that store values with their units. Where Quantities are used [1], the syntax is:
quantity.value("in")
if one wanted the value in inches, no matter what unit the quantity was in. This syntax doesnt work with older sections of code without extensive rewrites, as the older sections store everything as regular floating point numbers, not objects.
Sure, but could one not put something like this (exact syntax is probably off, I did not try to compile it, and the conversion might be backwards) into src/2geom/Point.h
Point in2px const { return Point(Inkscape::convert_unit(_pt[X],"px", "in"),Inkscape::convert_unit(_pt[Y],"px", "in")); }
to implement:
p0 = p0.in2px();
What I'm getting at is that when I am maintaining code the last thing I want to see is low level plumbing, like convert_unit, the exact function being used to convert units. The desired level of abstraction was present before 12471, with PX_PER_IN and friends.
Troll??? When doing a unit conversion, you don't want to write the function that does the unit conversion? But it *is* ok to write "in2px()" ?
-Johan