home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / MFC / SRC / ARCEX.CP_ / ARCEX.CP
Encoding:
Text File  |  1993-02-08  |  2.2 KB  |  91 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 and/or WinHelp documentation provided with the library. 
  8. // See these sources for detailed information regarding the 
  9. // Microsoft Foundation Classes product. 
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef AFX_AUX_SEG
  14. #pragma code_seg(AFX_AUX_SEG)
  15. #endif
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. #ifdef _DEBUG
  23.  
  24. // character strings to use for dumping CArchiveException
  25. static char BASED_CODE szNone[] = "none";
  26. static char BASED_CODE szGeneric[] = "generic";
  27. static char BASED_CODE szReadOnly[] = "readOnly";
  28. static char BASED_CODE szEndOfFile[] = "endOfFile";
  29. static char BASED_CODE szWriteOnly[] = "writeOnly";
  30. static char BASED_CODE szBadIndex[] = "badIndex";
  31. static char BASED_CODE szBadClass[] = "badClass";
  32. static char BASED_CODE szBadSchema[] = "badSchema";
  33.  
  34. static LPCSTR BASED_CODE rgszCArchiveExceptionCause[] =
  35. {
  36.     szNone,
  37.     szGeneric,
  38.     szReadOnly,
  39.     szEndOfFile,
  40.     szWriteOnly,
  41.     szBadIndex,
  42.     szBadClass,
  43.     szBadSchema,
  44. };
  45.  
  46. static char BASED_CODE szUnknown[] = "unknown";
  47. #endif 
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CArchiveException
  51.  
  52. IMPLEMENT_DYNAMIC(CArchiveException, CException)
  53. #define new DEBUG_NEW
  54.  
  55. #ifdef _DEBUG
  56. void
  57. CArchiveException::Dump(CDumpContext& dc) const
  58. {
  59.     CObject::Dump(dc);
  60.     AFX_DUMP0(dc, " m_cause = ");
  61.     if (m_cause >= 0 &&
  62.         m_cause < sizeof(rgszCArchiveExceptionCause) / sizeof(LPCSTR))
  63.     {
  64.         dc << rgszCArchiveExceptionCause[m_cause];
  65.     }
  66.     else
  67.     {
  68.         dc << szUnknown;
  69.     }
  70. }
  71. #endif //_DEBUG
  72.  
  73. void AFXAPI AfxThrowArchiveException(int cause)
  74. {
  75. #ifdef _DEBUG
  76.     LPCSTR lpsz;
  77.     if (cause >= 0 &&
  78.         cause < sizeof(rgszCArchiveExceptionCause) / sizeof(LPCSTR))
  79.     {
  80.         lpsz = rgszCArchiveExceptionCause[cause];
  81.     }
  82.     else
  83.     {
  84.         lpsz = szUnknown;
  85.     }
  86.     TRACE1("CArchive exception: %Fs\n", lpsz);
  87. #endif //_DEBUG
  88.  
  89.     THROW(new CArchiveException(cause));
  90. }
  91.