#include <string>
#include <vector>
-#include <exception>
+#include <stdexcept>
#include <iostream>
/*! \typedef typedef unsigned long RtAudioFormat;
*/
/************************************************************************/
-class RtAudioError : public std::exception
+class RtAudioError : public std::runtime_error
{
public:
//! Defined RtAudioError types.
};
//! The constructor.
- RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) : message_(message), type_(type) {}
-
- //! The destructor.
- virtual ~RtAudioError( void ) {}
+ RtAudioError( const std::string& message,
+ Type type = RtAudioError::UNSPECIFIED )
+ : std::runtime_error(message), type_(type) {}
//! Prints thrown error message to stderr.
- virtual void printMessage( void ) const { std::cerr << '\n' << message_ << "\n\n"; }
+ virtual void printMessage( void ) const
+ { std::cerr << '\n' << what() << "\n\n"; }
//! Returns the thrown error message type.
virtual const Type& getType(void) const { return type_; }
//! Returns the thrown error message string.
- virtual const std::string& getMessage(void) const { return message_; }
-
- //! Returns the thrown error message as a c-style string.
- virtual const char* what( void ) const { return message_.c_str(); }
+ virtual const std::string getMessage(void) const
+ { return std::string(what()); }
protected:
- std::string message_;
Type type_;
};
// Default constructor.
CallbackInfo()
- :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false) {}
+ :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false), priority(0) {}
};
// **************************************************************** //