[pykd] added : class intBase

git-svn-id: https://pykd.svn.codeplex.com/svn@68107 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-07-22 06:53:04 +00:00
parent 9c9164daef
commit 2bc8e5760f

88
pykd/intbase.h Normal file
View File

@ -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;
};