summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2022-06-29 00:06:03 +1000
committerTomaž Vajngerl <quikee@gmail.com>2022-07-11 11:06:53 +0200
commit934985becc567114c3f38a72322056a628aad7c9 (patch)
tree54530473a4d3a0a5876aff68b3727d51fa4dc88d /include
parenta19e01812b60580c656cf31619e212803e2ca0fa (diff)
tools: rename getHeight/Width() to GetOpenHeight/Width()
By default Rectangle uses closed interval, if we really want to use half open intervals then we should specifically say as such in the name. Change-Id: Id7a91120ba1a1a4bc330014216b73a692dbf03a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136575 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/tools/gen.hxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index ab8b443ca403..5ed473c62857 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -478,13 +478,12 @@ inline std::basic_ostream<charT, traits> & operator <<(
///
/// If you have the misfortune of having to use this class, don't immediately
/// despair but first take note that the uppercase GetWidth() / GetHeight()
-/// etc. methods interpret the interval as closed, while the lowercase
-/// getWidth() / getHeight() etc. methods interpret the interval as half-open.
-/// Ok, now is the time for despair.
+/// etc. methods interpret the interval as closed. To use the half open versions,
+/// use GetOpenWidth() / GetOpenHeight().
///
/// If you want to work with Size, you must use the closed interval functions!
-/// And don't add getSize / setSize; this will probably just introduce bugs,
-/// especially when used in combination with list-initialization.
+/// And don't add GetOpenSize() / setSize; this will probably just introduce
+/// bugs, especially when used in combination with list-initialization.
///
/// (Eventually you might notice, that the same engineer was also working on
/// Qt at some point; see documentation on QRect::bottom / QRect::right ;-).
@@ -579,9 +578,9 @@ public:
tools::Long getX() const { return nLeft; }
tools::Long getY() const { return nTop; }
/// Returns the difference between right and left, assuming the range includes one end, but not the other.
- tools::Long getWidth() const { return Right() - Left(); }
+ tools::Long getOpenWidth() const { return Right() - Left(); }
/// Returns the difference between bottom and top, assuming the range includes one end, but not the other.
- tools::Long getHeight() const { return Bottom() - Top(); }
+ tools::Long getOpenHeight() const { return Bottom() - Top(); }
void setWidth( tools::Long n ) { nRight = nLeft + n; }
void setHeight( tools::Long n ) { nBottom = nTop + n; }
/// Returns the string representation of the rectangle, format is "x, y, width, height".