mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Add some initial widget functionality (prefs partly working)
This commit is contained in:
@@ -28,7 +28,8 @@ public:
|
||||
explicit THandle(PortabilityLayer::MMHandleBlock *hdl);
|
||||
THandle(const THandle<T> &other);
|
||||
|
||||
operator T **() const;
|
||||
operator T *const*() const;
|
||||
operator T **();
|
||||
|
||||
template<class TOther>
|
||||
THandle<TOther> StaticCast() const;
|
||||
@@ -36,11 +37,16 @@ public:
|
||||
template<class TOther>
|
||||
THandle<TOther> ReinterpretCast() const;
|
||||
|
||||
template<class TOther>
|
||||
THandle<TOther> ImplicitCast() const;
|
||||
|
||||
bool operator==(const THandle<T> &other) const;
|
||||
bool operator!=(const THandle<T> &other) const;
|
||||
|
||||
bool operator==(T** other) const;
|
||||
bool operator!=(T** other) const;
|
||||
|
||||
static THandle<T> NullPtr();
|
||||
};
|
||||
|
||||
typedef THandle<void> Handle;
|
||||
@@ -65,7 +71,7 @@ inline PortabilityLayer::MMHandleBlock *THandleBase::MMBlock() const
|
||||
template<class T>
|
||||
inline THandle<T>::THandle()
|
||||
: THandleBase(nullptr)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -83,37 +89,51 @@ inline THandle<T>::THandle(PortabilityLayer::MMHandleBlock *hdl)
|
||||
template<class T>
|
||||
inline THandle<T>::THandle(const THandle<T> &other)
|
||||
: THandleBase(other.m_hdl)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool THandle<T>::operator==(const THandle<T> &other) const
|
||||
inline bool THandle<T>::operator==(const THandle<T> &other) const
|
||||
{
|
||||
return m_hdl == other.m_hdl;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool THandle<T>::operator!=(const THandle<T> &other) const
|
||||
inline bool THandle<T>::operator!=(const THandle<T> &other) const
|
||||
{
|
||||
return m_hdl != other.m_hdl;
|
||||
return m_hdl != other.m_hdl;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool THandle<T>::operator==(T** other) const
|
||||
inline bool THandle<T>::operator==(T** other) const
|
||||
{
|
||||
return static_cast<void*>(&m_hdl->m_contents) == static_cast<void*>(other);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool THandle<T>::operator!=(T** other) const
|
||||
inline bool THandle<T>::operator!=(T** other) const
|
||||
{
|
||||
return static_cast<void*>(&m_hdl->m_contents) != static_cast<void*>(other);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline THandle<T>::operator T**() const
|
||||
THandle<T> THandle<T>::NullPtr()
|
||||
{
|
||||
return reinterpret_cast<T**>(&m_hdl->m_contents);
|
||||
return THandle<T>(static_cast<PortabilityLayer::MMHandleBlock *>(nullptr));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline THandle<T>::operator T*const*() const
|
||||
{
|
||||
// Should use const_cast here but then I'd have to strip qualifiers, blah, do the lazy thing
|
||||
return (T*const*)(&m_hdl->m_contents);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline THandle<T>::operator T**()
|
||||
{
|
||||
// Should use const_cast here but then I'd have to strip qualifiers, blah, do the lazy thing
|
||||
return (T**)(&m_hdl->m_contents);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -131,3 +151,13 @@ THandle<TOther> THandle<T>::ReinterpretCast() const
|
||||
(void)(reinterpret_cast<TOther*>(static_cast<T*>(nullptr)));
|
||||
return THandle<TOther>(m_hdl);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
template<class TOther>
|
||||
THandle<TOther> THandle<T>::ImplicitCast() const
|
||||
{
|
||||
const TOther *target = static_cast<const T*>(nullptr);
|
||||
(void)target;
|
||||
|
||||
return THandle<TOther>(m_hdl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user