WIP: use pt::Stream instead of a template argument
This commit is contained in:
24
src/model.h
24
src/model.h
@@ -81,15 +81,13 @@
|
|||||||
|
|
||||||
#ifdef MORM_HAS_EZC_LIBRARY
|
#ifdef MORM_HAS_EZC_LIBRARY
|
||||||
#define MORM_MODEL_MEMBER_FIELD_EZC(ClassName) \
|
#define MORM_MODEL_MEMBER_FIELD_EZC(ClassName) \
|
||||||
template<typename FunInfoStreamType> \
|
void field(const wchar_t * field_name, void (ClassName::*method)(Ezc::FunInfo &), const morm::FT & field_type = morm::FT::default_type) \
|
||||||
void field(const wchar_t * field_name, void (ClassName::*method)(Ezc::FunInfo<FunInfoStreamType> &), const morm::FT & field_type = morm::FT::default_type) \
|
|
||||||
{ \
|
{ \
|
||||||
field(field_name, field_name, method, field_type); \
|
field(field_name, field_name, method, field_type); \
|
||||||
} \
|
} \
|
||||||
template<typename FunInfoStreamType> \
|
void field(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (ClassName::*method)(Ezc::FunInfo &), const morm::FT & field_type = morm::FT::default_type) \
|
||||||
void field(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (ClassName::*method)(Ezc::FunInfo<FunInfoStreamType> &), const morm::FT & field_type = morm::FT::default_type) \
|
|
||||||
{ \
|
{ \
|
||||||
typedef void (Model::*ModelMember)(Ezc::FunInfo<FunInfoStreamType> &); \
|
typedef void (Model::*ModelMember)(Ezc::FunInfo &); \
|
||||||
ModelMember model_member = static_cast<ModelMember>(method); \
|
ModelMember model_member = static_cast<ModelMember>(method); \
|
||||||
field_member_ezc(db_field_name, flat_field_name, model_member, field_type); \
|
field_member_ezc(db_field_name, flat_field_name, model_member, field_type); \
|
||||||
} \
|
} \
|
||||||
@@ -268,9 +266,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#ifdef MORM_HAS_EZC_LIBRARY
|
#ifdef MORM_HAS_EZC_LIBRARY
|
||||||
template<typename FunInfoStreamType>
|
|
||||||
bool get_raw_value(const wchar_t * db_field_name, const wchar_t * flat_field_name, ModelData * model_data,
|
bool get_raw_value(const wchar_t * db_field_name, const wchar_t * flat_field_name, ModelData * model_data,
|
||||||
Ezc::FunInfo<FunInfoStreamType> & fun_info, pt::Stream & stream, bool clear_stream = true)
|
Ezc::FunInfo & fun_info, pt::Stream & stream, bool clear_stream = true)
|
||||||
{
|
{
|
||||||
if( clear_stream )
|
if( clear_stream )
|
||||||
{
|
{
|
||||||
@@ -304,6 +302,7 @@ public:
|
|||||||
model_env = nullptr;
|
model_env = nullptr;
|
||||||
return model_env_local.was_field_found;
|
return model_env_local.was_field_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -938,8 +937,8 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#ifdef MORM_HAS_EZC_LIBRARY
|
#ifdef MORM_HAS_EZC_LIBRARY
|
||||||
template<typename FunInfoStreamType>
|
|
||||||
void field_member_ezc(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (Model::*method)(Ezc::FunInfo<FunInfoStreamType> &), const FT & field_type)
|
void field_member_ezc(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (Model::*method)(Ezc::FunInfo &), const FT & field_type)
|
||||||
{
|
{
|
||||||
if( model_connector && model_env && model_env->ezc_fun_info && model_env->ezc_fun_info_typeinfo && model_env->model )
|
if( model_connector && model_env && model_env->ezc_fun_info && model_env->ezc_fun_info_typeinfo && model_env->model )
|
||||||
{
|
{
|
||||||
@@ -961,17 +960,16 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename FunInfoStreamType>
|
void field_member_ezc_put_field_value_to_stream(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (Model::*method)(Ezc::FunInfo &), const FT & field_type)
|
||||||
void field_member_ezc_put_field_value_to_stream(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (Model::*method)(Ezc::FunInfo<FunInfoStreamType> &), const FT & field_type)
|
|
||||||
{
|
{
|
||||||
if( (is_empty_field(model_env->db_field_name) || is_the_same_field(db_field_name, model_env->db_field_name)) &&
|
if( (is_empty_field(model_env->db_field_name) || is_the_same_field(db_field_name, model_env->db_field_name)) &&
|
||||||
(is_empty_field(model_env->flat_field_name) || is_the_same_field(flat_field_name, model_env->flat_field_name)) )
|
(is_empty_field(model_env->flat_field_name) || is_the_same_field(flat_field_name, model_env->flat_field_name)) )
|
||||||
{
|
{
|
||||||
model_env->was_field_found = true;
|
model_env->was_field_found = true;
|
||||||
|
|
||||||
if( typeid(Ezc::FunInfo<FunInfoStreamType>) == *model_env->ezc_fun_info_typeinfo )
|
if( typeid(Ezc::FunInfo) == *model_env->ezc_fun_info_typeinfo )
|
||||||
{
|
{
|
||||||
Ezc::FunInfo<FunInfoStreamType> * ezc_fun_info = reinterpret_cast<Ezc::FunInfo<FunInfoStreamType>*>(model_env->ezc_fun_info);
|
Ezc::FunInfo * ezc_fun_info = reinterpret_cast<Ezc::FunInfo*>(model_env->ezc_fun_info);
|
||||||
(model_env->model->*method)(*ezc_fun_info);
|
(model_env->model->*method)(*ezc_fun_info);
|
||||||
model_env->ezc_fun_result = ezc_fun_info->res; // ezc_fun_info->res is overwritten in get_raw_value() after fields() method call so we have to remember it in model_env
|
model_env->ezc_fun_result = ezc_fun_info->res; // ezc_fun_info->res is overwritten in get_raw_value() after fields() method call so we have to remember it in model_env
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user