home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK10 / MFC / SRC / ARCHIVEX.CP$ / archivex
Encoding:
Text File  |  1992-03-08  |  2.2 KB  |  92 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library. 
  2. // Copyright (C) 1992 Microsoft Corporation 
  3. // All rights reserved. 
  4. //  
  5. // This source code is only intended as a supplement to the 
  6. // Microsoft Foundation Classes Reference and Microsoft 
  7. // QuickHelp documentation provided with the library. 
  8. // See these sources for detailed information regarding the 
  9. // Microsoft Foundation Classes product. 
  10.  
  11. #include "afx.h"
  12. #pragma hdrstop
  13.  
  14. #ifdef AFX_AUX_SEG
  15. #pragma code_seg(AFX_AUX_SEG)
  16. #endif
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char BASED_CODE THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. #ifdef _DEBUG
  24.  
  25. // character strings to use for dumping CArchiveException
  26. static char BASED_CODE szNone[] = "none";
  27. static char BASED_CODE szGeneric[] = "generic";
  28. static char BASED_CODE szReadOnly[] = "readOnly";
  29. static char BASED_CODE szEndOfFile[] = "endOfFile";
  30. static char BASED_CODE szWriteOnly[] = "writeOnly";
  31. static char BASED_CODE szBadIndex[] = "badIndex";
  32. static char BASED_CODE szBadClass[] = "badClass";
  33. static char BASED_CODE szBadSchema[] = "badSchema";
  34.  
  35. static char FAR* BASED_CODE rgszCArchiveExceptionCause[] =
  36. {
  37.     szNone,
  38.     szGeneric,
  39.     szReadOnly,
  40.     szEndOfFile,
  41.     szWriteOnly,
  42.     szBadIndex,
  43.     szBadClass,
  44.     szBadSchema,
  45. };
  46.  
  47. static char BASED_CODE szUnknown[] = "unknown";
  48. #endif 
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CArchiveException
  52.  
  53. IMPLEMENT_DYNAMIC(CArchiveException, CException)
  54. #define new DEBUG_NEW
  55.  
  56. #ifdef _DEBUG
  57. void
  58. CArchiveException::Dump(CDumpContext& dc) const
  59. {
  60.     CObject::Dump(dc);
  61.     dc << " m_cause = ";
  62.     if (m_cause >= 0 &&
  63.         m_cause < sizeof(rgszCArchiveExceptionCause) / sizeof(char FAR*))
  64.     {
  65.         dc << rgszCArchiveExceptionCause[m_cause];
  66.     }
  67.     else
  68.     {
  69.         dc << szUnknown;
  70.     }
  71. }
  72. #endif //_DEBUG
  73.  
  74. void PASCAL AfxThrowArchiveException(int cause)
  75. {
  76. #ifdef _DEBUG
  77.     TRACE("CArchive exception: ");
  78.     if (cause >= 0 &&
  79.         cause < sizeof(rgszCArchiveExceptionCause) / sizeof(char FAR*))
  80.     {
  81.         afxDump << (char FAR*)rgszCArchiveExceptionCause[cause];
  82.     }
  83.     else
  84.     {
  85.         afxDump << (char FAR*)szUnknown;
  86.     }
  87.     afxDump << "\n";
  88. #endif //_DEBUG
  89.  
  90.     THROW(new CArchiveException(cause));
  91. }
  92.