diff options
| author | nyamatongwe <devnull@localhost> | 2013-05-24 00:04:54 +1000 |
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2013-05-24 00:04:54 +1000 |
| commit | 44da106995e3b3ca4068f584c16f59d8fced4e69 (patch) | |
| tree | 72512a72ac08ef47a2f40d9b30b0f208a245fda0 /include/Platform.h | |
| parent | 2345e207b44f01e09d8dba69a37b9a67eeefa884 (diff) | |
| download | scintilla-mirror-44da106995e3b3ca4068f584c16f59d8fced4e69.tar.gz | |
Made methods const where they can be and are logically const as well.
Diffstat (limited to 'include/Platform.h')
| -rw-r--r-- | include/Platform.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/Platform.h b/include/Platform.h index 7b8d86d7d..30c4e0337 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -119,19 +119,19 @@ public: // Other automatically defined methods (assignment, copy constructor, destructor) are fine - bool operator==(PRectangle &rc) { + bool operator==(PRectangle &rc) const { return (rc.left == left) && (rc.right == right) && (rc.top == top) && (rc.bottom == bottom); } - bool Contains(Point pt) { + bool Contains(Point pt) const { return (pt.x >= left) && (pt.x <= right) && (pt.y >= top) && (pt.y <= bottom); } - bool Contains(PRectangle rc) { + bool Contains(PRectangle rc) const { return (rc.left >= left) && (rc.right <= right) && (rc.top >= top) && (rc.bottom <= bottom); } - bool Intersects(PRectangle other) { + bool Intersects(PRectangle other) const { return (right > other.left) && (left < other.right) && (bottom > other.top) && (top < other.bottom); } @@ -141,9 +141,9 @@ public: right += xDelta; bottom += yDelta; } - XYPOSITION Width() { return right - left; } - XYPOSITION Height() { return bottom - top; } - bool Empty() { + XYPOSITION Width() const { return right - left; } + XYPOSITION Height() const { return bottom - top; } + bool Empty() const { return (Height() <= 0) || (Width() <= 0); } }; @@ -199,15 +199,15 @@ public: return co; } - unsigned int GetRed() { + unsigned int GetRed() const { return co & 0xff; } - unsigned int GetGreen() { + unsigned int GetGreen() const { return (co >> 8) & 0xff; } - unsigned int GetBlue() { + unsigned int GetBlue() const { return (co >> 16) & 0xff; } }; |
