- added to FunctionBase: bool register_default_models (default true)

if true then winix will add default models for ezc templates such as "request", "item", etc.
- some methods from templates/item.cpp moved to Item
This commit is contained in:
2021-06-20 18:04:50 +02:00
parent e7c7324058
commit 79eda7abb0
21 changed files with 271 additions and 83 deletions

View File

@@ -94,6 +94,11 @@ public:
void Str(const StringType & str);
void Str(const StringType && str);
void to_str(std::string & str, bool clear_string = true) const;
void to_str(std::wstring & str, bool clear_string = true) const;
void to_string(std::string & str, bool clear_string = true) const;
void to_string(std::wstring & str, bool clear_string = true) const;
CharType operator[](size_t index);
TextStream & operator<<(const char * str);
@@ -115,6 +120,8 @@ public:
TextStream & operator<<(const pt::Space & space);
TextStream & operator<<(const pt::Date & date);
TextStream & operator<<(const TextStream & stream);
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
TextStream & operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
@@ -233,10 +240,59 @@ void TextStream<StringType>::Str(const StringType & str)
template<class StringType>
void TextStream<StringType>::Str(const StringType && str)
{
buffer = str;
buffer = std::move(str);
}
template<class StringType>
void TextStream<StringType>::to_str(std::string & str, bool clear_string) const
{
return to_string(str, clear_string);
}
template<class StringType>
void TextStream<StringType>::to_str(std::wstring & str, bool clear_string) const
{
return to_string(str, clear_string);
}
template<class StringType>
void TextStream<StringType>::to_string(std::string & str, bool clear_string) const
{
if( clear_string )
str.clear();
if constexpr (sizeof(typename StringType::value_type) == sizeof(char))
{
str.append(buffer);
}
else
{
pt::wide_to_utf8(buffer, str, false);
}
}
template<class StringType>
void TextStream<StringType>::to_string(std::wstring & str, bool clear_string) const
{
if( clear_string )
str.clear();
if constexpr (sizeof(typename StringType::value_type) == sizeof(wchar_t))
{
str.append(buffer);
}
else
{
pt::utf8_to_wide(buffer, str, false);
}
}
template<class StringType>
typename TextStream<StringType>::CharType TextStream<StringType>::operator[](size_t index)
@@ -455,6 +511,19 @@ return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const TextStream<StringType> & stream)
{
buffer.append(stream.buffer);
return *this;
}
template<class StringType>
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
TextStream<StringType> & TextStream<StringType>::operator<<(