Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / SSPhysLib / SSException.h
blob87a464275e2862d32cfbc53cf38440231ba441d6
1 // SSException.h: interface for the SSException class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #if !defined(AFX_SSEXCEPTION_H__56E9DD10_4947_45AB_A7C5_F732DE0538A5__INCLUDED_)
6 #define AFX_SSEXCEPTION_H__56E9DD10_4947_45AB_A7C5_F732DE0538A5__INCLUDED_
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
12 #include <sstream>
13 #include "SSRecord.h"
15 //---------------------------------------------------------------------------
16 class SSException : public std::exception
18 public:
19 SSException(const std::string& str)
20 : exception (""), m_Str (str)
23 virtual ~SSException()
25 virtual const char *what() const
26 {return (m_Str.c_str()); }
27 protected:
28 virtual void _Doraise() const
29 {_RAISE(*this); }
31 std::string m_Str;
36 //---------------------------------------------------------------------------
37 class SSRecordException : public SSException
39 public:
40 SSRecordException(const std::string& str)
41 : SSException (str)
44 protected:
45 virtual void _Doraise() const
46 {_RAISE(*this); }
47 private:
50 //---------------------------------------------------------------------------
51 #include <strstream>
52 class SSUnknownActionException : public SSException
54 public:
55 SSUnknownActionException (short action, SSRecordPtr record)
56 : m_Action (action), m_record (record), SSException ("unknown action")
59 virtual const char *what() const
61 std::ostringstream stream;
62 stream << m_Str << " " << m_Action << " at offset 0x" << std::hex << m_record->GetOffset();
63 return (stream.str().c_str ());
65 private:
66 short m_Action;
67 SSRecordPtr m_record;
70 #endif // !defined(AFX_SSEXCEPTION_H__56E9DD10_4947_45AB_A7C5_F732DE0538A5__INCLUDED_)