improving empty handling in tools::Rectangle
Luboš Luňák
l.lunak at collabora.com
Tue May 7 11:06:18 UTC 2019
On Tuesday 07 of May 2019, Noel Grandin wrote:
> On 2019/05/07 11:40 AM, Stephan Bergmann wrote:
> > On 07/05/2019 11:30, Noel Grandin wrote:
> >> (1) split the empty flags into their own bool values.
> >
> > Is there a reason that information about emptyness needs to be encoded
> > more explicitly than just via getWidth()==0 and getHeigth()==0?
>
> Yes, depending on which method you call (getWidth() vs GetWidth()), on
> tools::Rectangle, it can be regarded as a either a half-open or a closed
> range.
>
> Yes, this is truly truly awful, which is why I'm just trying to clean up
> one small part of it's awfulness.
If you're going to already handle the problems, why not handle the awfulness
by fixing it, instead of patching it up? The class is broken, and it'll be
broken even after you tweak one consequence of the base problem. If the base
problem gets fixed, the consequence goes away too.
The class can't be both, internally it stores just one value, and there are
functions such as the Size ctor or operator<< that do take a side (although
in line with the general stupidity, different functions take a different
side). And while the class gets used extensively, the usage can be fixed
mechanically.
--
Luboš Luňák
l.lunak at collabora.com
More information about the LibreOffice
mailing list