From 2bc8e5760f7d0123b01afb61b9acfbad5ea4522a Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" <SND\kernelnet_cp@9b283d60-5439-405e-af05-b73fd8c4d996> Date: Fri, 22 Jul 2011 06:53:04 +0000 Subject: [PATCH] [pykd] added : class intBase git-svn-id: https://pykd.svn.codeplex.com/svn@68107 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/intbase.h | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 pykd/intbase.h 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<intBase> +{ + +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 <class T> + intBase& operator+=(T const& rhs) + { m_value += rhs; return *this; } + + template <class T> + intBase& operator-=(T const& rhs) + { m_value -= rhs; return *this; } + + template <class T> + intBase& operator*=(T const& rhs) + { m_value *= rhs; return *this; } + + template <class T> + intBase& operator/=(T const& rhs) + { m_value /= rhs; return *this; } + + template <class T> + intBase& operator%=(T const& rhs) + { m_value %= rhs; return *this; } + + template <class T> + intBase& operator&=(T const& rhs) + { m_value &= rhs; return *this; } + + template <class T> + intBase& operator|=(T const& rhs) + { m_value |= rhs; return *this; } + + template <class T> + intBase& operator^=(T const& rhs) + { m_value ^= rhs; return *this; } + + template <class T> + intBase& operator<<=(T const& rhs) + { m_value <<= rhs; return *this; } + + template <class T> + intBase& operator>>=(T const& rhs) + { m_value >>= rhs; return *this; } + +protected: + + mutable ULONG64 m_value; + +}; \ No newline at end of file