00001 #ifndef INCLUDED_PORTAUDIO_EXCEPTION_HXX 00002 #define INCLUDED_PORTAUDIO_EXCEPTION_HXX 00003 00004 // --------------------------------------------------------------------------------------- 00005 00006 #include <exception> 00007 00008 #include "pa_common/portaudio.h" 00009 00010 // --------------------------------------------------------------------------------------- 00011 00012 namespace portaudio 00013 { 00014 00020 class Exception : public std::exception 00021 { 00022 public: 00023 virtual ~Exception() throw() {} 00024 00025 virtual const char *what() const throw() = 0; 00026 }; 00027 00028 // ----------------------------------------------------------------------------------- 00029 00054 class PaException : public Exception 00055 { 00056 public: 00057 explicit PaException(PaError error); 00058 00059 const char *what() const throw(); 00060 00061 PaError paError() const; 00062 const char *paErrorText() const; 00063 00064 bool isHostApiError() const; // extended 00065 long lastHostApiError() const; 00066 const char *lastHostApiErrorText() const; 00067 00068 bool operator==(const PaException &rhs) const; 00069 bool operator!=(const PaException &rhs) const; 00070 00071 private: 00072 PaError error_; 00073 }; 00074 00075 // ----------------------------------------------------------------------------------- 00076 00081 class PaCppException : public Exception 00082 { 00083 public: 00084 enum ExceptionSpecifier 00085 { 00086 UNABLE_TO_ADAPT_DEVICE 00087 }; 00088 00089 PaCppException(ExceptionSpecifier specifier); 00090 00091 const char *what() const throw(); 00092 00093 ExceptionSpecifier specifier() const; 00094 00095 bool operator==(const PaCppException &rhs) const; 00096 bool operator!=(const PaCppException &rhs) const; 00097 00098 private: 00099 ExceptionSpecifier specifier_; 00100 }; 00101 00102 00103 } // namespace portaudio 00104 00105 // --------------------------------------------------------------------------------------- 00106 00107 #endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX 00108