added "roman" and "no_sec" parameters when serializing a date

This commit is contained in:
Tomasz Sowa 2021-07-06 21:47:42 +02:00
parent 995cccdace
commit b9b9a881e0
1 changed files with 11 additions and 4 deletions

View File

@ -1305,10 +1305,10 @@ void Generator<StreamType>::DumpModelIfNeeded(morm::Model & model, std::vector<V
template<class StreamType>
void Generator<StreamType>::PrintDate(pt::Date * date, std::vector<Var> parameters, StreamType & out_stream)
{
// IMPROVEME
// check for different formats depending on parameters
bool is_roman = HasParam(parameters, L"roman");
bool is_no_sec = HasParam(parameters, L"no_sec");
date->Serialize(out_stream);
date->Serialize(out_stream, is_roman, !is_no_sec);
}
@ -1326,7 +1326,14 @@ bool Generator<StreamType>::PrintDatePart(pt::Date * date, const std::wstring &
if( field == L"month" )
{
if( !is_test )
out_stream << date->month;
{
bool is_roman = HasParam(parameters, L"roman");
if( is_roman )
pt::Date::SerializeMonthAsRoman(out_stream, date->month);
else
out_stream << date->month;
}
}
else
if( field == L"day" )