共用方式為


CDumpContext::operator <<

Outputs the specified data to the dump context.

CDumpContext& operator <<( 
   const CObject* pOb  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   const CObject& ob  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   LPCTSTR lpsz  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   const void* lp  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   BYTE by  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   WORD w  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   DWORD dw  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   int n  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   double d  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   float f  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   LONG l  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   UINT u  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   LPCWSTR lpsz  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   LPCSTR lpsz  
); 
throw( 
   CFileException*  
); 
CDumpContext& operator <<( 
   LONGLONG n  
); 
CDumpContext& operator <<( 
   ULONGLONG n  
); 
CDumpContext& operator <<( 
   HWND h 
); 
CDumpContext& operator <<( 
HDC h 
); 
CDumpContext& operator <<( 
HMENU h 
); 
CDumpContext& operator <<( 
HACCEL h 
); 
CDumpContext& operator <<( 
HFONT h 
);

Return Value

A CDumpContext reference. Using the return value, you can write multiple insertions on a single line of source code.

Remarks

The insertion operator is overloaded for CObject pointers as well as for most primitive types. A pointer to character results in a dump of string contents; a pointer to void results in a hexadecimal dump of the address only. A LONGLONG results in a dump of a 64-bit signed integer; A ULONGLONG results in a dump of a 64-bit unsigned integer.

If you use the IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL macro in the implementation of your class, then the insertion operator, through CObject::Dump, will print the name of your CObject-derived class. Otherwise, it will print CObject. If you override the Dump function of the class, then you can provide a more meaningful output of the object's contents instead of a hexadecimal dump.

Example

#if _DEBUG
   CStringList li;
   li.AddHead(_T("item 0"));
   li.AddHead(_T("item 1"));
   CString s = _T("test");
   int i = 7;
   long lo = 1000000000L;
   LONGLONG lolo = 12345678901234i64;
   afxDump << _T("list=") << &li << _T("string=")
      << s << _T("int=") << i << _T("long=") << lo 
      << _T("LONGLONG=") << lolo << _T("\n");
#endif

Requirements

Header: afx.h

See Also

Reference

CDumpContext Class

Hierarchy Chart