シリアライズ?朝食に食べそうだよね。

LOGFONT構造体のパラメータを ini ファイルから読んでみた。(自前クラス使ってるけど気持ちはわかって^^;)


m_sSerifFont.lfHeight           = pcSection->GetValueInt(_T("lfHeight"), nDefHeight);
m_sSerifFont.lfWidth            = pcSection->GetValueInt(_T("lfWidth"));
m_sSerifFont.lfEscapement       = pcSection->GetValueInt(_T("lfEscapement"));
m_sSerifFont.lfOrientation      = pcSection->GetValueInt(_T("lfOrientation"));
m_sSerifFont.lfWeight           = pcSection->GetValueInt(_T("lfWeight"));
m_sSerifFont.lfItalic           = pcSection->GetValueInt(_T("lfItalic"))            != 0;
m_sSerifFont.lfUnderline        = pcSection->GetValueInt(_T("lfUnderline"))         != 0;
m_sSerifFont.lfStrikeOut        = pcSection->GetValueInt(_T("lfStrikeOut"))         != 0;
m_sSerifFont.lfCharSet          = pcSection->GetValueInt(_T("lfCharSet"), SHIFTJIS_CHARSET);
m_sSerifFont.lfOutPrecision     = pcSection->GetValueInt(_T("lfOutPrecision"))      != 0;
m_sSerifFont.lfClipPrecision    = pcSection->GetValueInt(_T("lfClipPrecision"))     != 0;
m_sSerifFont.lfQuality          = pcSection->GetValueInt(_T("lfQuality"))           != 0;
m_sSerifFont.lfPitchAndFamily   = pcSection->GetValueInt(_T("lfPitchAndFamily"))    != 0;
pcSection->GetValueString(_T("lfFaceName"), m_sSerifFont.lfFaceName, D9ArraySize(m_sSerifFont.lfFaceName), _T("MS ゴシック"));

ぅゎ、カッコ悪い

で、こんなコードが書き出しにもある…と。^^;


構造体の内容をまるまる*1テキストファイルに書き出すナイスな方法ってどんなのがあるんでしょうかねぇ…。 私が、他に思いつくのは、構造体をバイト列とみなし Base64 でエンコして書き出す/読み出す…とかぐらいだなぁ…。

う〜む。

*1:もしくは一部