INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
usbftdiexceptions.h00001 #ifndef USBFTDI_EXCEPTIONS_H 00002 #define USBFTDI_EXCEPTIONS_H 00003 00004 #include <ftd2xx.h> 00005 #include <exception> 00006 #include <string> 00007 00008 /* 00009 * STRINGIZE macro converts an expression into a string-literal. 00010 * ERROR_INFO macro permits file-name and line-number data to be added to an error message. 00011 * 00012 * Adapted by Alex Brooks from Tim Bailey's version 2005. 00013 */ 00014 00015 #ifndef ERROR_MACROS_HPP_ 00016 #define ERROR_MACROS_HPP_ 00017 #if defined(STRINGIZE_HELPER) || defined(STRINGIZE) || defined(ERROR_INFO) 00018 # error OrcaIceUtil error macros have already been defined elsewhere 00019 #endif 00020 #define STRINGIZE_HELPER(exp) #exp 00021 #define STRINGIZE(exp) STRINGIZE_HELPER(exp) 00022 00023 #define ERROR_INFO __FILE__, STRINGIZE(__LINE__) 00024 00025 #endif 00026 00027 00028 namespace usbftdi 00029 { 00030 00041 class Exception : public std::exception 00042 { 00043 public: 00044 00045 Exception(const char *file, const char *line, const char *message); 00046 Exception(const char *file, const char *line, const std::string &message); 00047 Exception(const char *file, const char *line, const char *message, FT_STATUS ftStatus ); 00048 Exception(const char *file, const char *line, const std::string &message, FT_STATUS ftStatus); 00049 00050 virtual ~Exception() throw(); 00051 00052 virtual const char* what() const throw() { return message_.c_str(); } 00053 00054 protected: 00055 00056 void setMsg( const char *file, const char *line, const char *message ); 00057 const char *basename( const char *s ); 00058 00059 std::string message_; 00060 }; 00061 00062 // Returns a human-readable status string 00063 std::string ftStatusToString( FT_STATUS status ); 00064 00065 } 00066 00067 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)