diff --git a/pykd/intbase.h b/pykd/intbase.h new file mode 100644 index 0000000..2808172 --- /dev/null +++ b/pykd/intbase.h @@ -0,0 +1,88 @@ +#pragma once + + +class intBase : boost::integer_arithmetic +{ + +public: + + explicit intBase( ULONG64 val = 0 ) : m_value( val) {} + + virtual ~intBase() {} + + operator ULONG64() const { + return value(); + } + + intBase& operator= ( ULONG64 val ) { + setValue( val ); + return *this; + } + + virtual ULONG64 value() const { + return m_value; + } + + virtual void setValue( ULONG64 value) { + m_value = value; + } + + std::string + str() const { + std::stringstream ss; + ss << value(); + return ss.str(); + } + + std::string + hex() const { + std::stringstream ss; + ss << std::hex << value(); + return ss.str(); + } + + template + intBase& operator+=(T const& rhs) + { m_value += rhs; return *this; } + + template + intBase& operator-=(T const& rhs) + { m_value -= rhs; return *this; } + + template + intBase& operator*=(T const& rhs) + { m_value *= rhs; return *this; } + + template + intBase& operator/=(T const& rhs) + { m_value /= rhs; return *this; } + + template + intBase& operator%=(T const& rhs) + { m_value %= rhs; return *this; } + + template + intBase& operator&=(T const& rhs) + { m_value &= rhs; return *this; } + + template + intBase& operator|=(T const& rhs) + { m_value |= rhs; return *this; } + + template + intBase& operator^=(T const& rhs) + { m_value ^= rhs; return *this; } + + template + intBase& operator<<=(T const& rhs) + { m_value <<= rhs; return *this; } + + template + intBase& operator>>=(T const& rhs) + { m_value >>= rhs; return *this; } + +protected: + + mutable ULONG64 m_value; + +}; \ No newline at end of file