//----------------------- CSPException.h ----------------------

//*************************************************************
//*****       Copyright ©2002 - 2004 Micronovae Ltd       *****
//*****                All rights reserved                *****
//*************************************************************


#ifndef _CSPEXCEPTION
#define _CSPEXCEPTION

#include "CSPConf.h"
#include "CSPObject.h"
#include "CSPString.h"

class CSPLIB_CLASS_EXPORT CSPException : public CSPObject
{
	public:

		CSPException();
		CSPException( const CSPString& strMsg, unsigned long ulCode = 0 );
		virtual ~CSPException();

		virtual const CSPString& GetType() const;
		
		virtual const CSPString& GetMsg() const;
		virtual void SetMsg( const CSPString& strMessage );

		virtual unsigned long GetCode() const;
		virtual void SetCode( unsigned long ulCode );

	private:
		CSPString m_strMessage;
		unsigned long m_ulCode;

		static CSPString m_strGenericType;
};


class CSPLIB_CLASS_EXPORT CSPSystemException : public CSPException
{
	public:
		enum
		{
			OUT_OF_MEMORY = 1,
			OUT_OF_RANGE = 2
		};


		CSPSystemException( unsigned long ulCode );
		virtual ~CSPSystemException();

		virtual const CSPString& GetType() const;
		virtual const CSPString& GetMsg() const;

	protected:
		mutable CSPString m_strSystemMessage;
	private:
		static CSPString m_strSystemType;
		static CSPString m_strOutOfMemory;
};

#endif
