home *** CD-ROM | disk | FTP | other *** search
/ Game Audio Programming / GameAudioProgramming.iso / Game_Audio / audio_sdk / include / AudioLib / Errors.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-05-31  |  1.7 KB  |  48 lines

  1. /***********************************************************\
  2. Copyright (C) James Boer, 2002. 
  3. All rights reserved worldwide.
  4.  
  5. This software is provided "as is" without express or implied
  6. warranties. You may freely copy and compile this source into
  7. applications you distribute provided that the copyright text
  8. below is included in the resulting source code, for example:
  9. "Portions Copyright (C) James Boer, 2002"
  10. \***********************************************************/
  11. #ifndef __ERRORS_H__
  12. #define __ERRORS_H__
  13.  
  14. namespace Audio
  15. {
  16.  
  17. class Error
  18. {
  19. public:
  20.     // Use HandleError to log error messages and strings for fatal errors.
  21.     // This function can be overridden to provide more complete diagnostics
  22.     // as needed per class.  The default function simply sets the error
  23.     // code and error message for later retrieval, then returns the error code
  24.     // passed in.
  25.     static bool Handle(const char* lpszFormat, ...);
  26.  
  27.     // Error logging functions
  28.     // The error logging is designed to store every error message passed to
  29.     // Error::Handle for later reference.  It can also be used as a central 
  30.     // repository for logging debug messages for later retrieval in the event
  31.     // of a run-time error.  Because a global list is stored, and this is used
  32.     // in release mode, care must be taken to record only relevant information,
  33.     // preferrably mostly at startup.
  34.     static void Log(const char* lpszFormat, ...);
  35.     static void ClearLog();
  36.     static const char* GetFirst();
  37.     static const char* GetNext();
  38.     static const char* GetLast();
  39.  
  40. protected:
  41.  
  42.     static std::list<std::string> m_ErrorLog;
  43.     static std::list<std::string>::iterator m_ErrorLogItor;
  44. };
  45.  
  46. }; // namespace Audio
  47.  
  48. #endif // __ERRORS_H__