changed: ModelData moved outside Model
added: using ModelData in BaseExpression so Model::to_text() functions can use a ModelData object now git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1175 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
34
src/model.h
34
src/model.h
@@ -42,6 +42,7 @@
|
||||
#include "dbexpression.h"
|
||||
#include "flatexpression.h"
|
||||
#include "queryresult.h"
|
||||
#include "modeldata.h"
|
||||
|
||||
|
||||
|
||||
@@ -53,25 +54,6 @@ class Model
|
||||
{
|
||||
public:
|
||||
|
||||
class ModelData
|
||||
{
|
||||
public:
|
||||
|
||||
ModelData() {}
|
||||
virtual ~ModelData() {}
|
||||
|
||||
/*
|
||||
* may to add:
|
||||
* std::set<std::wstring> skip_columns;
|
||||
* and Finder can use this
|
||||
* also update and insert from Model
|
||||
* (but what about the same name of columns through the whole objects-tree?
|
||||
* may we can save the name of the table too?)
|
||||
*
|
||||
*
|
||||
*/
|
||||
};
|
||||
|
||||
enum SaveMode
|
||||
{
|
||||
DO_INSERT_ON_SAVE,
|
||||
@@ -115,9 +97,14 @@ public:
|
||||
*/
|
||||
virtual void table_name(PT::TextStream & stream);
|
||||
|
||||
|
||||
virtual void to_text(PT::TextStream & stream, ModelData * model_data = nullptr, bool clear_stream = true);
|
||||
virtual void to_text(PT::TextStream & stream, ModelData & model_data, bool clear_stream = true);
|
||||
virtual void to_text(PT::TextStream & stream, bool clear_stream = true);
|
||||
|
||||
virtual void to_text(std::string & str, ModelData * model_data = nullptr, bool clear_string = true);
|
||||
virtual void to_text(std::string & str, ModelData & model_data, bool clear_string = true);
|
||||
virtual void to_text(std::string & str, bool clear_string = true);
|
||||
|
||||
virtual std::string to_text();
|
||||
virtual std::string to_string();
|
||||
|
||||
@@ -723,6 +710,7 @@ protected:
|
||||
if( model_connector )
|
||||
{
|
||||
field_model.set_connector(model_connector);
|
||||
field_model.model_data = model_data;
|
||||
|
||||
// IMPLEMENTME what about db?
|
||||
if( model_connector_mode == MORM_MODEL_CONNECTOR_MODE_GENERATING_FLAT_STRING )
|
||||
@@ -768,6 +756,8 @@ protected:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field_model.model_data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +781,7 @@ protected:
|
||||
// IMPROVE ME
|
||||
// what about model_data and save_mode?
|
||||
// may it should be placed inside some structure?
|
||||
flat_expression->field_list(flat_field_name, field_container, insertable, updatable, is_primary_key, model_connector, model_connector_mode);
|
||||
flat_expression->field_list(flat_field_name, field_container, insertable, updatable, is_primary_key, model_connector, model_connector_mode, model_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -818,7 +808,7 @@ protected:
|
||||
if( doc_expression && !is_empty_field(flat_field_name) )
|
||||
{
|
||||
// insertable, updatable and is_primary_key are ignored here
|
||||
doc_expression->field_doc(*this, flat_field_name, field_container, insertable, updatable, is_primary_key);
|
||||
doc_expression->field_doc(*this, flat_field_name, field_container, insertable, updatable, is_primary_key, model_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user