/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010-2012, Tomasz Sowa * All rights reserved. * */ #include "htmltextstream.h" /* without escaping */ HtmlTextStream & HtmlTextStream::PutText(const char * str) { TextStream::operator<<(str); return *this; } HtmlTextStream & HtmlTextStream::PutText(const char * str, size_t len) { TextStream::operator<<(str); return *this; } HtmlTextStream & HtmlTextStream::PutText(const std::string * str) { return PutText(str->c_str()); } HtmlTextStream & HtmlTextStream::PutText(const std::string & str) { return PutText(str.c_str()); } HtmlTextStream & HtmlTextStream::PutText(const wchar_t * str) { TextStream::operator<<(str); return *this; } HtmlTextStream & HtmlTextStream::PutText(const std::wstring * str) { return PutText(str->c_str()); } HtmlTextStream & HtmlTextStream::PutText(const std::wstring & str) { return PutText(str.c_str()); } HtmlTextStream & HtmlTextStream::operator<<(const RawText & raw) { return PutText(raw.par); } HtmlTextStream & HtmlTextStream::operator<<(const RawText & raw) { return PutText(raw.par); } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { return PutText(raw.par); } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { return PutText(raw.par); } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { return PutText(raw.par); } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { return PutText(raw.par); } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::operator<<(RawText raw) { TextStream::operator<<(raw.par); return *this; } HtmlTextStream & HtmlTextStream::Write(const char * buf, size_t len) { TextStream::Write(buf, len); return *this; } HtmlTextStream & HtmlTextStream::Write(const wchar_t * buf, size_t len) { TextStream::Write(buf, len); return *this; } HtmlTextStream & HtmlTextStream::write(const char * buf, size_t len) { TextStream::write(buf, len); return *this; } HtmlTextStream & HtmlTextStream::write(const wchar_t * buf, size_t len) { TextStream::write(buf, len); return *this; } /* with escaping */ HtmlTextStream & HtmlTextStream::ETextPutChar(char c) { return ETextPutChar(static_cast(c)); } HtmlTextStream & HtmlTextStream::ETextPutChar(wchar_t c) { if( c == '<' ) buffer += L"<"; else if( c == '>' ) buffer += L">"; else if( c == '&' ) buffer += L"&"; else if( c != 0 ) buffer += c; return *this; } HtmlTextStream & HtmlTextStream::EPutText(const char * str) { for( ; *str ; ++str ) ETextPutChar(*str); return *this; } HtmlTextStream & HtmlTextStream::EPutText(const char * str, size_t len) { for(size_t i=0 ; ic_str(), str->size()); } HtmlTextStream & HtmlTextStream::EPutText(const std::string & str) { return EPutText(str.c_str(), str.size()); } HtmlTextStream & HtmlTextStream::EPutText(const wchar_t * str) { for( ; *str ; ++str ) ETextPutChar(*str); return *this; } HtmlTextStream & HtmlTextStream::EPutText(const wchar_t * str, size_t len) { for(size_t i=0 ; ic_str(), str->size()); } HtmlTextStream & HtmlTextStream::EPutText(const std::wstring & str) { return EPutText(str.c_str(), str.size()); } HtmlTextStream & HtmlTextStream::operator<<(const char * str) { return EPutText(str); } HtmlTextStream & HtmlTextStream::operator<<(const std::string * str) { return EPutText(str); } HtmlTextStream & HtmlTextStream::operator<<(const std::string & str) { return EPutText(str); } HtmlTextStream & HtmlTextStream::operator<<(const wchar_t * str) { return EPutText(str); } HtmlTextStream & HtmlTextStream::operator<<(const std::wstring * str) { return EPutText(str); } HtmlTextStream & HtmlTextStream::operator<<(const std::wstring & str) { return EPutText(str); } HtmlTextStream & HtmlTextStream::operator<<(char v) { ETextPutChar(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(wchar_t v) { ETextPutChar(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(int v) { TextStream::operator<<(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(long v) { TextStream::operator<<(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(unsigned int v) { TextStream::operator<<(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(unsigned long v) { TextStream::operator<<(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(double v) { TextStream::operator<<(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(const void * v) { TextStream::operator<<(v); return *this; } HtmlTextStream & HtmlTextStream::operator<<(const tm & t) { buffer += DateToStr(t); // from core/misc return *this; } HtmlTextStream & HtmlTextStream::operator<<(const PT::Space & space) { space_stream.Clear(); // !! IMPROVE ME // we can calculate how many memory is needed beforehand space.Serialize(space_stream, true, false); operator<<(space_stream.Str()); space_stream.Clear(); return *this; } HtmlTextStream & HtmlTextStream::operator<<(const PT::Date & date) { date.Serialize(*this); return *this; }