Long.hpp 3.1 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: 2020-08-26
  7. *
  8. * */
  9. #ifndef LONG_HPP
  10. #define LONG_HPP
  11. #include "../base/Class.hpp"
  12. #include "IBoxing.hpp"
  13. #include "../base/Types.hpp"
  14. namespace ls_std {
  15. class Long : public Class, IBoxing {
  16. public:
  17. explicit Long(ls_std::long_type _value);
  18. Long();
  19. ~Long() = default;
  20. // conversion operator
  21. operator ls_std::long_type() const;
  22. // assignment operators
  23. Long& operator=(ls_std::long_type _value);
  24. // arithmetic operators
  25. ls_std::long_type operator-() const;
  26. ls_std::long_type operator+(const Long& _long) const;
  27. ls_std::long_type operator+(ls_std::long_type _value) const;
  28. ls_std::long_type operator*(const Long& _long) const;
  29. ls_std::long_type operator*(ls_std::long_type _value) const;
  30. ls_std::long_type operator-(const Long& _long) const;
  31. ls_std::long_type operator-(ls_std::long_type _value) const;
  32. ls_std::long_type operator/(const Long& _long) const;
  33. ls_std::long_type operator/(ls_std::long_type _value) const;
  34. ls_std::long_type operator%(const Long& _long) const;
  35. ls_std::long_type operator%(ls_std::long_type _value) const;
  36. // compound operators
  37. Long& operator+=(const Long& _long);
  38. Long& operator+=(ls_std::long_type _value);
  39. Long& operator-=(const Long& _long);
  40. Long& operator-=(ls_std::long_type _value);
  41. Long& operator*=(const Long& _long);
  42. Long& operator*=(ls_std::long_type _value);
  43. Long& operator/=(const Long& _long);
  44. Long& operator/=(ls_std::long_type _value);
  45. // comparison operators
  46. bool operator==(const Long& _long) const;
  47. bool operator==(ls_std::long_type _value) const;
  48. bool operator!=(const Long& _long) const;
  49. bool operator!=(ls_std::long_type _value) const;
  50. bool operator>(const Long& _long) const;
  51. bool operator>(ls_std::long_type _value) const;
  52. bool operator>=(const Long& _long) const;
  53. bool operator>=(ls_std::long_type _value) const;
  54. bool operator<(const Long& _long) const;
  55. bool operator<(ls_std::long_type _value) const;
  56. bool operator<=(const Long& _long) const;
  57. bool operator<=(ls_std::long_type _value) const;
  58. // logical operators
  59. friend bool operator!(const Long& _long) {
  60. return !_long.value;
  61. }
  62. bool operator&&(const Long& _long) const;
  63. bool operator&&(ls_std::long_type _value) const;
  64. bool operator&&(bool _expression) const;
  65. bool operator||(const Long& _long) const;
  66. bool operator||(ls_std::long_type _value) const;
  67. bool operator||(bool _expression) const;
  68. // increment / decrement operator
  69. void operator++();
  70. void operator--();
  71. // implementation
  72. void parse(std::string _parseText) override;
  73. std::string toString() override;
  74. // additional functionality
  75. ls_std::long_type getValue() const;
  76. private:
  77. ls_std::long_type value {};
  78. };
  79. }
  80. #endif