/*
	StyledTextToHtmlAdapter.h
*/
#ifndef STYLED_TEXT_TO_ADAPTER
#define STYLED_TEXT_TO_ADAPTER
#include <DataIO.h>
#include <TextView.h>
	
class StyledTextToHtmlAdapter : public BDataIO {
	public:
								StyledTextToHtmlAdapter(BDataIO *source, text_run_array *textRun, bool owning = true);
		virtual					~StyledTextToHtmlAdapter();
	
		virtual	ssize_t			Read(void *buffer, size_t size);
		virtual ssize_t			Write(const void *buffer, size_t size);
	
	private:
		ssize_t					GenerateHtmlBlock();
		inline void				WriteToStream(BMallocIO &stream, const char *str);
		
		BDataIO *fSource;
		BMallocIO fHtmlSource;
		text_run_array *fTextRun;
		bool fOwning;
};


#endif