wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wThicknessComponent.hpp
Go to the documentation of this file.
1/*
2+---------------------------------------------------------------------------------------------------------------------------------------------------+
3Created by Wilfried Koch.
4Copyright @ 2025 Wilfried Koch. All rights reserved.
5+---------------------------------------------------------------------------------------------------------------------------------------------------+
6*/
7
8#ifndef W_THICKNESS_COMPONENT_HPP
9#define W_THICKNESS_COMPONENT_HPP
10
12
13#pragma GCC diagnostic push
14#pragma GCC diagnostic ignored "-Wfloat-equal"
15#pragma GCC diagnostic ignored "-Wswitch-default"
16#include <SFML/Graphics.hpp>
17#pragma GCC diagnostic pop
18
19namespace wEngine
20{
21
44 {
45 public:
51 ThicknessComponent( float thickness = 2.0f );
52
53 /*
54 * @brief Virtual destructor.
55 */
56 virtual ~ThicknessComponent( ) = default;
57
62 [[nodiscard]] float getThickness( ) const;
63
69 void setThickness( float newThickness );
70
74 void debugPrint( ) const;
75 private:
76 float mThickness;
77
78 /*
79 * @brief Validates that the thickness value is strictly positive.
80 * @param value The thickness value to validate.
81 * @throws std::invalid_argument if value <= 0.
82 */
83 void validatePositive( float value ) const;
84 };
85
86}//End of namespace wEngine
87
88#endif
Component()
Protected constructor to restrict instantiation to derived classes.
Definition wComponent.cpp:17
virtual ~ThicknessComponent()=default
void setThickness(float newThickness)
Sets a new thickness value.
Definition wThicknessComponent.cpp:37
void debugPrint() const
Outputs the current thickness value to the console for debugging.
Definition wThicknessComponent.cpp:49
ThicknessComponent(float thickness=2.0f)
Constructs the component with an initial positive thickness.
Definition wThicknessComponent.cpp:20
float getThickness() const
Returns the current thickness.
Definition wThicknessComponent.cpp:32
Definition wColorComponent.cpp:9