fixed: a 'typename' keywords were missing in some places
fixed: removed GetStringFromStream() method it returns a reference to a local object (from stream.str()) now the code is used directly git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@972 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
429021f687
commit
00f8af232b
|
@ -64,7 +64,7 @@ public:
|
||||||
void Insert(const wchar_t * key, UserFunction ufunction);
|
void Insert(const wchar_t * key, UserFunction ufunction);
|
||||||
void Insert(const std::wstring & key, UserFunction ufunction);
|
void Insert(const std::wstring & key, UserFunction ufunction);
|
||||||
|
|
||||||
typename Iterator Find(const std::wstring & key);
|
Iterator Find(const std::wstring & key);
|
||||||
|
|
||||||
Iterator Begin();
|
Iterator Begin();
|
||||||
Iterator End();
|
Iterator End();
|
||||||
|
|
|
@ -229,7 +229,6 @@ private:
|
||||||
CharType ToLower(CharType c);
|
CharType ToLower(CharType c);
|
||||||
|
|
||||||
bool AreStreamsEqual(StreamType & str1, StreamType & str2);
|
bool AreStreamsEqual(StreamType & str1, StreamType & str2);
|
||||||
const std::wstring & GetStringFromStream(StreamType & str);
|
|
||||||
|
|
||||||
bool FindInCache(const Item::Function & item_fun,
|
bool FindInCache(const Item::Function & item_fun,
|
||||||
typename Functions<StreamType>::UserFunction ** function,
|
typename Functions<StreamType>::UserFunction ** function,
|
||||||
|
@ -568,18 +567,6 @@ bool Generator<StreamType>::AreStreamsEqual(StreamType & str1, StreamType & str2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StreamType>
|
|
||||||
const std::wstring & Generator<StreamType>::GetStringFromStream(StreamType & stream)
|
|
||||||
{
|
|
||||||
#ifdef EZC_HAS_SPECIAL_STREAM
|
|
||||||
const std::wstring & str = stream.Str();
|
|
||||||
#else
|
|
||||||
const std::wstring & str = stream.str();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StreamType>
|
template<class StreamType>
|
||||||
void Generator<StreamType>::SetMax(size_t max_items_, size_t max_for_items_)
|
void Generator<StreamType>::SetMax(size_t max_items_, size_t max_for_items_)
|
||||||
|
@ -767,7 +754,7 @@ bool Generator<StreamType>::FindInFunctionsAndBlocks(const std::wstring & name,
|
||||||
{
|
{
|
||||||
if( pfunctions )
|
if( pfunctions )
|
||||||
{
|
{
|
||||||
Functions<StreamType>::Iterator i = pfunctions->Find(name);
|
typename Functions<StreamType>::Iterator i = pfunctions->Find(name);
|
||||||
|
|
||||||
if( i != pfunctions->End() )
|
if( i != pfunctions->End() )
|
||||||
{
|
{
|
||||||
|
@ -911,7 +898,13 @@ bool Generator<StreamType>::CallBlock(Item & item_block,
|
||||||
|
|
||||||
MakeText(item_block);
|
MakeText(item_block);
|
||||||
|
|
||||||
const std::wstring & str = GetStringFromStream(*output_stream);
|
#ifdef EZC_HAS_SPECIAL_STREAM
|
||||||
|
const std::wstring & str = output_stream->Str();
|
||||||
|
#else
|
||||||
|
const std::wstring & str = output_stream->str();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
out_stream << str;
|
out_stream << str;
|
||||||
last_res = !str.empty();
|
last_res = !str.empty();
|
||||||
|
|
||||||
|
@ -949,7 +942,13 @@ std::wstring * variable;
|
||||||
Call(fun_child, local_temp_stream, true, empty_stream);
|
Call(fun_child, local_temp_stream, true, empty_stream);
|
||||||
|
|
||||||
if( fun || item_block )
|
if( fun || item_block )
|
||||||
fun_child.par = GetStringFromStream(local_temp_stream);
|
{
|
||||||
|
#ifdef EZC_HAS_SPECIAL_STREAM
|
||||||
|
fun_child.par = local_temp_stream.Str();
|
||||||
|
#else
|
||||||
|
fun_child.par = local_temp_stream.str();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// the stream has to be cleared when we finished
|
// the stream has to be cleared when we finished
|
||||||
ClearStream(local_temp_stream);
|
ClearStream(local_temp_stream);
|
||||||
|
@ -1178,7 +1177,12 @@ return res;
|
||||||
template<class StreamType>
|
template<class StreamType>
|
||||||
void Generator<StreamType>::WriteTmpStreamToStreams()
|
void Generator<StreamType>::WriteTmpStreamToStreams()
|
||||||
{
|
{
|
||||||
const std::wstring & str = GetStringFromStream(output_tmp_stream);
|
#ifdef EZC_HAS_SPECIAL_STREAM
|
||||||
|
const std::wstring & str = output_tmp_stream.Str();
|
||||||
|
#else
|
||||||
|
const std::wstring & str = output_tmp_stream.str();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if( !str.empty() )
|
if( !str.empty() )
|
||||||
{
|
{
|
||||||
|
@ -1590,7 +1594,12 @@ void Generator<StreamType>::MakeTextDefine(Item & item)
|
||||||
// it is [def name [function]]
|
// it is [def name [function]]
|
||||||
if( Call(*item.functions[0].parameters[0], stream_temp_define, true, empty_stream) )
|
if( Call(*item.functions[0].parameters[0], stream_temp_define, true, empty_stream) )
|
||||||
{
|
{
|
||||||
const std::wstring & str = GetStringFromStream(stream_temp_define);
|
#ifdef EZC_HAS_SPECIAL_STREAM
|
||||||
|
const std::wstring & str = stream_temp_define.Str();
|
||||||
|
#else
|
||||||
|
const std::wstring & str = stream_temp_define.str();
|
||||||
|
#endif
|
||||||
|
|
||||||
pvars->Insert(item.functions[0].name, Vars::variable_string, str);
|
pvars->Insert(item.functions[0].name, Vars::variable_string, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ void Item::CacheFunctions(Functions<StreamType> & fun)
|
||||||
{
|
{
|
||||||
for(size_t f=0; f < functions.size() ; ++f)
|
for(size_t f=0; f < functions.size() ; ++f)
|
||||||
{
|
{
|
||||||
Functions<StreamType>::Iterator i = fun.Find(functions[f].name);
|
typename Functions<StreamType>::Iterator i = fun.Find(functions[f].name);
|
||||||
|
|
||||||
if( i != fun.End() )
|
if( i != fun.End() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue