Double.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-14
  6. * Changed: 2022-07-03
  7. *
  8. * */
  9. #ifndef LS_STD_DOUBLE_HPP
  10. #define LS_STD_DOUBLE_HPP
  11. #include <memory>
  12. #include <ls_std/core/Class.hpp>
  13. #include <ls_std/core/interface/IBoxing.hpp>
  14. #include <ls_std/os/dynamic_goal.hpp>
  15. namespace ls
  16. {
  17. namespace std
  18. {
  19. namespace boxing
  20. {
  21. class LS_STD_DYNAMIC_GOAL Double : public ls::std::core::Class, public ls::std::core::interface_type::IBoxing
  22. {
  23. public:
  24. Double();
  25. explicit Double(double _value);
  26. ~Double() override = default;
  27. // conversion operator
  28. operator double() const; // do not make explicit!
  29. // assignment operators
  30. ls::std::boxing::Double &operator=(double _value);
  31. // arithmetic operators
  32. double operator-() const;
  33. double operator+(const ls::std::boxing::Double &_double) const;
  34. double operator+(double _value) const;
  35. double operator*(const ls::std::boxing::Double &_double) const;
  36. double operator*(double _value) const;
  37. double operator-(const ls::std::boxing::Double &_double) const;
  38. double operator-(double _value) const;
  39. double operator/(const ls::std::boxing::Double &_double) const;
  40. double operator/(double _value) const;
  41. // compound operators
  42. ls::std::boxing::Double &operator+=(const ls::std::boxing::Double &_double);
  43. ls::std::boxing::Double &operator+=(double _value);
  44. ls::std::boxing::Double &operator-=(const ls::std::boxing::Double &_double);
  45. ls::std::boxing::Double &operator-=(double _value);
  46. ls::std::boxing::Double &operator*=(const ls::std::boxing::Double &_double);
  47. ls::std::boxing::Double &operator*=(double _value);
  48. ls::std::boxing::Double &operator/=(const ls::std::boxing::Double &_double);
  49. ls::std::boxing::Double &operator/=(double _value);
  50. // comparison operators
  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. bool operator>=(const ls::std::boxing::Double &_double) const;
  58. bool operator>=(double _value) const;
  59. bool operator<(const ls::std::boxing::Double &_double) const;
  60. bool operator<(double _value) const;
  61. bool operator<=(const ls::std::boxing::Double &_double) const;
  62. bool operator<=(double _value) const;
  63. // increment / decrement operator
  64. void operator++();
  65. void operator--();
  66. // implementation
  67. void parse(::std::string _parseText) override;
  68. ::std::string toString() override;
  69. // additional functionality
  70. double getEpsilon();
  71. double getValue();
  72. void setEpsilon(double _epsilon);
  73. private:
  74. double epsilon{};
  75. double value{};
  76. void _assignEpsilon(double _epsilon);
  77. };
  78. }
  79. }
  80. }
  81. #endif