Long.hpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-17
  6. * Changed: 2022-07-03
  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. #include <ls_std/os/dynamic_goal.hpp>
  16. namespace ls
  17. {
  18. namespace std
  19. {
  20. namespace boxing
  21. {
  22. class LS_STD_DYNAMIC_GOAL Long : public ls::std::core::Class, public ls::std::core::interface_type::IBoxing
  23. {
  24. public:
  25. explicit Long(ls::std::core::type::long_type _value);
  26. Long();
  27. ~Long() override = default;
  28. // conversion operator
  29. operator ls::std::core::type::long_type() const;
  30. // assignment operators
  31. ls::std::boxing::Long &operator=(ls::std::core::type::long_type _value);
  32. // arithmetic operators
  33. ls::std::core::type::long_type operator-() 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. ls::std::core::type::long_type operator-(const ls::std::boxing::Long &_long) const;
  39. ls::std::core::type::long_type operator-(ls::std::core::type::long_type _value) const;
  40. ls::std::core::type::long_type operator/(const ls::std::boxing::Long &_long) const;
  41. ls::std::core::type::long_type operator/(ls::std::core::type::long_type _value) const;
  42. ls::std::core::type::long_type operator%(const ls::std::boxing::Long &_long) const;
  43. ls::std::core::type::long_type operator%(ls::std::core::type::long_type _value) const;
  44. // compound operators
  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. ls::std::boxing::Long &operator-=(const ls::std::boxing::Long &_long);
  48. ls::std::boxing::Long &operator-=(ls::std::core::type::long_type _value);
  49. ls::std::boxing::Long &operator*=(const ls::std::boxing::Long &_long);
  50. ls::std::boxing::Long &operator*=(ls::std::core::type::long_type _value);
  51. ls::std::boxing::Long &operator/=(const ls::std::boxing::Long &_long);
  52. ls::std::boxing::Long &operator/=(ls::std::core::type::long_type _value);
  53. // comparison operators
  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. bool operator>=(const ls::std::boxing::Long &_long) const;
  61. bool operator>=(ls::std::core::type::long_type _value) const;
  62. bool operator<(const ls::std::boxing::Long &_long) const;
  63. bool operator<(ls::std::core::type::long_type _value) const;
  64. bool operator<=(const ls::std::boxing::Long &_long) const;
  65. bool operator<=(ls::std::core::type::long_type _value) const;
  66. // logical operators
  67. friend bool operator!(const ls::std::boxing::Long &_long)
  68. {
  69. return !_long.value;
  70. }
  71. bool operator&&(const ls::std::boxing::Long &_long) const;
  72. bool operator&&(ls::std::core::type::long_type _value) const;
  73. bool operator&&(bool _expression) const;
  74. bool operator||(const ls::std::boxing::Long &_long) const;
  75. bool operator||(ls::std::core::type::long_type _value) const;
  76. bool operator||(bool _expression) const;
  77. // increment / decrement operator
  78. void operator++();
  79. void operator--();
  80. // implementation
  81. void parse(::std::string _parseText) override;
  82. ::std::string toString() override;
  83. // additional functionality
  84. ls::std::core::type::long_type getValue() const;
  85. private:
  86. ls::std::core::type::long_type value{};
  87. };
  88. }
  89. }
  90. }
  91. #endif