mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 19:13:22 +08:00
[pykd] added : class intBase
git-svn-id: https://pykd.svn.codeplex.com/svn@68107 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
9c9164daef
commit
2bc8e5760f
88
pykd/intbase.h
Normal file
88
pykd/intbase.h
Normal 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;
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user