changed: added two new parameters to Generator class: template<class StreamType, bool is_pikotools_stream = false, bool is_autoescape_stream = false> class Generator
changed: added one new parameter to Outstreams class: template<class StreamType, bool is_pikotools_stream = false> class OutStreams removed macros: EZC_GENERATOR_HAS_PT_STREAM, EZC_GENERATOR_HAS_WINIX_STREAM
This commit is contained in:
parent
ae6a5c52a1
commit
44407c2a4b
560
src/generator.h
560
src/generator.h
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015, Tomasz Sowa
|
||||
* Copyright (c) 2015-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,7 +47,7 @@ namespace Ezc
|
|||
{
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
template<class StreamType, bool is_pikotools_stream = false>
|
||||
class OutStreams
|
||||
{
|
||||
public:
|
||||
|
@ -65,36 +65,35 @@ public:
|
|||
|
||||
~OutStreams();
|
||||
OutStreams();
|
||||
OutStreams(const OutStreams<StreamType> & o);
|
||||
OutStreams<StreamType> & operator=(const OutStreams<StreamType> & o);
|
||||
OutStreams(const OutStreams & o);
|
||||
OutStreams & operator=(const OutStreams & o);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
OutStreams<StreamType>::~OutStreams()
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
OutStreams<StreamType, is_pikotools_stream>::~OutStreams()
|
||||
{
|
||||
ClearTab();
|
||||
}
|
||||
|
||||
template<class StreamType>
|
||||
OutStreams<StreamType>::OutStreams()
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
OutStreams<StreamType, is_pikotools_stream>::OutStreams()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
OutStreams<StreamType>::OutStreams(const OutStreams<StreamType> & o)
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
OutStreams<StreamType, is_pikotools_stream>::OutStreams(const OutStreams<StreamType, is_pikotools_stream> & o)
|
||||
{
|
||||
// we do not copy streams but creating new ones
|
||||
ResizeTab(o.streams_tab.size());
|
||||
}
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
OutStreams<StreamType> & OutStreams<StreamType>::operator=(const OutStreams<StreamType> & o)
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
OutStreams<StreamType, is_pikotools_stream> & OutStreams<StreamType, is_pikotools_stream>::operator=(const OutStreams<StreamType, is_pikotools_stream> & o)
|
||||
{
|
||||
// we do not copy streams but creating new ones
|
||||
streams_map.clear();
|
||||
|
@ -104,8 +103,8 @@ return *this;
|
|||
}
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
void OutStreams<StreamType>::ClearTab()
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
void OutStreams<StreamType, is_pikotools_stream>::ClearTab()
|
||||
{
|
||||
for(size_t i=0 ; i<streams_tab.size() ; ++i)
|
||||
delete streams_tab[i];
|
||||
|
@ -115,8 +114,8 @@ void OutStreams<StreamType>::ClearTab()
|
|||
}
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
void OutStreams<StreamType>::ResizeTab(size_t len)
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
void OutStreams<StreamType, is_pikotools_stream>::ResizeTab(size_t len)
|
||||
{
|
||||
if( streams_tab.size() != len )
|
||||
{
|
||||
|
@ -141,8 +140,8 @@ void OutStreams<StreamType>::ResizeTab(size_t len)
|
|||
}
|
||||
|
||||
|
||||
template<class StreamType>
|
||||
void OutStreams<StreamType>::ClearMap()
|
||||
template<class StreamType, bool is_pikotools_stream>
|
||||
void OutStreams<StreamType, is_pikotools_stream>::ClearMap()
|
||||
{
|
||||
typename StreamsMap::iterator i;
|
||||
|
||||
|
@ -150,12 +149,14 @@ void OutStreams<StreamType>::ClearMap()
|
|||
{
|
||||
StreamType & str = *(i->second);
|
||||
|
||||
#ifdef EZC_GENERATOR_HAS_PT_STREAM
|
||||
if constexpr(is_pikotools_stream)
|
||||
{
|
||||
str.clear();
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
str.str(L"");
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
streams_map.clear();
|
||||
|
|
Loading…
Reference in New Issue