Kaydet (Commit) 98e4c241 authored tarafından Michael Stahl's avatar Michael Stahl

o3tl: add more strong_int operators

Change-Id: Ibb0f883353b6d172275744eaa59d27ba39930623
Reviewed-on: https://gerrit.libreoffice.org/55264Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 57d598a2
...@@ -110,6 +110,10 @@ public: ...@@ -110,6 +110,10 @@ public:
bool operator!=(strong_int const & other) const { return m_value != other.m_value; } bool operator!=(strong_int const & other) const { return m_value != other.m_value; }
strong_int& operator++() { ++m_value; return *this; } strong_int& operator++() { ++m_value; return *this; }
strong_int operator++(int) { UNDERLYING_TYPE nOldValue = m_value; ++m_value; return strong_int(nOldValue); } strong_int operator++(int) { UNDERLYING_TYPE nOldValue = m_value; ++m_value; return strong_int(nOldValue); }
strong_int& operator--() { --m_value; return *this; }
strong_int operator--(int) { UNDERLYING_TYPE nOldValue = m_value; --m_value; return strong_int(nOldValue); }
strong_int& operator+=(strong_int const & other) { m_value += other.m_value; return *this; }
strong_int& operator-=(strong_int const & other) { m_value -= other.m_value; return *this; }
bool anyOf(strong_int v) const { bool anyOf(strong_int v) const {
return *this == v; return *this == v;
...@@ -130,6 +134,11 @@ strong_int<UT,PT> operator+(strong_int<UT,PT> const & lhs, strong_int<UT,PT> con ...@@ -130,6 +134,11 @@ strong_int<UT,PT> operator+(strong_int<UT,PT> const & lhs, strong_int<UT,PT> con
return strong_int<UT,PT>(lhs.get() + rhs.get()); return strong_int<UT,PT>(lhs.get() + rhs.get());
} }
template <typename UT, typename PT>
strong_int<UT,PT> operator-(strong_int<UT,PT> const & lhs, strong_int<UT,PT> const & rhs)
{
return strong_int<UT,PT>(lhs.get() - rhs.get());
}
}; // namespace o3tl }; // namespace o3tl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment