Long.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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-31
  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/definition.hpp>
  13. #include <ls-std/core/interface/IBoxing.hpp>
  14. #include <ls-std/core/type/Types.hpp>
  15. namespace ls::std::boxing
  16. {
  17. ls_std_class Long final : public core::Class, public core::interface_type::IBoxing
  18. {
  19. public:
  20. explicit Long(core::type::long_type _value);
  21. Long();
  22. ~Long() noexcept override;
  23. // assignment operators
  24. Long &operator=(core::type::long_type _value);
  25. // arithmetic operators
  26. core::type::long_type operator-() const;
  27. core::type::long_type operator+(const Long &_long) const;
  28. core::type::long_type operator+(core::type::long_type _value) const;
  29. core::type::long_type operator*(const Long &_long) const;
  30. core::type::long_type operator*(core::type::long_type _value) const;
  31. core::type::long_type operator-(const Long &_long) const;
  32. core::type::long_type operator-(core::type::long_type _value) const;
  33. core::type::long_type operator/(const Long &_long) const;
  34. core::type::long_type operator/(core::type::long_type _value) const;
  35. core::type::long_type operator%(const Long &_long) const;
  36. core::type::long_type operator%(core::type::long_type _value) const;
  37. // compound operators
  38. Long &operator+=(const Long &_long);
  39. Long &operator+=(core::type::long_type _value);
  40. Long &operator-=(const Long &_long);
  41. Long &operator-=(core::type::long_type _value);
  42. Long &operator*=(const Long &_long);
  43. Long &operator*=(core::type::long_type _value);
  44. Long &operator/=(const Long &_long);
  45. Long &operator/=(core::type::long_type _value);
  46. // comparison operators
  47. bool operator==(const Long &_long) const;
  48. bool operator==(core::type::long_type _value) const;
  49. bool operator!=(const Long &_long) const;
  50. bool operator!=(core::type::long_type _value) const;
  51. bool operator>(const Long &_long) const;
  52. bool operator>(core::type::long_type _value) const;
  53. bool operator>=(const Long &_long) const;
  54. bool operator>=(core::type::long_type _value) const;
  55. bool operator<(const Long &_long) const;
  56. bool operator<(core::type::long_type _value) const;
  57. bool operator<=(const Long &_long) const;
  58. bool operator<=(core::type::long_type _value) const;
  59. // logical operators
  60. friend bool operator!(const Long &_long)
  61. {
  62. return !_long.value;
  63. }
  64. // increment / decrement operator
  65. void operator++();
  66. void operator--();
  67. // implementation
  68. void parse(const ::std::string &_parseText) override;
  69. [[nodiscard]] ::std::string toString() override;
  70. // additional functionality
  71. [[nodiscard]] core::type::long_type getValue() const;
  72. private:
  73. core::type::long_type value{};
  74. [[nodiscard]] static ::std::string _fetchClassName();
  75. };
  76. }
  77. #endif