Click here to Skip to main content
15,885,869 members
Articles / Programming Languages / C++

IOStream Inserters And Extractors

Rate me:
Please Sign up or sign in to vote.
4.29/5 (9 votes)
16 Apr 20027 min read 83.4K   968   23  
Showing how to extend iostreams in order to stream custom types
// IOStreamInsertersView.h : interface of the CIOStreamInsertersView class
//


#pragma once

class CIOStreamInsertersCntrItem;

class CIOStreamInsertersView : public CRichEditView
{
protected: // create from serialization only
	CIOStreamInsertersView();
	DECLARE_DYNCREATE(CIOStreamInsertersView)

// Attributes
public:
	CIOStreamInsertersDoc* GetDocument() const;

// Operations
public:

// Overrides
	public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);

// Implementation
public:
	virtual ~CIOStreamInsertersView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	bool m_bOverflow;
// Generated message map functions
protected:
	afx_msg void OnDestroy();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnEnMaxtext();

	void InsertString (CString s, bool bAdd = true);

	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
};

#ifndef _DEBUG  // debug version in IOStreamInsertersView.cpp
inline CIOStreamInsertersDoc* CIOStreamInsertersView::GetDocument() const
   { return reinterpret_cast<CIOStreamInsertersDoc*>(m_pDocument); }
#endif

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)
Australia Australia
Programming computers ( self taught ) since about 1984 when I bought my first Apple ][. Was working on a GUI library to interface Win32 to Python, and writing graphics filters in my spare time, and then building n-tiered apps using asp, atl and asp.net in my job at Dytech. After 4 years there, I've started working from home, at first for Code Project and now for a vet telemedicine company. I owned part of a company that sells client education software in the vet market, but we sold that and I worked for the owners for five years before leaving to get away from the travel, and spend more time with my family. I now work for a company here in Hobart, doing all sorts of Microsoft based stuff in C++ and C#, with a lot of T-SQL in the mix.

Comments and Discussions