Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
class CDumpContext
◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
Description
The CDumpContext class supports stream-oriented diagnostic output in the
form of human-readable text. 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 functions► use afxDump for their
output.
Preconditions
Before you create your own CDumpContext object, you must create a CFile
object that serves as the dump destination.
Comments
The predefined afxDump object, conceptually similar to the cerr stream,
is connected to stderr under MS-DOS. Under the Windows environment, the
output 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 in hexadecimal form. If
you need a custom dump format for a derived object, override
◄CObject::Dump►. Most Microsoft Foundation classes have a Dump member
function defined.
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 macros 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 class Dump functions are defined only
in the Debug version. Use #ifdef _DEBUG / #endif statements to bracket
your diagnostic code, including your custom Dump member functions.
#define _DEBUG
#include <afx.h>
See Also
◄CFile►, ◄CObject►
Public Members
Construction/Destruction
◄CDumpContext► Constructs a CDumpContext object.
Basic I/O
◄Flush► Flushes any data in the dump context buffer.
◄operator <<► Inserts variables and objects into the dump context.
◄HexDump► Dumps bytes in hexadecimal format.
Status
◄GetDepth► Gets an integer corresponding to the depth of the dump.
◄SetDepth► Sets the depth of the dump.
-♦-