Long.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-17
  6. * Changed: 2022-05-19
  7. *
  8. * */
  9. #ifndef LS_STD_LONG_HPP
  10. #define LS_STD_LONG_HPP
  11. #include <memory>
  12. #include <ls_std/core/Class.hpp>
  13. #include <ls_std/core/interface/IBoxing.hpp>
  14. #include <ls_std/core/types/Types.hpp>
  15. namespace ls
  16. {
  17. namespace std
  18. {
  19. namespace boxing
  20. {
  21. class 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() override = default;
  27. // conversion operator
  28. operator ls::std::core::type::long_type() const;
  29. // assignment operators
  30. ls::std::boxing::Long &operator=(ls::std::core::type::long_type _value);
  31. // arithmetic operators
  32. ls::std::core::type::long_type operator-() 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. ls::std::core::type::long_type operator%(const ls::std::boxing::Long &_long) const;
  42. ls::std::core::type::long_type operator%(ls::std::core::type::long_type _value) const;
  43. // compound operators
  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. ls::std::boxing::Long &operator/=(const ls::std::boxing::Long &_long);
  51. ls::std::boxing::Long &operator/=(ls::std::core::type::long_type _value);
  52. // comparison operators
  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. bool operator<=(const ls::std::boxing::Long &_long) const;
  64. bool operator<=(ls::std::core::type::long_type _value) const;
  65. // logical operators
  66. friend bool operator!(const ls::std::boxing::Long &_long)
  67. {
  68. return !_long.value;
  69. }
  70. bool operator&&(const ls::std::boxing::Long &_long) const;
  71. bool operator&&(ls::std::core::type::long_type _value) const;
  72. bool operator&&(bool _expression) const;
  73. bool operator||(const ls::std::boxing::Long &_long) const;
  74. bool operator||(ls::std::core::type::long_type _value) const;
  75. bool operator||(bool _expression) const;
  76. // increment / decrement operator
  77. void operator++();
  78. void operator--();
  79. // implementation
  80. void parse(::std::string _parseText) override;
  81. ::std::string toString() override;
  82. // additional functionality
  83. ls::std::core::type::long_type getValue() const;
  84. private:
  85. ls::std::core::type::long_type value{};
  86. };
  87. }
  88. }
  89. }
  90. #endif