CDumpContext::operator <<
指定したデータをダンプ コンテキストに出力します。
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
);
戻り値
CDumpContext 参照。 この戻り値を使用して、ソース コードの 1 行に複数の出力ストリーム演算子を書き込むことができます。
解説
出力ストリーム演算子は、ほとんどのプリミティブ型と同じように、CObject ポインターに対してもオーバーロードされます。 char へのポインターは、文字列のダンプに使い、void へのポインターは、アドレスの 16 進形式のダンプにだけ使います。 LONGLONG は 64 ビットの符号付き整数のダンプに使い、ULONGLONG は 64 ビットの符号なし整数のダンプに使います。
IMPLEMENT_DYNAMIC や IMPLEMENT_SERIAL マクロを組み込んでクラスを実装すると、CObject::Dump を使った出力ストリーム演算子は、CObject の派生クラスのクラス名を表示します。 それ以外の場合は、CObject が表示されます。 派生クラスの Dump 関数をオーバーライドすると、オブジェクトの内容を 16 進形式でダンプする代わりに、有効な出力を用意できます。
使用例
#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
必要条件
**ヘッダー:**afx.h