let filters make use of Var<> objects

This commit is contained in:
Tomasz Sowa 2021-11-06 19:20:11 +01:00
parent e2a8729a2f
commit 2f140686d7
1 changed files with 11 additions and 3 deletions

View File

@ -267,7 +267,7 @@ private:
// as std::wostringstream are not copyable
std::vector<StreamType*> filter_tab;
std::vector<StreamType*> ezc_frame_stack_tab;
const StreamType empty_stream;
StreamType empty_stream;
// temporary streams used in [if..] [for...] or [def ...]
// or if output_stream is null and an ezc function should be called
@ -391,7 +391,7 @@ private:
bool Call(Item::Function & item_fun,
const std::wstring * fun_name,
Var<StreamType> & result,
const StreamType & in_stream);
StreamType & in_stream);
bool Call(Item::Function & item_fun, Var<StreamType> & result);
@ -2083,7 +2083,7 @@ bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::Call(
Item::Function & item_fun,
const std::wstring * fun_name,
Var<StreamType> & result,
const StreamType & in_stream)
StreamType & in_stream)
{
//FindHelperOld find_helper;
std::vector<Var<StreamType>> parameters;
@ -2124,6 +2124,7 @@ std::vector<Var<StreamType>> parameters;
if( fun_child.is_function )
{
empty_stream.clear();
Call(fun_child, nullptr, parameters[i], empty_stream);
}
else
@ -2134,6 +2135,8 @@ std::vector<Var<StreamType>> parameters;
}
Var<StreamType> empty_input; // fix me for filters
empty_input.type = Var<StreamType>::TYPE_STREAM;
empty_input.stream = in_stream; // IMPROVEME don't copy here streams, let Var::stream be a pointer?
FindHelper find_helper(*name, item_fun.fields, parameters);
find_helper.result = &result;
@ -2150,6 +2153,7 @@ template<class StreamType, bool is_pikotools_stream, bool is_autoescape_stream>
bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::Call(Item::Function & item_fun, Var<StreamType> & result)
{
//return Call(item_fun, nullptr, stream_temp1, true, result, empty_stream);
empty_stream.clear();
return Call(item_fun, nullptr, result, empty_stream);
}
@ -2533,6 +2537,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeTextF
else
{
Var<StreamType> result;
empty_stream.clear();
if( Call(item.function, nullptr, result, empty_stream) )
{
@ -2666,6 +2671,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeTextF
else
{
//Call(item.function, nullptr, stream_temp1, true, result, empty_stream);
empty_stream.clear();
Call(item.function, nullptr, result, empty_stream);
}
@ -2703,6 +2709,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeTextD
{
// call function
//if( Call(fun, nullptr, stream_temp_define, true, var, empty_stream) )
empty_stream.clear();
if( Call(fun, nullptr, var, empty_stream) )
{
//CopyStreamToString(stream_temp_define, var.str);
@ -2975,6 +2982,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeTextR
// this Call() sets last_res which is used later when we return to CallBlock()
//Call(item.function, nullptr, stream_temp1, false, result, empty_stream);
//ClearStream(stream_temp1);
empty_stream.clear();
Call(item.function, nullptr, result, empty_stream);
}
}