#if !defined OUTPUTCOMEDITORSTREAM_H_KABASICCLASSES
#define OUTPUTCOMEDITORSTREAM_H_KABASICCLASSES

// Machine generated IDispatch wrapper class(es) created with ClassWizard
/////////////////////////////////////////////////////////////////////////////
// IOutputCOMEditor wrapper class

class IOutputCOMEditor : public COleDispatchDriver
{
public:
	IOutputCOMEditor() {}		// Calls COleDispatchDriver default constructor
	IOutputCOMEditor(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
	IOutputCOMEditor(const IOutputCOMEditor& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}

// Attributes
public:

// Operations
public:
	void ShowWindow();
	void AddText(LPCTSTR text);
	long GetCursorPosition();
	void SetCursorAtPosition(long position);
	long GetMaximalCursorPosition();
	void SetCursorAtStart();
	void SetCursorAtEnd();
	void MoveCursorBy(long offset);
	void EndLine();
};

#include <BasicClasses\Include\EditorOutputStream.h>

namespace kaBasicClasses {

class OutputCOMEditorStreamBuffer: public EditorOutputStreamBuffer {
protected:
	const int theBufferSize;
	typedef char charType;
	typedef std::vector<charType> bufferType;
	bufferType theBuffer;
	void insertText(charType*);
	IOutputCOMEditor theEditor;
public:
	OutputCOMEditorStreamBuffer();
	virtual ~OutputCOMEditorStreamBuffer();
	int flush();
	int getCursorPosition();
	int getMaximalCursorPosition();
	void setCursorAtPosition( int );
	void setCursorAtBeginning();
	void setCursorAtEnd();
	void moveCursorBy( int pos );
protected:
	virtual int_type overflow( int_type c );
	friend class OutputCOMEditorStream;
};

class OutputCOMEditorStream: public EditorOutputStream {
public:
	OutputCOMEditorStream() : EditorOutputStream(new OutputCOMEditorStreamBuffer) {}
	~OutputCOMEditorStream() { delete theBuffer; }
	inline virtual int getCursorPosition() { return ((OutputCOMEditorStreamBuffer *)theBuffer)->getCursorPosition(); }
	inline virtual int getMaximalCursorPosition() { return ((OutputCOMEditorStreamBuffer *)theBuffer)->getMaximalCursorPosition(); }
	inline virtual void setCursorAtPosition( int pos ) { ((OutputCOMEditorStreamBuffer *)theBuffer)->setCursorAtPosition(pos); }
	inline virtual void setCursorAtStart() { ((OutputCOMEditorStreamBuffer *)theBuffer)->setCursorAtBeginning(); }
	inline virtual void setCursorAtEnd() { ((OutputCOMEditorStreamBuffer *)theBuffer)->setCursorAtEnd(); }
	inline virtual void moveCursorBy( int pos ) { ((OutputCOMEditorStreamBuffer *)theBuffer)->moveCursorBy(pos); }
};

extern OutputCOMEditorStream* DumpStreamPtr;

class DumpStreamController {
public:
	void create() { DumpStreamPtr=new OutputCOMEditorStream; }
	void destroy() { delete DumpStreamPtr; }
};

#define dumpStream (*DumpStreamPtr)

}; //kaBasicClasses




#endif //OUTPUTCOMEDITORSTREAM_H_KABASICCLASSES

Hosted by www.Geocities.ws

1