fixed in Model::field_generic_put_raw_value_to_stream() - a boolean status for ezc was not set

added to Model:
- method field() which can take a pointer to a member which returns bool:
  void field(const wchar_t * field_name, bool (ClassName::*method)(), const morm::FT & field_type = morm::FT::default_type)
- method field() which can take a pointer to a member which can set morm::ModelWrapper object
  void field(const wchar_t * field_name, void (ClassName::*method)(morm::ModelWrapper **), const morm::FT & field_type = morm::FT::default_type)
- methods: bool Model::convert_to_bool(...) - they are used for creating a result for ezc from local fields
This commit is contained in:
2021-06-18 19:05:50 +02:00
parent 5cf55ecce3
commit 9a142548d0
4 changed files with 278 additions and 9 deletions

View File

@@ -1909,5 +1909,129 @@ void Model::field_member(
bool Model::convert_to_bool(char v)
{
return v != 0;
}
bool Model::convert_to_bool(unsigned char v)
{
return v != 0;
}
bool Model::convert_to_bool(wchar_t v)
{
return v != 0;
}
bool Model::convert_to_bool(const std::wstring & str)
{
return !str.empty();
}
bool Model::convert_to_bool(const wchar_t * str)
{
return str != nullptr && *str != 0;
}
bool Model::convert_to_bool(const std::string & str)
{
return !str.empty();
}
bool Model::convert_to_bool(const char * str)
{
return str != nullptr && *str != 0;
}
bool Model::convert_to_bool(bool v)
{
return v;
}
bool Model::convert_to_bool(short v)
{
return v != 0;
}
bool Model::convert_to_bool(unsigned short v)
{
return v != 0;
}
bool Model::convert_to_bool(int v)
{
return v != 0;
}
bool Model::convert_to_bool(unsigned int v)
{
return v != 0;
}
bool Model::convert_to_bool(long v)
{
return v != 0;
}
bool Model::convert_to_bool(unsigned long v)
{
return v != 0;
}
bool Model::convert_to_bool(long long v)
{
return v != 0;
}
bool Model::convert_to_bool(unsigned long long v)
{
return v != 0;
}
bool Model::convert_to_bool(float v)
{
return v != 0;
}
bool Model::convert_to_bool(double v)
{
return v != 0;
}
bool Model::convert_to_bool(long double v)
{
return v != 0;
}
bool Model::convert_to_bool(const pt::Date & date)
{
return false;
}
bool Model::convert_to_bool(const pt::TextStream & val)
{
return false;
}
bool Model::convert_to_bool(const pt::WTextStream & val)
{
return false;
}
bool Model::convert_to_bool(const pt::Space & space)
{
return false;
}
} // namespace