Double.hpp 3.0 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: 2023-02-22
  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/interface/IBoxing.hpp>
  13. #include <ls-std/os/dynamic-goal.hpp>
  14. #include <memory>
  15. namespace ls::std::boxing
  16. {
  17. class LS_STD_DYNAMIC_GOAL Double : public ls::std::core::Class, public ls::std::core::interface_type::IBoxing
  18. {
  19. public:
  20. Double();
  21. explicit Double(double _value);
  22. ~Double() override;
  23. // assignment operators
  24. ls::std::boxing::Double &operator=(double _value);
  25. // arithmetic operators
  26. double operator-() const;
  27. double operator+(const ls::std::boxing::Double &_double) const;
  28. double operator+(double _value) const;
  29. double operator*(const ls::std::boxing::Double &_double) const;
  30. double operator*(double _value) const;
  31. double operator-(const ls::std::boxing::Double &_double) const;
  32. double operator-(double _value) const;
  33. double operator/(const ls::std::boxing::Double &_double) const;
  34. double operator/(double _value) const;
  35. // compound operators
  36. ls::std::boxing::Double &operator+=(const ls::std::boxing::Double &_double);
  37. ls::std::boxing::Double &operator+=(double _value);
  38. ls::std::boxing::Double &operator-=(const ls::std::boxing::Double &_double);
  39. ls::std::boxing::Double &operator-=(double _value);
  40. ls::std::boxing::Double &operator*=(const ls::std::boxing::Double &_double);
  41. ls::std::boxing::Double &operator*=(double _value);
  42. ls::std::boxing::Double &operator/=(const ls::std::boxing::Double &_double);
  43. ls::std::boxing::Double &operator/=(double _value);
  44. // comparison operators
  45. bool operator==(const ls::std::boxing::Double &_double) const;
  46. bool operator==(double _value) const;
  47. bool operator!=(const ls::std::boxing::Double &_double) const;
  48. bool operator!=(double _value) const;
  49. bool operator>(const ls::std::boxing::Double &_double) const;
  50. bool operator>(double _value) const;
  51. bool operator>=(const ls::std::boxing::Double &_double) const;
  52. bool operator>=(double _value) const;
  53. bool operator<(const ls::std::boxing::Double &_double) const;
  54. bool operator<(double _value) const;
  55. bool operator<=(const ls::std::boxing::Double &_double) const;
  56. bool operator<=(double _value) const;
  57. // increment / decrement operator
  58. void operator++();
  59. void operator--();
  60. // implementation
  61. void parse(::std::string _parseText) override;
  62. [[nodiscard]] ::std::string toString() override;
  63. // additional functionality
  64. [[nodiscard]] double getEpsilon() const;
  65. [[nodiscard]] double getValue() const;
  66. void setEpsilon(double _epsilon);
  67. private:
  68. double epsilon{};
  69. double value{};
  70. void _assignEpsilon(double _epsilon);
  71. };
  72. }
  73. #endif