Long.hpp 3.9 KB

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