Click here to Skip to main content
15,894,337 members
Articles / Desktop Programming / ATL

Streaming IPicture to Compound Document file

Rate me:
Please Sign up or sign in to vote.
4.76/5 (9 votes)
28 Oct 20011 min read 112.2K   3K   53  
Serialization of IPicture object
// IStream.h: interface for the CIStream class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ISTREAM_H__9C373D6E_F164_4945_A514_C056C96E720B__INCLUDED_)
#define AFX_ISTREAM_H__9C373D6E_F164_4945_A514_C056C96E720B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <atlbase.h>

class CIStream  
{
public:
	CIStream(LPSTREAM lpStream);
	virtual ~CIStream();

	bool IsBad();
	bool IsOk();
	HRESULT Result();
	void ClearError();

	CIStream& operator<<(CComVariant& from);
	CIStream& operator<<(CString& from);
	CIStream& operator<<(long from);
	CIStream& operator<<(BYTE from);
	CIStream& operator<<(short from);
	CIStream& operator<<(int from);
	CIStream& operator<<(float from);
	CIStream& operator<<(double from);
	CIStream& operator<<(bool from);
	CIStream& operator<<(CRect from);
	

	CIStream& operator>>(CComVariant& to);
	CIStream& operator>>(CString& to);
	CIStream& operator>>(long& to);
	CIStream& operator>>(BYTE& to);
	CIStream& operator>>(short& to);
	CIStream& operator>>(int& to);
	CIStream& operator>>(float& to);
	CIStream& operator>>(double& to);
	CIStream& operator>>(bool& to);
	CIStream& operator>>(CRect& to);
	
	

protected:

	LPSTREAM	m_lpStream;
	HRESULT		m_hr;

};

inline
HRESULT CIStream::Result()
{
	return m_hr;
}
inline
bool CIStream::IsOk()
{
	return SUCCEEDED(m_hr);
}

inline
bool CIStream::IsBad()
{
	return FAILED(m_hr);
}
inline
void CIStream::ClearError()
{
	m_hr = S_OK;
}


#endif // !defined(AFX_ISTREAM_H__9C373D6E_F164_4945_A514_C056C96E720B__INCLUDED_)

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions