Long.hpp 3.8 KB

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