Поделиться через


CDumpContext Class

Supports stream-oriented diagnostic output in the form of human-readable text.

class CDumpContext

Remarks

CDumpContext does not have a base class.

You can use afxDump, a predeclared CDumpContext object, for most of your dumping. The afxDump object is available only in the Debug version of the Microsoft Foundation Class Library.

Several of the memory diagnostic services use afxDump for their output.

Under the Windows environment, the output from the predefined afxDump object, conceptually similar to the cerr stream, is routed to the debugger via the Windows function OutputDebugString.

The CDumpContext class has an overloaded insertion (<<) operator for CObject pointers that dumps the object's data. If you need a custom dump format for a derived object, override CObject::Dump. Most Microsoft Foundation classes implement an overridden Dump member function.

Classes that are not derived from CObject, such as CString, CTime, and CTimeSpan, have their own overloaded CDumpContext insertion operators, as do often-used structures such as CFileStatus, CPoint, and CRect.

If you use the IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL macro in the implementation of your class, then CObject::Dump will print the name of your CObject-derived class. Otherwise, it will print CObject.

The CDumpContext class is available with both the Debug and Release versions of the library, but the Dump member function is defined only in the Debug version. Use #ifdef _DEBUG / #endif statements to bracket your diagnostic code, including your custom Dump member functions.

Before you create your own CDumpContext object, you must create a CFile object that serves as the dump destination.

For more information on CDumpContext, see Debugging MFC Applications.

#define _DEBUG

Requirements

Header: afx.h

See Also

Reference

Hierarchy Chart

CFile Class

CObject Class

Other Resources

CDumpContext Members