Double.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-14
  6. * Changed: 2024-05-31
  7. *
  8. * */
  9. #ifndef LS_STD_DOUBLE_HPP
  10. #define LS_STD_DOUBLE_HPP
  11. #include <ls-std/core/Class.hpp>
  12. #include <ls-std/core/definition.hpp>
  13. #include <ls-std/core/interface/IBoxing.hpp>
  14. namespace ls::std::boxing
  15. {
  16. ls_std_class Double final : public core::Class, public core::interface_type::IBoxing
  17. {
  18. public:
  19. Double();
  20. explicit Double(double _value);
  21. ~Double() noexcept override;
  22. // assignment operators
  23. Double &operator=(double _value);
  24. // arithmetic operators
  25. double operator-() const;
  26. double operator+(const Double &_double) const;
  27. double operator+(double _value) const;
  28. double operator*(const Double &_double) const;
  29. double operator*(double _value) const;
  30. double operator-(const Double &_double) const;
  31. double operator-(double _value) const;
  32. double operator/(const Double &_double) const;
  33. double operator/(double _value) const;
  34. // compound operators
  35. Double &operator+=(const Double &_double);
  36. Double &operator+=(double _value);
  37. Double &operator-=(const Double &_double);
  38. Double &operator-=(double _value);
  39. Double &operator*=(const Double &_double);
  40. Double &operator*=(double _value);
  41. Double &operator/=(const Double &_double);
  42. Double &operator/=(double _value);
  43. // comparison operators
  44. bool operator==(const Double &_double) const;
  45. bool operator==(double _value) const;
  46. bool operator!=(const Double &_double) const;
  47. bool operator!=(double _value) const;
  48. bool operator>(const Double &_double) const;
  49. bool operator>(double _value) const;
  50. bool operator>=(const Double &_double) const;
  51. bool operator>=(double _value) const;
  52. bool operator<(const Double &_double) const;
  53. bool operator<(double _value) const;
  54. bool operator<=(const Double &_double) const;
  55. bool operator<=(double _value) const;
  56. // increment / decrement operator
  57. void operator++();
  58. void operator--();
  59. // implementation
  60. void parse(const ::std::string &_parseText) override;
  61. [[nodiscard]] ::std::string toString() override;
  62. // additional functionality
  63. [[nodiscard]] double getEpsilon() const;
  64. [[nodiscard]] double getValue() const;
  65. void setEpsilon(double _epsilon);
  66. private:
  67. double epsilon{};
  68. double value{};
  69. void _assignEpsilon(double _epsilon);
  70. [[nodiscard]] static ::std::string _fetchClassName();
  71. };
  72. }
  73. #endif