I forget to add modified files to previous commit
(added support for Space tables, removed Models class)
This commit is contained in:
parent
c2c12d55d0
commit
943026a3ac
|
@ -25,7 +25,6 @@ cache.o: ../../pikotools/src/textstream/types.h
|
|||
cache.o: ../../pikotools/src/membuffer/membuffer.h
|
||||
cache.o: ../../pikotools/src/textstream/types.h objects.h blocks.h
|
||||
item.o: item.h
|
||||
models.o: models.h
|
||||
pattern.o: pattern.h item.h cache.h functions.h
|
||||
pattern.o: ../../pikotools/src/utf8/utf8.h
|
||||
pattern.o: ../../pikotools/src/textstream/stream.h
|
||||
|
|
|
@ -1 +1 @@
|
|||
o = blocks.o cache.o item.o models.o pattern.o patternparser.o var.o
|
||||
o = blocks.o cache.o item.o pattern.o patternparser.o var.o
|
161
src/generator.h
161
src/generator.h
|
@ -48,7 +48,6 @@
|
|||
#include "objects.h"
|
||||
#include "outstreams.h"
|
||||
#include "expressionparser.h"
|
||||
#include "models.h"
|
||||
#include "log/log.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "vars.h"
|
||||
|
@ -84,7 +83,7 @@ public:
|
|||
void SetLogger(pt::Log & logger);
|
||||
|
||||
#ifdef EZC_HAS_MORM_LIBRARY
|
||||
void SetModels(Models & models);
|
||||
//void SetModels(Models & models);
|
||||
#endif
|
||||
|
||||
void SetMax(size_t max_items_, size_t max_for_items_);
|
||||
|
@ -235,7 +234,7 @@ private:
|
|||
|
||||
|
||||
#ifdef EZC_HAS_MORM_LIBRARY
|
||||
Models * pmodels;
|
||||
//Models * pmodels;
|
||||
#endif
|
||||
Vars<StreamType> * pvars;
|
||||
|
||||
|
@ -469,7 +468,7 @@ Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::Generator() :
|
|||
plog = nullptr;
|
||||
|
||||
#ifdef EZC_HAS_MORM_LIBRARY
|
||||
pmodels = nullptr;
|
||||
//pmodels = nullptr;
|
||||
#endif
|
||||
|
||||
max_items = 50000;
|
||||
|
@ -506,7 +505,7 @@ Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::operator=(cons
|
|||
plog = n.plog;
|
||||
|
||||
#ifdef EZC_HAS_MORM_LIBRARY
|
||||
pmodels = n.pmodels;
|
||||
//pmodels = n.pmodels;
|
||||
#endif
|
||||
|
||||
max_items = n.max_items;
|
||||
|
@ -576,11 +575,11 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::SetLogger
|
|||
|
||||
|
||||
#ifdef EZC_HAS_MORM_LIBRARY
|
||||
template<class StreamType, bool is_pikotools_stream, bool is_autoescape_stream>
|
||||
void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::SetModels(Models & models)
|
||||
{
|
||||
pmodels = ⊧
|
||||
}
|
||||
//template<class StreamType, bool is_pikotools_stream, bool is_autoescape_stream>
|
||||
//void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::SetModels(Models & models)
|
||||
//{
|
||||
// pmodels = ⊧
|
||||
//}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1340,24 +1339,19 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpace
|
|||
morm::SpaceWrapper & space_wrapper, pt::Space & space, FindHelper & find_helper, size_t model_wrapper_space_table_index)
|
||||
{
|
||||
pt::Space::TableType * table = space.get_table();
|
||||
find_helper.result->set(space_wrapper);
|
||||
|
||||
if( is_generating_for )
|
||||
{
|
||||
// we are in [for...]statement, increment iterator and check the range
|
||||
space_wrapper.increment_iterator(model_wrapper_space_table_index, table->size());
|
||||
space_wrapper.invalidate_iterators(model_wrapper_space_table_index + 1);
|
||||
//size_t iterator_value = space_wrapper.get_space_iterator_value(model_wrapper_space_table_index);
|
||||
space_wrapper.get_space_iterator_value(model_wrapper_space_table_index);
|
||||
//last_res = (iterator_value < table->size());
|
||||
}
|
||||
else
|
||||
{
|
||||
// we are not in [for..], it can be for example [if...], return true if the table is not empty
|
||||
// if we are in [if-def...] - then last_res is set later in MakeTextIfDef(Item & item) when Call() method returns
|
||||
//last_res = !table->empty();
|
||||
size_t iterator_value = space_wrapper.get_space_iterator_value(model_wrapper_space_table_index);
|
||||
bool for_status = (iterator_value < table->size());
|
||||
space_wrapper.set_last_for_loop_status(for_status);
|
||||
}
|
||||
|
||||
if( !IsTestingFunctionExistence() )
|
||||
if( !IsTestingFunctionExistence() && find_helper.is_last_field() )
|
||||
{
|
||||
DumpSpaceIfNeeded(space, find_helper);
|
||||
|
||||
|
@ -1432,33 +1426,19 @@ bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpace
|
|||
{
|
||||
pt::Space * space = space_wrapper.get_space();
|
||||
size_t model_wrapper_space_table_index = 0;
|
||||
// bool status = false;
|
||||
space_wrapper.set_last_for_loop_status(false);
|
||||
|
||||
/*
|
||||
*
|
||||
* we are iterating through such objects:
|
||||
* [root_space, fields[field_index], fields[field_index+1], fields[field_index+2], fields[field_index+3] ...]
|
||||
* the first item is the root_space with a find_helper.fun_name name
|
||||
*
|
||||
*/
|
||||
while( (find_helper.field_index < find_helper.fields.size() + 1) && space )
|
||||
while( find_helper.field_index < find_helper.fields.size() )
|
||||
{
|
||||
if( space->is_object() )
|
||||
{
|
||||
if( find_helper.field_index < find_helper.fields.size() )
|
||||
{
|
||||
const std::wstring & next_field = find_helper.fields[find_helper.field_index];
|
||||
pt::Space * next_space = space->get_space(next_field);
|
||||
const std::wstring & next_field = find_helper.fields[find_helper.field_index];
|
||||
pt::Space * next_space = space->get_space(next_field);
|
||||
|
||||
if( next_space )
|
||||
{
|
||||
find_helper.field_index += 1;
|
||||
space = next_space;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
if( next_space )
|
||||
{
|
||||
find_helper.field_index += 1;
|
||||
space = next_space;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1470,76 +1450,53 @@ bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpace
|
|||
{
|
||||
if( model_wrapper_space_table_index < space_wrapper.space_indices_table_size() )
|
||||
{
|
||||
if( find_helper.is_last_field() )
|
||||
space = CallSpaceTableForMiddleField(space_wrapper, *space, find_helper, model_wrapper_space_table_index);
|
||||
|
||||
if( !space )
|
||||
{
|
||||
CallSpaceTableForLastField(space_wrapper, *space, find_helper, model_wrapper_space_table_index);
|
||||
find_helper.field_index += 1;
|
||||
// status = true;
|
||||
// a [for ...] was not used beforehand
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
// increment field_index only if next_field is 'this' and space is not an object
|
||||
if( !space->is_object() )
|
||||
{
|
||||
space = CallSpaceTableForMiddleField(space_wrapper, *space, find_helper, model_wrapper_space_table_index);
|
||||
// increment field_index only if next_field is 'this' and space is not an object
|
||||
std::wstring & next_field = find_helper.fields[find_helper.field_index];
|
||||
|
||||
if( space && !space->is_object() )
|
||||
if( next_field == L"this" )
|
||||
{
|
||||
std::wstring & next_field = find_helper.fields[find_helper.field_index];
|
||||
|
||||
if( next_field == L"this" )
|
||||
{
|
||||
find_helper.field_index += 1;
|
||||
}
|
||||
find_helper.field_index += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateMsg(L"", find_helper.name, find_helper.fields, find_helper.field_index, L" exceeded the maximum number of fields for a space object");
|
||||
space = nullptr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// PrintLastSpaceField(*space, find_helper);
|
||||
// status = true;
|
||||
// // increment field_index here?
|
||||
break;
|
||||
|
||||
// if( is_last_field )
|
||||
// {
|
||||
// if( !IsTestingFunctionExistence() )
|
||||
// {
|
||||
// PrintLastSpaceField(space, result, parameters);
|
||||
// }
|
||||
//
|
||||
// field_index += 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if( !IsTestingFunctionExistence() )
|
||||
// {
|
||||
// CreateMsg(L"", name, fields, field_index, L" of a space is not an object nor a table");
|
||||
// }
|
||||
//
|
||||
// space = nullptr;
|
||||
// }
|
||||
}
|
||||
|
||||
model_wrapper_space_table_index += 1;
|
||||
}
|
||||
|
||||
if( space )
|
||||
if( space->is_table() )
|
||||
{
|
||||
CallSpaceTableForLastField(space_wrapper, *space, find_helper, model_wrapper_space_table_index);
|
||||
}
|
||||
else
|
||||
if( !IsTestingFunctionExistence() )
|
||||
{
|
||||
PrintLastSpaceField(*space, find_helper);
|
||||
|
||||
if( !IsTestingFunctionExistence() )
|
||||
{
|
||||
if( find_helper.is_last_field() )
|
||||
DumpSpaceIfNeeded(*space, find_helper);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
//return status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1882,7 +1839,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::FindVaria
|
|||
template<class StreamType, bool is_pikotools_stream, bool is_autoescape_stream>
|
||||
void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::EvaluateVariable(FindHelper & find_helper)
|
||||
{
|
||||
bool was_child_found = false;
|
||||
Var<StreamType> * result_child = nullptr;
|
||||
find_helper.found = false;
|
||||
find_helper.current_var = nullptr;
|
||||
const std::wstring & name = find_helper.current_name();
|
||||
|
@ -1890,8 +1847,8 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::EvaluateV
|
|||
if( find_helper.previous_var )
|
||||
{
|
||||
find_helper.current_var = find_helper.previous_var->find_child(name);
|
||||
result_child = find_helper.current_var;
|
||||
find_helper.found = (find_helper.current_var != nullptr);
|
||||
was_child_found = (find_helper.current_var != nullptr);
|
||||
|
||||
if( find_helper.current_var )
|
||||
*find_helper.result = *find_helper.current_var;
|
||||
|
@ -1955,7 +1912,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::EvaluateV
|
|||
}
|
||||
}
|
||||
|
||||
if( find_helper.previous_var && !was_child_found )
|
||||
if( find_helper.previous_var && !result_child )
|
||||
{
|
||||
// may only model_container_wrapper and space_wrapper here?
|
||||
if( find_helper.result->type == Var<StreamType>::TYPE_MODEL ||
|
||||
|
@ -1963,13 +1920,16 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::EvaluateV
|
|||
find_helper.result->type == Var<StreamType>::TYPE_SPACE_WRAPPER ||
|
||||
find_helper.result->type == Var<StreamType>::TYPE_FUNCTION )
|
||||
{
|
||||
Var<StreamType> * previous = find_helper.previous_var->add_child(name, *find_helper.result);
|
||||
result_child = find_helper.previous_var->add_child(name, *find_helper.result);
|
||||
}
|
||||
}
|
||||
|
||||
if( find_helper.result->type == Var<StreamType>::TYPE_SPACE_WRAPPER && find_helper.result->space_wrapper )
|
||||
{
|
||||
find_helper.result->clear();
|
||||
find_helper.found = CallSpace(*previous->space_wrapper, find_helper);
|
||||
}
|
||||
if( result_child )
|
||||
{
|
||||
if( result_child->type == Var<StreamType>::TYPE_SPACE_WRAPPER && result_child->space_wrapper )
|
||||
{
|
||||
find_helper.result->clear();
|
||||
find_helper.found = CallSpace(*result_child->space_wrapper, find_helper);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2722,19 +2682,16 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeTextF
|
|||
break;
|
||||
}
|
||||
else
|
||||
// if( result.type == Var<StreamType>::Type::TYPE_SPACE_WRAPPER )
|
||||
// {
|
||||
// if( !result.space_wrapper->is_iterator_correct() )
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
if( result.type == Var<StreamType>::Type::TYPE_SPACE_WRAPPER )
|
||||
{
|
||||
if( !result.space_wrapper->get_last_for_loop_status() )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if( !result.to_bool() )
|
||||
// break;
|
||||
|
||||
if( !item.item_tab.empty() )
|
||||
MakeText( *item.item_tab[0] ); // should be only one item
|
||||
}
|
||||
|
|
70
src/var.h
70
src/var.h
|
@ -152,6 +152,13 @@ public:
|
|||
template<typename ModelType>
|
||||
void set(std::list<ModelType> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
void set(std::vector<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
void set(std::list<ModelType*> & model_container);
|
||||
|
||||
void set(morm::SpaceWrapper & space_wrapper);
|
||||
|
||||
bool is_equal(const char * str) const;
|
||||
bool is_equal(const wchar_t * str) const;
|
||||
|
@ -394,10 +401,15 @@ bool Var<StreamType>::to_bool() const
|
|||
return space_local.to_bool();
|
||||
|
||||
case TYPE_STREAM:
|
||||
return !stream.empty();
|
||||
|
||||
case TYPE_FUNCTION:
|
||||
case TYPE_DATE:
|
||||
case TYPE_MODEL:
|
||||
break;
|
||||
|
||||
case TYPE_SPACE_WRAPPER:
|
||||
return space_wrapper->get_space()->to_bool();
|
||||
break;
|
||||
|
||||
case TYPE_MODEL_CONTAINER_WRAPPER:
|
||||
|
@ -414,6 +426,7 @@ bool Var<StreamType>::to_bool() const
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(const char * str)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -422,6 +435,7 @@ void Var<StreamType>::set(const char * str)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(const wchar_t * str)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -430,6 +444,7 @@ void Var<StreamType>::set(const wchar_t * str)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(const std::string & str)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -438,6 +453,7 @@ void Var<StreamType>::set(const std::string & str)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(const std::wstring & str)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -446,6 +462,7 @@ void Var<StreamType>::set(const std::wstring & str)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(char val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -453,6 +470,7 @@ void Var<StreamType>::set(char val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(unsigned char val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -460,6 +478,7 @@ void Var<StreamType>::set(unsigned char val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(wchar_t val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(str);
|
||||
}
|
||||
|
@ -469,6 +488,7 @@ void Var<StreamType>::set(wchar_t val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(bool val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -478,6 +498,7 @@ void Var<StreamType>::set(bool val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(short val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -485,6 +506,7 @@ void Var<StreamType>::set(short val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(int val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -492,6 +514,7 @@ void Var<StreamType>::set(int val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(long val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -499,6 +522,7 @@ void Var<StreamType>::set(long val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(long long val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -506,6 +530,7 @@ void Var<StreamType>::set(long long val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(unsigned short val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -513,6 +538,7 @@ void Var<StreamType>::set(unsigned short val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(unsigned int val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -520,6 +546,7 @@ void Var<StreamType>::set(unsigned int val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(unsigned long val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -527,6 +554,7 @@ void Var<StreamType>::set(unsigned long val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(unsigned long long val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -535,6 +563,7 @@ void Var<StreamType>::set(unsigned long long val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(float val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -543,6 +572,7 @@ void Var<StreamType>::set(float val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(double val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -551,6 +581,7 @@ void Var<StreamType>::set(double val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(long double val)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_LOCAL;
|
||||
space_local.set(val);
|
||||
}
|
||||
|
@ -559,6 +590,7 @@ void Var<StreamType>::set(long double val)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(const pt::Stream & str)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_STREAM;
|
||||
stream.clear();
|
||||
stream << str;
|
||||
|
@ -569,6 +601,7 @@ void Var<StreamType>::set(const pt::Stream & str)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(UserFunction user_function)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_FUNCTION;
|
||||
this->user_function = user_function;
|
||||
}
|
||||
|
@ -577,6 +610,7 @@ void Var<StreamType>::set(UserFunction user_function)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(const pt::Date & date)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_DATE;
|
||||
this->date = &date;
|
||||
}
|
||||
|
@ -585,6 +619,7 @@ void Var<StreamType>::set(const pt::Date & date)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(morm::Model & model)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_MODEL;
|
||||
this->model = &model;
|
||||
}
|
||||
|
@ -593,8 +628,10 @@ void Var<StreamType>::set(morm::Model & model)
|
|||
template<typename StreamType>
|
||||
void Var<StreamType>::set(morm::ModelContainerWrapper & model_container_wrapper)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_MODEL_CONTAINER_WRAPPER;
|
||||
this->model_container_wrapper = &model_container_wrapper;
|
||||
this->model_container_wrapper->increment_reference_counter();
|
||||
}
|
||||
|
||||
|
||||
|
@ -602,6 +639,7 @@ template<typename StreamType>
|
|||
template<typename ModelType>
|
||||
void Var<StreamType>::set(std::vector<ModelType> & model_container)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_MODEL_CONTAINER_WRAPPER;
|
||||
this->model_container_wrapper = new morm::ModelWrapperVector<ModelType>(&model_container);
|
||||
}
|
||||
|
@ -611,11 +649,43 @@ template<typename StreamType>
|
|||
template<typename ModelType>
|
||||
void Var<StreamType>::set(std::list<ModelType> & model_container)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_MODEL_CONTAINER_WRAPPER;
|
||||
this->model_container_wrapper = new morm::ModelWrapperList<ModelType>(&model_container);
|
||||
}
|
||||
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
void Var<StreamType>::set(std::vector<ModelType*> & model_container)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_MODEL_CONTAINER_WRAPPER;
|
||||
this->model_container_wrapper = new morm::ModelWrapperVectorPointer<ModelType>(&model_container);
|
||||
}
|
||||
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
void Var<StreamType>::set(std::list<ModelType*> & model_container)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_MODEL_CONTAINER_WRAPPER;
|
||||
this->model_container_wrapper = new morm::ModelWrapperListPointer<ModelType>(&model_container);
|
||||
}
|
||||
|
||||
|
||||
template<typename StreamType>
|
||||
void Var<StreamType>::set(morm::SpaceWrapper & space_wrapper)
|
||||
{
|
||||
clear();
|
||||
type = TYPE_SPACE_WRAPPER;
|
||||
this->space_wrapper = &space_wrapper;
|
||||
this->space_wrapper->increment_reference_counter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename StreamType>
|
||||
|
|
100
src/vars.h
100
src/vars.h
|
@ -102,6 +102,33 @@ public:
|
|||
template<typename ModelType>
|
||||
Var<StreamType> & add(const std::wstring & name, std::list<ModelType> & model_container);
|
||||
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const char * name, std::vector<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const wchar_t * name, std::vector<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const std::string & name, std::vector<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const std::wstring & name, std::vector<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const char * name, std::list<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const wchar_t * name, std::list<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const std::string & name, std::list<ModelType*> & model_container);
|
||||
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & add(const std::wstring & name, std::list<ModelType*> & model_container);
|
||||
|
||||
|
||||
|
||||
Var<StreamType> * find(const char * name) const;
|
||||
Var<StreamType> * find(const wchar_t * name) const;
|
||||
Var<StreamType> * find(const std::string & name) const;
|
||||
|
@ -337,6 +364,79 @@ Var<StreamType> & Vars<StreamType>::add(const std::wstring & name, std::list<Mod
|
|||
}
|
||||
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const char * name, std::vector<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const wchar_t * name, std::vector<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const std::string & name, std::vector<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const std::wstring & name, std::vector<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const char * name, std::list<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const wchar_t * name, std::list<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const std::string & name, std::list<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
template<typename StreamType>
|
||||
template<typename ModelType>
|
||||
Var<StreamType> & Vars<StreamType>::add(const std::wstring & name, std::list<ModelType*> & model_container)
|
||||
{
|
||||
Var<StreamType> & var = add(name);
|
||||
var.set(model_container);
|
||||
return var;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue