WIP: add a Val struct as an input/output when calling a function
This commit is contained in:
57
src/model.h
57
src/model.h
@@ -110,16 +110,6 @@
|
||||
typedef bool (Model::*ModelMember)() const; \
|
||||
ModelMember model_member = static_cast<ModelMember>(method); \
|
||||
field_member_ezc(db_field_name, flat_field_name, model_member, field_type); \
|
||||
} \
|
||||
void field(const wchar_t * field_name, void (ClassName::*method)(Ezc::Val &), const morm::FT & field_type = morm::FT::default_type) \
|
||||
{ \
|
||||
field(field_name, field_name, method, field_type); \
|
||||
} \
|
||||
void field(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (ClassName::*method)(Ezc::Val &), const morm::FT & field_type = morm::FT::default_type) \
|
||||
{ \
|
||||
typedef void (Model::*ModelMember)(Ezc::Val &); \
|
||||
ModelMember model_member = static_cast<ModelMember>(method); \
|
||||
field_member_ezc(db_field_name, flat_field_name, model_member, field_type); \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -977,11 +967,11 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
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)) )
|
||||
{
|
||||
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_PUT_FIELD_RAW_VALUE_TO_STREAM )
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_PUT_FIELD_RAW_VALUE_TO_STREAM )
|
||||
{
|
||||
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)) )
|
||||
{
|
||||
model_env->was_field_found = true;
|
||||
|
||||
@@ -1000,8 +990,12 @@ protected:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_GET_EZC_VAL )
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_GET_EZC_VAL )
|
||||
{
|
||||
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)) )
|
||||
{
|
||||
model_env->was_field_found = true;
|
||||
model_env->ezc_val.set_pointer_to(model_env->model, method);
|
||||
@@ -1079,39 +1073,6 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
void field_member_ezc(const wchar_t * db_field_name, const wchar_t * flat_field_name, void (Model::*method)(Ezc::Val & val), const FT & field_type)
|
||||
{
|
||||
if( model_connector && model_env && model_env->model )
|
||||
{
|
||||
if( field_type.is_primary_key() )
|
||||
{
|
||||
pt::Log * plog = model_connector->get_logger();
|
||||
|
||||
if( plog )
|
||||
{
|
||||
(*plog) << pt::Log::log1 << "Morm: an ezc method cannot be used as a primary key" << pt::Log::logend;
|
||||
}
|
||||
}
|
||||
|
||||
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)) )
|
||||
{
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_PUT_FIELD_RAW_VALUE_TO_STREAM )
|
||||
{
|
||||
model_env->was_field_found = true;
|
||||
(model_env->model->*method)(model_env->ezc_val);
|
||||
|
||||
// may if the method evaluates to a POD type then we should put such value to the stream?
|
||||
}
|
||||
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_GET_EZC_VAL )
|
||||
{
|
||||
model_env->ezc_val.set_pointer_to(model_env->model, method);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user