Compare commits

...

10 Commits

Author SHA1 Message Date
Tomasz Sowa c31c7dfb63 make depend 2022-04-26 23:48:00 +02:00
Tomasz Sowa 0c058d4313 added to Models: ModelsMap & GetMap() 2021-10-12 19:56:59 +02:00
Tomasz Sowa d8692f6ed5 added options: "index" and "index-one" for space tables e.g. [table_name "index-one"] 2021-09-23 14:03:26 +02:00
Tomasz Sowa b047a10e8d added: "this" virtual field for a table - only if the next field is not an object
e.g.:
       [for space_object]
       	    [space_object.this] instead of [space_object "current"]
       [end]
       "this" can be nested, e.g. if we have two nested tables:
       [for space_object]
          [for space_object.this]
             [space_object.this.this]
          [end]
       [end]

removed: "current" parameter for tables
2021-09-23 04:02:34 +02:00
Tomasz Sowa a983698e3d Generator: some methods take std::vector<Var> parameters not through a reference 2021-08-17 17:33:51 +02:00
Tomasz Sowa 6a8cb019f5 added parameters "only_date" and "only_time" when printing a pt::Date 2021-08-14 19:40:05 +02:00
Tomasz Sowa b0afdf7f0f check block arguments e.g. [1] at the beginning - before all other lookups 2021-08-14 17:44:11 +02:00
Tomasz Sowa b956f1c401 fixed: fields table was not copied in Item::Function::operator=(...) 2021-08-14 17:40:40 +02:00
Tomasz Sowa 5e47313af8 fixed: when incrementing space tables iterators in [for] statements we should invalidate indices for nested tables 2021-08-13 21:44:07 +02:00
Tomasz Sowa 44407c2a4b 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
2021-07-12 23:00:11 +02:00
6 changed files with 368 additions and 331 deletions

View File

@ -30,6 +30,7 @@ patternparser.o: ../../pikotools/src/convert/inttostr.h
patternparser.o: ../../pikotools/src/date/date.h
patternparser.o: ../../pikotools/src/membuffer/membuffer.h
patternparser.o: ../../pikotools/src/textstream/types.h
patternparser.o: ../../pikotools/src/utf8/utf8_stream.h
patternparser.o: ../../pikotools/src/log/filelog.h
patternparser.o: ../../pikotools/src/convert/convert.h
patternparser.o: ../../pikotools/src/convert/inttostr.h

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,8 @@ struct Item
{
is_function = f.is_function;
name = f.name;
fields = f.fields;
postfix = f.postfix;
fun_cache = f.fun_cache;
item_block = f.item_block;
base_obj = f.base_obj;

View File

@ -125,6 +125,12 @@ morm::Wrapper * Models::Find(const std::wstring & name)
}
Models::ModelsMap & Models::GetMap()
{
return models_map;
}
}

View File

@ -53,6 +53,8 @@ class Models
{
public:
typedef std::map<std::wstring, morm::Wrapper> ModelsMap;
Models();
~Models();
@ -130,12 +132,13 @@ public:
}
morm::Wrapper * Find(const std::wstring & name);
ModelsMap & GetMap();
void Clear();
protected:
std::map<std::wstring, morm::Wrapper> models_map;
ModelsMap models_map;
};

View File

@ -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();