added: to HtmlTextStream: Escape(bool) method

now the output html streams can be turn into no-escaping mode
       default true (set when a request is clearing)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@990 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-11-06 21:17:41 +00:00
parent 8f8defe0de
commit 0ecb2ac70e
3 changed files with 132 additions and 26 deletions

View File

@@ -137,6 +137,8 @@ public:
HtmlTextStream & operator<<(RawText<unsigned long> raw);
HtmlTextStream & operator<<(RawText<double> raw);
HtmlTextStream & operator<<(RawText<void*> raw);
HtmlTextStream & operator<<(RawText<PT::Space> raw);
HtmlTextStream & operator<<(RawText<PT::Date> raw);
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
HtmlTextStream & operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
@@ -168,6 +170,11 @@ public:
HtmlTextStream & EPutText(const std::wstring * str);
HtmlTextStream & EPutText(const std::wstring & str);
/*
* by default all operator<< shown below use escaping
* but you can turn it off by calling Escape(false)
*/
void Escape(bool escape_characters);
HtmlTextStream & operator<<(const char * str);
HtmlTextStream & operator<<(const std::string * str);
@@ -192,8 +199,9 @@ public:
private:
TextStream<std::wstring> tmp_stream;
//TextStream<std::wstring> tmp_stream;
std::wstring tmp_string;
bool escape;
};
@@ -213,8 +221,18 @@ HtmlTextStream & HtmlTextStream::operator<<(const PT::TextStreamBase<arg_char_ty
{
typename PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
for(i=arg.begin() ; i != arg.end() ; ++i)
ETextPutChar(*i);
if( escape )
{
/*
* warning: char* (utf-8) string will not be correctly handled here
*/
for(i=arg.begin() ; i != arg.end() ; ++i)
ETextPutChar(*i);
}
else
{
TextStream<std::wstring>::operator<<(arg);
}
return *this;
}