|
#pragma once
#include "Typedefs.h"
__forceinline std::ostream& operator<<(std::ostream& rStream, const LVCOLUMN& rColumn)
{
rStream << rColumn.mask << " " << rColumn.fmt << " " << rColumn.cx << " ";
rStream << rColumn.iSubItem << " ";
rStream << rColumn.iImage << " " << rColumn.iOrder << " ";
if (rColumn.pszText)
{
USES_CONVERSION;
rStream << T2CA(rColumn.pszText);
}
return rStream;
}
__forceinline std::istream& operator>>(std::istream& rStream, LVCOLUMN& rColumn)
{
rStream >> rColumn.mask >> rColumn.fmt >> rColumn.cx >> rColumn.iSubItem;
rStream >> rColumn.iImage >> rColumn.iOrder;
(void) rStream.ignore();
std::string strLine;
(void) std::getline(rStream, strLine);
USES_CONVERSION;
::_tcscpy_s(rColumn.pszText, rColumn.cchTextMax, A2CT(strLine.c_str()));
rColumn.cchTextMax = static_cast<int>(strLine.size());
if (0 == rColumn.cchTextMax)
{
rStream.clear(); // reset the stream error if we don't have column text
}
return rStream;
}
__forceinline std::ostream& operator<<(std::ostream& rStream, const LOGFONT& lf)
{
int nPts = lf.lfHeight /* * 72 / ::GetDeviceCaps(::GetDC(NULL), LOGPIXELSY)*/;
rStream << lf.lfFaceName << _T(";") << nPts << _T(";") << lf.lfWeight << _T(";") << (BOOL) lf.lfItalic << _T(";") << (BOOL) lf.lfUnderline << _T(";") << (BOOL) lf.lfStrikeOut;
return rStream;
}
__forceinline std::istream& operator>>(std::istream& rStream, LOGFONT& lf)
{
int bItalic = 0;
int underline = 0;
int strikeOut = 0;
ZeroMemory(&lf, sizeof(lf));
t_String theFaceName;
(void) getline(rStream, theFaceName, _T(';'));
::_tcscpy_s(lf.lfFaceName, 32, theFaceName.c_str());
rStream >> lf.lfHeight;
/* lf.lfHeight = lf.lfHeight * ::GetDeviceCaps(::GetDC(NULL), LOGPIXELSY) / 72*/;
rStream.ignore() >> lf.lfWeight; // ignore the commas
rStream.ignore() >> bItalic;
rStream.ignore() >> underline;
rStream.ignore() >> strikeOut;
lf.lfItalic = static_cast<BYTE>(bItalic); // because lf.lfItalic is a BYTE
lf.lfUnderline = static_cast<BYTE>(underline);
lf.lfStrikeOut = static_cast<BYTE>(strikeOut);
return rStream;
}
__forceinline std::ostream& operator<<(std::ostream& rStream, const CString& rs)
{
rStream << (LPCTSTR)rs;
return rStream;
}
__forceinline std::istream& operator>>(std::istream& rStream, CString& rs)
{
std::string theString;
std::getline(rStream, theString);
USES_CONVERSION;
rs = A2CT(theString.c_str());
return rStream;
}
//*** Modification History ***
// $Log: $
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Real name is Steve Johnson. Programming since 1979. Started on a Heathkit Micro with a DEC LSI-11 and UCSD Pascal. Moved to PCs & DOS as soon as Turbo Pascal became available. Did some Assembly, ISR, TSR etc. All this while working for a Manufacturing Co. for 8 years. Had my own solo Co. doing barcode labeling software for 4 years (terrible business man, all I wanted to do was code). Since then working for various software companies. Moved to Windows around the time of 3.1 with Borland C then C++. Then on to VC++ and MFC, and just about anything I could get my hands on or had to learn for my job, and been at it ever since. Of course recently I've been playing with .NET, ASP, C#, WPF etc.