|
#ifndef SLOBJECT_H
#define SLOBJECT_H
#define EXPORT_SL __declspec(dllexport)
class EXPORT_SL CSLObject
{
public:
virtual ~CSLObject();
virtual CSLObject* CreateObject();
virtual CSLObject* Clone();
virtual void Clear();
virtual void Copy(const CSLObject& objectSrc);
virtual bool IsEqual(const CSLObject& objectSrc);
virtual void ShutDown();
private:
};
#define DCL_SLOBJECT(class_name) \
public: \
class_name(const CSLObject& objectSrc){Copy(objectSrc);} \
virtual void ShutDown() { delete this; } \
virtual CSLObject* CreateObject() { return new class_name; }\
void operator=(const CSLObject& objectSrc) { Copy(objectSrc);}\
bool operator==(const CSLObject& objectSrc)\
{class_name& right = (class_name&)objectSrc; return IsEqual(right);}\
bool operator!=(const CSLObject& objectSrc)\
{class_name& right = (class_name&)objectSrc; return !IsEqual(right);}
inline
CSLObject::~CSLObject()
{
}
inline
void CSLObject::ShutDown()
{
delete this;
}
inline
CSLObject* CSLObject::CreateObject()
{
return new CSLObject;
}
inline
CSLObject* CSLObject::Clone()
{
CSLObject* pObj = CreateObject();
pObj->Copy(*this);
return pObj;
}
inline
void CSLObject::Clear()
{
}
inline
void CSLObject::Copy(const CSLObject& objectSrc)
{
}
inline
bool CSLObject::IsEqual(const CSLObject& objectSrc)
{
return true;
}
#define DCL_ERROR_MEMBER \
public: \
const CString GetLastError() { return m_strError; } \
const bool HasError() { return !m_strError.IsEmpty(); } \
void ShowError(CString lpszError) { m_strError = lpszError; } \
void ShowError(HRESULT hr) { m_strError = DecodeHResult(hr); } \
void ClearError() { m_strError.Empty(); } \
protected: \
CString m_strError;
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.