From b430026b7656173f78f62dfdab13fa705b2cc718 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 13 Mar 2025 06:44:04 +0100 Subject: TQ-23: Patch source code and leaving it for now. Signed-off-by: Amlal El Mahrouss --- dev/Usr/LibCF/Foundation.cc | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 dev/Usr/LibCF/Foundation.cc (limited to 'dev/Usr/LibCF/Foundation.cc') diff --git a/dev/Usr/LibCF/Foundation.cc b/dev/Usr/LibCF/Foundation.cc new file mode 100644 index 00000000..cb11287f --- /dev/null +++ b/dev/Usr/LibCF/Foundation.cc @@ -0,0 +1,48 @@ +/* ------------------------------------------- + + Copyright (C) 2024 Amlal El Mahrouss, all rights reserved + +------------------------------------------- */ + +#include + +LibCF::CFRect::operator bool() +{ + return width > 0 && height > 0; +} + +/***********************************************************************************/ +/// @brief returns true if size matches. +/***********************************************************************************/ +BOOL LibCF::CFRect::SizeMatches(LibCF::CFRect& rect) noexcept +{ + return rect.height == height && rect.width == width; +} + +/***********************************************************************************/ +/// @brief returns true if position matches. +/***********************************************************************************/ +BOOL LibCF::CFRect::PositionMatches(LibCF::CFRect& rect) noexcept +{ + return rect.y == y && rect.x == x; +} + +/***********************************************************************************/ +/// @brief Check if point is within the current MLPoint. +/// @param point the current point to check. +/// @retval true if point is within this point. +/// @retval the validations have failed, false otherwise true. +/***********************************************************************************/ +BOOL LibCF::CFPoint::IsWithin(LibCF::CFPoint& withinOf) +{ + return x_1 >= withinOf.x_1 && x_2 <= (withinOf.x_2) && + y_1 >= withinOf.y_1 && y_2 <= (withinOf.y_2); +} + +/***********************************************************************************/ +/// @brief if Point object is correctly set up. +/***********************************************************************************/ +LibCF::CFPoint::operator bool() +{ + return x_1 > x_2 && y_1 > y_2; +} \ No newline at end of file -- cgit v1.2.3