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/Atom.h | 2 +- dev/Usr/LibCF/Core.cc | 48 ---------------------------- dev/Usr/LibCF/Core.h | 74 ------------------------------------------ dev/Usr/LibCF/Foundation.cc | 48 ++++++++++++++++++++++++++++ dev/Usr/LibCF/Foundation.h | 78 +++++++++++++++++++++++++++++++++++++++++++++ dev/Usr/LibCF/Object.h | 2 +- dev/Usr/LibCF/Property.h | 2 +- dev/Usr/LibCF/Ref.h | 6 +++- dev/Usr/LibCF/String.h | 5 +++ dev/Usr/LibFont/Font.h | 2 +- 10 files changed, 140 insertions(+), 127 deletions(-) delete mode 100644 dev/Usr/LibCF/Core.cc delete mode 100644 dev/Usr/LibCF/Core.h create mode 100644 dev/Usr/LibCF/Foundation.cc create mode 100644 dev/Usr/LibCF/Foundation.h (limited to 'dev/Usr') diff --git a/dev/Usr/LibCF/Atom.h b/dev/Usr/LibCF/Atom.h index dbb90c40..26b4f0cd 100644 --- a/dev/Usr/LibCF/Atom.h +++ b/dev/Usr/LibCF/Atom.h @@ -5,7 +5,7 @@ ------------------------------------------- */ #pragma once -#include +#include namespace LibCF { diff --git a/dev/Usr/LibCF/Core.cc b/dev/Usr/LibCF/Core.cc deleted file mode 100644 index 28306c56..00000000 --- a/dev/Usr/LibCF/Core.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* ------------------------------------------- - - 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 diff --git a/dev/Usr/LibCF/Core.h b/dev/Usr/LibCF/Core.h deleted file mode 100644 index acebe996..00000000 --- a/dev/Usr/LibCF/Core.h +++ /dev/null @@ -1,74 +0,0 @@ - -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. - -------------------------------------------- */ - -#pragma once - -#include - -namespace LibCF -{ - class CFString; - class CFGUID; - class CFProperty; - class CFObject; - class CFRef; - class CFFont; - struct CFPoint; - struct CFRect; - struct CFColor; - -#ifndef __LP64__ - typedef SInt32 CFInteger; - typedef float CFReal; -#else - typedef SInt64 CFInteger; - typedef double CFReal; -#endif - - typedef SInt32 CFInteger32; - typedef SInt64 CFInteger64; - - typedef char CFChar8; - typedef char16_t CFChar16; - - struct CFPoint - { - CFInteger64 x_1{0UL}; - CFInteger64 y_1{0UL}; - - CFInteger64 x_2{0UL}; - CFInteger64 y_2{0UL}; - CFReal ang{0UL}; - - operator bool(); - - /// @brief Check if point is within the current CFPoint. - /// @param point the current point to check. - /// @retval true if point is within this point. - /// @retval validations failed. - bool isWithin(CFPoint& point); - }; - - struct CFColor final - { - CFInteger64 r, g, b, a{0}; - }; - - struct CFRect final - { - CFInteger64 x{0UL}; - CFInteger64 y{0UL}; - - CFInteger64 width{0UL}; - CFInteger64 height{0UL}; - - operator bool(); - - BOOL sizeMatches(CFRect& rect) noexcept; - BOOL positionMatches(CFRect& rect) noexcept; - }; -} // namespace LibCF \ No newline at end of file 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 diff --git a/dev/Usr/LibCF/Foundation.h b/dev/Usr/LibCF/Foundation.h new file mode 100644 index 00000000..c0f8fe6c --- /dev/null +++ b/dev/Usr/LibCF/Foundation.h @@ -0,0 +1,78 @@ + +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + + FILE: Foundation.h + PURPOSE: Foundation header of the CF framework. + +------------------------------------------- */ + +#pragma once + +#include + +namespace LibCF +{ + class CFString; + class CFGUID; + class CFProperty; + class CFObject; + template + class CFRef; + class CFFont; + struct CFPoint; + struct CFRect; + struct CFColor; + +#ifndef __LP64__ + typedef SInt32 CFInteger; + typedef float CFReal; +#else + typedef SInt64 CFInteger; + typedef double CFReal; +#endif + + typedef SInt32 CFInteger32; + typedef SInt64 CFInteger64; + + typedef char CFChar8; + typedef char16_t CFChar16; + + struct CFPoint + { + CFInteger64 x_1{0UL}; + CFInteger64 y_1{0UL}; + + CFInteger64 x_2{0UL}; + CFInteger64 y_2{0UL}; + CFReal ang{0UL}; + + operator bool(); + + /// @brief Check if point is within the current CFPoint. + /// @param point the current point to check. + /// @retval true if point is within this point. + /// @retval validations failed. + bool IsWithin(CFPoint& point); + }; + + struct CFColor final + { + CFInteger64 r, g, b, a{0}; + }; + + struct CFRect final + { + CFInteger64 x{0UL}; + CFInteger64 y{0UL}; + + CFInteger64 width{0UL}; + CFInteger64 height{0UL}; + + operator bool(); + + BOOL SizeMatches(CFRect& rect) noexcept; + BOOL PositionMatches(CFRect& rect) noexcept; + }; +} // namespace LibCF \ No newline at end of file diff --git a/dev/Usr/LibCF/Object.h b/dev/Usr/LibCF/Object.h index 4899661e..1f8d185e 100644 --- a/dev/Usr/LibCF/Object.h +++ b/dev/Usr/LibCF/Object.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #define CF_OBJECT : public LibCF::CFObject diff --git a/dev/Usr/LibCF/Property.h b/dev/Usr/LibCF/Property.h index 87927de9..51a60be7 100644 --- a/dev/Usr/LibCF/Property.h +++ b/dev/Usr/LibCF/Property.h @@ -26,7 +26,7 @@ namespace LibCF /// @brief User property class. /// @example /prop/foo or /prop/bar - class CFProperty + class CFProperty final CF_OBJECT { public: CFProperty(); diff --git a/dev/Usr/LibCF/Ref.h b/dev/Usr/LibCF/Ref.h index 46d8ac51..d170ffe8 100644 --- a/dev/Usr/LibCF/Ref.h +++ b/dev/Usr/LibCF/Ref.h @@ -9,11 +9,15 @@ #define _REF_H_ #include +#include namespace LibCF { template - class CFRef final + class CFRef; + + template + class CFRef final CF_OBJECT { public: CFRef() = default; diff --git a/dev/Usr/LibCF/String.h b/dev/Usr/LibCF/String.h index 457a999d..d87c2d2d 100644 --- a/dev/Usr/LibCF/String.h +++ b/dev/Usr/LibCF/String.h @@ -13,4 +13,9 @@ namespace LibCF { class CFString; + class CFString final CF_OBJECT + { + public: + + }; } \ No newline at end of file diff --git a/dev/Usr/LibFont/Font.h b/dev/Usr/LibFont/Font.h index 48f2e530..73b3a285 100644 --- a/dev/Usr/LibFont/Font.h +++ b/dev/Usr/LibFont/Font.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #define kCFFontExt ".ttf" -- cgit v1.2.3