From 37f78ad8e0659bec183ee585b4a0f258f960daf9 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 23 Jan 2025 07:12:57 +0100 Subject: [PATCH] WIP: add a Val struct as an input/output when calling a function --- src/blocks.cpp | 12 ++-- src/blocks.h | 2 +- src/cache.cpp | 36 +++++----- src/cache.h | 4 +- src/functions.cpp | 4 +- src/functions.h | 3 +- src/generator.h | 166 +++++++++++++++++++++++++++++++--------------- src/models.cpp | 10 ++- src/models.h | 2 + src/pattern.cpp | 8 +-- src/pattern.h | 2 +- src/val.cpp | 63 ------------------ src/val.h | 5 +- 13 files changed, 161 insertions(+), 156 deletions(-) diff --git a/src/blocks.cpp b/src/blocks.cpp index 9eea8d2..43140d6 100644 --- a/src/blocks.cpp +++ b/src/blocks.cpp @@ -94,13 +94,13 @@ void Blocks::CacheObjects(Objects & obj) } -void Blocks::CacheFunctions(Functions & fun) -{ - BlocksTable::iterator i = blocks_tab.begin(); +// void Blocks::CacheFunctions(Functions & fun) +// { +// BlocksTable::iterator i = blocks_tab.begin(); - for( ; i != blocks_tab.end() ; ++i) - Cache(fun, i->second); -} +// for( ; i != blocks_tab.end() ; ++i) +// Cache(fun, i->second); +// } void Blocks::CacheBlocks(Blocks & blocks) diff --git a/src/blocks.h b/src/blocks.h index 98e9ee1..0f6779f 100644 --- a/src/blocks.h +++ b/src/blocks.h @@ -63,7 +63,7 @@ public: void Clear(); void CacheObjects(Objects & obj); - void CacheFunctions(Functions & fun); + //void CacheFunctions(Functions & fun); void CacheBlocks(Blocks & blocks); void ClearCache(); diff --git a/src/cache.cpp b/src/cache.cpp index 7bf281e..7bb586a 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -58,30 +58,30 @@ void Cache(Blocks & blocks, Item::Function & function) } -void Cache(Functions & fun, Item::Function & function) -{ - function.fun_cache = 0; +// void Cache(Functions & fun, Item::Function & function) +// { +// function.fun_cache = 0; - if( !function.name.empty() && function.arg < 0 ) - { - typename Functions::Iterator i = fun.Find(function.name); +// if( !function.name.empty() && function.arg < 0 ) +// { +// typename Functions::Iterator i = fun.Find(function.name); - if( i != fun.End() ) - function.fun_cache = &i->second; - } +// if( i != fun.End() ) +// function.fun_cache = &i->second; +// } - for(size_t i=0 ; i < function.parameters.size() ; ++i) - Cache(fun, *function.parameters[i]); -} +// for(size_t i=0 ; i < function.parameters.size() ; ++i) +// Cache(fun, *function.parameters[i]); +// } -void Cache(Functions & fun, Item & item) -{ - Cache(fun, item.function); +// void Cache(Functions & fun, Item & item) +// { +// Cache(fun, item.function); - for(size_t i=0; i < item.item_tab.size() ; ++i) - Cache(fun, *item.item_tab[i]); -} +// for(size_t i=0; i < item.item_tab.size() ; ++i) +// Cache(fun, *item.item_tab[i]); +// } diff --git a/src/cache.h b/src/cache.h index 7b1fa23..5e389eb 100644 --- a/src/cache.h +++ b/src/cache.h @@ -48,8 +48,8 @@ namespace Ezc class Blocks; -void Cache(Functions & fun, Item::Function & function); -void Cache(Functions & fun, Item & item); +// void Cache(Functions & fun, Item::Function & function); +// void Cache(Functions & fun, Item & item); void Cache(Blocks & blocks, Item & item); void Cache(Objects & objects, Item::Function & function); void Cache(Objects & objects, Item & item); diff --git a/src/functions.cpp b/src/functions.cpp index d9217bc..aaa922b 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -38,7 +38,7 @@ namespace Ezc { - +/* void Functions::Insert(const char * key, UserFunction ufunction) { pt::utf8_to_wide(key, temp_key); @@ -102,7 +102,7 @@ size_t Functions::Size() const { return functions_tab.size(); } - +*/ } // namespace Ezc diff --git a/src/functions.h b/src/functions.h index 53fdc75..4f8de03 100644 --- a/src/functions.h +++ b/src/functions.h @@ -48,6 +48,7 @@ namespace Ezc // functions or variables +/* class Functions { public: @@ -75,7 +76,7 @@ private: std::wstring temp_key; }; - +*/ } // namespace Ezc diff --git a/src/generator.h b/src/generator.h index 64b01af..a20a6ff 100644 --- a/src/generator.h +++ b/src/generator.h @@ -65,7 +65,7 @@ public: void SetPattern(Pattern & pattern); void SetBlocks(Blocks & blocks); - void SetFunctions(Functions & functions); + //void SetFunctions(Functions & functions); void SetObjects(Objects & objects); void SetVariables(Vals & variables); // [def] and [let] @@ -142,14 +142,15 @@ private: Item::Function & item_fun, const std::wstring & fun_name, std::vector & fields, - Val & baseval, std::vector & parameters, Val & result, pt::Stream & out_stream, const pt::Stream & in_stream) : - item_fun(item_fun), fun_name(fun_name), fields(fields), baseval(&baseval), currentval(&baseval), + item_fun(item_fun), fun_name(fun_name), fields(fields), parameters(parameters), result(result), out_stream(out_stream), in_stream(in_stream) { + currentval = nullptr; + #ifdef EZC_HAS_MORM_LIBRARY field_index = 0; #endif @@ -158,21 +159,21 @@ private: FindHelper(const FindHelper &) = delete; // RENAMEME - void set_base_val(Val * val) + void set_current_val(Val * val) { - baseval = val; + //baseval = val; currentval = val; } - void set_base_val(Val & val) + void set_current_val(Val & val) { - set_base_val(&val); + set_current_val(&val); } Item::Function & item_fun; const std::wstring & fun_name; std::vector & fields; - Val * baseval; + //Val * baseval; Val * currentval; std::vector & parameters; Val & result; @@ -248,7 +249,7 @@ private: Pattern * ppattern; Blocks * pblocks; - Functions * pfunctions; + //Functions * pfunctions; Objects * pobjects; #ifdef EZC_HAS_MORM_LIBRARY Models * pmodels; @@ -366,8 +367,8 @@ private: void PrepareEnvStruct(Env & env); - void CallFunction(Functions::UserFunction & function, Env & env); - void CallFunction(FindHelper & find_helper); + void CallFunction(Val::UserFunction & function, Env & env); + //void CallFunction(FindHelper & find_helper); void CallMethod(morm::Model * model, Val::ModelMethod1 method, Env & env); void CallMethod(morm::Model * model, Val::ModelMethod2 method, Val & res); @@ -399,11 +400,14 @@ private: #ifdef EZC_HAS_MORM_LIBRARY //bool CallModelField(FindHelper & find_helper, morm::Model & model); bool CallModel(FindHelper & find_helper, morm::Model & model); - bool FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias); bool CallModel(FindHelper & find_helper); bool CallModelContainerWrapper(FindHelper & find_helper); #endif + bool XXXRenameMe(FindHelper & find_helper, bool is_for_alias); + bool FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias); + bool FindLastSpace(FindHelper & find_helper); + bool EvaluateFunctionOrMethod(pt::Stream & out_stream, Val & val, Val & result); void CallObject(BaseObj & base_obj, @@ -469,11 +473,12 @@ private: pt::Stream * GetNewStreamForFrame(); void DecrementFramesStackIndex(); + bool EvaluateResultToBool(Val & result, bool is_empty_stream); void MakeTextIf_go(Item & item, bool result); void MakeTextIf(Item & item); void MakeTextIfDef(Item & item); void MakeTextIfNotDef(Item & item); - bool MakeTextForEvaluate(Item & item, Val & result); + bool MakeTextForEvaluate(Item & item, Val & result, bool is_empty_stream); void MakeTextFor(Item & item); void MakeItemText(Item & item); void MakeTextContainer(Item & item); @@ -507,7 +512,7 @@ Generator::Generator() : empty_stream() { ppattern = nullptr; pblocks = nullptr; - pfunctions = nullptr; + //pfunctions = nullptr; pobjects = nullptr; pvals = nullptr; plog = nullptr; @@ -550,7 +555,7 @@ Generator::operator=(const Generator & n) { ppattern = n.ppattern; pblocks = n.pblocks; - pfunctions = n.pfunctions; + //pfunctions = n.pfunctions; pobjects = n.pobjects; pvals = n.pvals; plog = n.plog; @@ -624,10 +629,10 @@ void Generator::SetBlocks(Blocks & blocks) -void Generator::SetFunctions(Functions & functions) -{ - pfunctions = &functions; -} +// void Generator::SetFunctions(Functions & functions) +// { +// pfunctions = &functions; +// } @@ -1102,7 +1107,7 @@ bool Generator::CheckBlockArgument(FindHelper & find_helper) if( size_t(find_helper.item_fun.arg) < block_stack.args.size() ) { - find_helper.set_base_val(block_stack.args[find_helper.item_fun.arg]); + find_helper.set_current_val(block_stack.args[find_helper.item_fun.arg]); return true; } } @@ -1157,7 +1162,7 @@ bool Generator::FindInModels(FindHelper & find_helper) if( val ) { - find_helper.set_base_val(val); + find_helper.set_current_val(val); found = true; } } @@ -1168,19 +1173,20 @@ bool Generator::FindInModels(FindHelper & find_helper) #endif -// IMPROVEME split me into two functions bool Generator::FindInFunctions(FindHelper & find_helper) { + /* if( pfunctions ) { typename Functions::Iterator i = pfunctions->Find(find_helper.fun_name); if( i != pfunctions->End() ) { - find_helper.baseval->set(i->second); + find_helper.currentval->set_pointer_to(i->second); return true; } } + */ return false; } @@ -1194,7 +1200,7 @@ bool Generator::FindInBlocks(FindHelper & find_helper) if( i != pblocks->End() ) { - find_helper.baseval->set_pointer_to(&i->second); + find_helper.currentval->set_pointer_to(&i->second); return true; } } @@ -1211,7 +1217,7 @@ bool Generator::FindInVariables(FindHelper & find_helper) if( i != pvals->end() ) { - find_helper.set_base_val(i->second); + find_helper.set_current_val(i->second); return true; } } @@ -1284,27 +1290,27 @@ void Generator::PrepareEnvStruct(Env & env) -void Generator::CallFunction(Functions::UserFunction & function, Env & env) +void Generator::CallFunction(Val::UserFunction & function, Env & env) { PrepareEnvStruct(env); (function)(env); } -void Generator::CallFunction(FindHelper & find_helper) -{ - if( !IsTestingFunctionExistence() ) - { - if( find_helper.baseval->type == Val::TYPE_FUNCTION && find_helper.baseval->pointer ) - { - using UserFunction = void (*)(Env &); - UserFunction user_function = reinterpret_cast(find_helper.baseval->pointer); +// void Generator::CallFunction(FindHelper & find_helper) +// { +// if( !IsTestingFunctionExistence() ) +// { +// if( find_helper.baseval->type == Val::TYPE_FUNCTION && find_helper.baseval->pointer ) +// { +// using UserFunction = void (*)(Env &); +// UserFunction user_function = reinterpret_cast(find_helper.baseval->pointer); - Env env(find_helper.out_stream, find_helper.parameters, find_helper.result, find_helper.in_stream, stack_tab[stack_index-1], *stack_tab[stack_index-1].item); - CallFunction(user_function, env); - } - } -} +// Env env(find_helper.out_stream, find_helper.parameters, find_helper.result, find_helper.in_stream, stack_tab[stack_index-1], *stack_tab[stack_index-1].item); +// CallFunction(user_function, env); +// } +// } +// } void Generator::CallMethod(morm::Model * model, Val::ModelMethod1 method, Env & env) @@ -1570,6 +1576,9 @@ pt::Space * Generator::CallSpaceObject(FindHelper & find_helper, pt::Space * spa if( find_helper.is_last_field() ) { + // IsTestingFunctionExistence() can be moved up (to Call() method or level up) + + if( IsTestingFunctionExistence() ) { find_helper.result.set(true); @@ -2009,11 +2018,31 @@ bool Generator::EvaluateFunctionOrMethod(pt::Stream & out_stream, Val & val, Val } +bool Generator::XXXRenameMe(FindHelper & find_helper, bool is_for_alias) +{ + if( find_helper.currentval->has_function() || find_helper.currentval->has_method() ) + { + //Val res(&find_helper.out_stream); + + if( EvaluateFunctionOrMethod(find_helper.out_stream, *find_helper.currentval, find_helper.result) ) + { + find_helper.currentval = &find_helper.result; + //child_val = find_helper.currentval->add_child(field, find_helper.result); + } + else + { + // put some error? + return false; + } + } +} + + // RENAMEME bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias) { find_helper.field_index = 0; - Val res(&find_helper.out_stream); + //Val res(&find_helper.out_stream); while( find_helper.field_index < find_helper.fields.size() && find_helper.currentval->has_model_object() ) { @@ -2042,9 +2071,9 @@ bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias { if( (find_helper.field_index + 1 < find_helper.fields.size()) || !is_for_alias ) { - if( EvaluateFunctionOrMethod(find_helper.out_stream, *find_helper.currentval, res) ) + if( EvaluateFunctionOrMethod(find_helper.out_stream, *find_helper.currentval, find_helper.result) ) { - child_val = find_helper.currentval->add_child(field, res); + child_val = find_helper.currentval->add_child(field, find_helper.result); } else { @@ -2069,9 +2098,9 @@ bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias { if( (find_helper.field_index + 1 < find_helper.fields.size()) || !is_for_alias ) { - if( EvaluateFunctionOrMethod(find_helper.out_stream, val, res) ) + if( EvaluateFunctionOrMethod(find_helper.out_stream, val, find_helper.result) ) { - child_val = find_helper.currentval->add_child(field, res); + child_val = find_helper.currentval->add_child(field, find_helper.result); } else { @@ -2106,6 +2135,18 @@ bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias } + +bool Generator::FindLastSpace(FindHelper & find_helper) +{ + if( find_helper.currentval->type == Val::TYPE_SPACE ) + { + return CallSpace(find_helper); + } + + return true; +} + + bool Generator::CallModel(FindHelper & find_helper) { morm::Model * model = reinterpret_cast(find_helper.currentval->pointer); @@ -2369,14 +2410,13 @@ bool Generator::Call(Item::Function & item_fun, pt::Stream & out_stream, const pt::Stream & in_stream) { - Val current(&out_stream); + //Val current(&out_stream); std::vector parameters; if( !fun_name ) fun_name = &item_fun.name; - FindHelper find_helper(item_fun, *fun_name, item_fun.fields, current, parameters, result, out_stream, in_stream); - + FindHelper find_helper(item_fun, *fun_name, item_fun.fields, parameters, result, out_stream, in_stream); // if( clear_out_stream ) // ClearStream(out_stream); @@ -2389,6 +2429,9 @@ bool Generator::Call(Item::Function & item_fun, if( !FindLastModelWrapper(find_helper, false) ) return false; + if( !FindLastSpace(find_helper) ) + return false; + EvaluateParameters(find_helper); bool status = false; @@ -2872,6 +2915,13 @@ void Generator::MakeTextFunction(Item & item) } +bool Generator::EvaluateResultToBool(Val & result, bool is_empty_stream) +{ + if( result.type != Val::TYPE_VOID ) + return result.to_bool(); + + return !is_empty_stream; +} void Generator::MakeTextIf_go(Item & item, bool result) @@ -2896,6 +2946,8 @@ void Generator::MakeTextIf(Item & item) { Val result(stream_temp1); is_generating_if = true; + bool is_empty_stream = true; + stream_temp1->clear(); if( program_mode ) { @@ -2905,13 +2957,15 @@ void Generator::MakeTextIf(Item & item) else { bool status = Call(item.function, nullptr, result, *stream_temp1, *empty_stream); - ClearStream(*stream_temp1); + is_empty_stream = stream_temp1->empty(); + stream_temp1->clear(); if( !status ) return; } - MakeTextIf_go(item, result.to_bool()); + MakeTextIf_go(item, EvaluateResultToBool(result, is_empty_stream)); + stream_temp1->clear(); } @@ -2955,7 +3009,7 @@ void Generator::MakeTextIfNotDef(Item & item) } -bool Generator::MakeTextForEvaluate(Item & item, Val & result) +bool Generator::MakeTextForEvaluate(Item & item, Val & result, bool is_empty_stream) { bool status = false; @@ -2998,7 +3052,7 @@ bool Generator::MakeTextForEvaluate(Item & item, Val & result) } else { - status = result.to_bool(); + status = EvaluateResultToBool(result, is_empty_stream); } return status; @@ -3023,6 +3077,12 @@ void Generator::MakeTextFor(Item & item) // so we should set it in each iterations is_generating_for = true; result.clear(); + stream_temp1->clear(); + + bool is_empty_stream = true; + + // CHECKME + // stream_temp1 is cleared correctly in each loop? if( program_mode ) { @@ -3034,12 +3094,14 @@ void Generator::MakeTextFor(Item & item) return; } - if( !MakeTextForEvaluate(item, result) ) + if( !MakeTextForEvaluate(item, result, is_empty_stream) ) break; if( !item.item_tab.empty() ) MakeText( *item.item_tab[0] ); // should be only one item } + + stream_temp1->clear(); } diff --git a/src/models.cpp b/src/models.cpp index 05f8eb3..7ca803b 100644 --- a/src/models.cpp +++ b/src/models.cpp @@ -117,6 +117,14 @@ void Models::Add(const std::wstring & name, const std::wstring & value) } +void Models::Add(const std::wstring & name, Val::UserFunction ufunction) +{ + Val val; + val.set_pointer_to(ufunction); + models_map[name] = val; +} + + Val * Models::Find(const std::wstring & name) { auto iterator = models_map.find(name); @@ -135,8 +143,6 @@ Models::ModelsMap & Models::GetMap() return models_map; } - - } diff --git a/src/models.h b/src/models.h index f018464..93a7296 100644 --- a/src/models.h +++ b/src/models.h @@ -65,6 +65,8 @@ public: void Add(const std::wstring & name, const std::wstring & value); + void Add(const std::wstring & name, Val::UserFunction ufunction); + template void Add(const std::wstring & name, std::vector & container) { diff --git a/src/pattern.cpp b/src/pattern.cpp index 98b06e7..ab22889 100644 --- a/src/pattern.cpp +++ b/src/pattern.cpp @@ -63,10 +63,10 @@ void Pattern::ClearCache() } -void Pattern::CacheFunctions(Functions & fun) -{ - Cache(fun, item_root); -} +// void Pattern::CacheFunctions(Functions & fun) +// { +// Cache(fun, item_root); +// } void Pattern::CacheObjects(Objects & obj) diff --git a/src/pattern.h b/src/pattern.h index 231565b..5920767 100644 --- a/src/pattern.h +++ b/src/pattern.h @@ -55,7 +55,7 @@ public: void Clear(); - void CacheFunctions(Functions & fun); + //void CacheFunctions(Functions & fun); void CacheBlocks(Blocks & blocks); void CacheObjects(Objects & obj); void ClearCache(); diff --git a/src/val.cpp b/src/val.cpp index e18c6b8..7ab4799 100644 --- a/src/val.cpp +++ b/src/val.cpp @@ -46,7 +46,6 @@ namespace Ezc Val::Val() { output_stream = nullptr; - output_stream_original_size = 0; initialize_empty(); } @@ -54,7 +53,6 @@ Val::Val() Val::Val(pt::Stream * output_stream) { this->output_stream = output_stream; - this->output_stream_original_size = output_stream->size(); initialize_empty(); } @@ -108,7 +106,6 @@ void Val::copy(const Val & val) // space = val.space; output_stream = val.output_stream; - output_stream_original_size = val.output_stream_original_size; increment_model_container_wrapper_ref(); increment_space_wrapper_ref(); @@ -146,7 +143,6 @@ Val::~Val() void Val::set_output_stream(pt::Stream * output_stream) { this->output_stream = output_stream; - this->output_stream_original_size = (output_stream) ? output_stream->size() : 0; } @@ -310,9 +306,6 @@ bool Val::to_bool() const case TYPE_MODEL_CONTAINER_WRAPPER: return to_bool_model_container_wrapper(); - - case TYPE_OUTPUT_STREAM: - return output_stream->size() != output_stream_original_size; } return false; @@ -910,11 +903,6 @@ bool Val::is_equal_string(const wchar_t * str) const pt::Stream * stream = reinterpret_cast(pointer); found = is_stream_equal_string(*stream, str); } - else - if( type == Type::TYPE_OUTPUT_STREAM && output_stream ) - { - found = is_stream_equal_string(*output_stream, str); - } return found; } @@ -1012,7 +1000,6 @@ void Val::serialize_to(pt::Stream & str) #ifdef EZC_HAS_MORM_LIBRARY case TYPE_MODEL_METHOD: #endif - case TYPE_OUTPUT_STREAM: case TYPE_ITEM_BLOCK: break; @@ -1093,20 +1080,8 @@ void Val::serialize_space_to(pt::Stream & str) } -void Val::assert_type_output_stream() -{ - if( type != Val::TYPE_OUTPUT_STREAM ) - { - clear(); - type = TYPE_OUTPUT_STREAM; - } -} - - Val & Val::operator<<(const char * str) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << str; @@ -1118,8 +1093,6 @@ Val & Val::operator<<(const char * str) Val & Val::operator<<(const wchar_t * str) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << str; @@ -1131,8 +1104,6 @@ Val & Val::operator<<(const wchar_t * str) Val & Val::operator<<(const std::string & str) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << str; @@ -1144,8 +1115,6 @@ Val & Val::operator<<(const std::string & str) Val & Val::operator<<(const std::wstring & str) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << str; @@ -1157,8 +1126,6 @@ Val & Val::operator<<(const std::wstring & str) Val & Val::operator<<(char val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1170,8 +1137,6 @@ Val & Val::operator<<(char val) Val & Val::operator<<(unsigned char val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1183,8 +1148,6 @@ Val & Val::operator<<(unsigned char val) Val & Val::operator<<(wchar_t val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1196,8 +1159,6 @@ Val & Val::operator<<(wchar_t val) Val & Val::operator<<(bool val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1209,8 +1170,6 @@ Val & Val::operator<<(bool val) Val & Val::operator<<(short val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1222,8 +1181,6 @@ Val & Val::operator<<(short val) Val & Val::operator<<(int val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1235,8 +1192,6 @@ Val & Val::operator<<(int val) Val & Val::operator<<(long val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1248,8 +1203,6 @@ Val & Val::operator<<(long val) Val & Val::operator<<(long long val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1261,8 +1214,6 @@ Val & Val::operator<<(long long val) Val & Val::operator<<(unsigned short val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1274,8 +1225,6 @@ Val & Val::operator<<(unsigned short val) Val & Val::operator<<(unsigned int val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1287,8 +1236,6 @@ Val & Val::operator<<(unsigned int val) Val & Val::operator<<(unsigned long val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1300,8 +1247,6 @@ Val & Val::operator<<(unsigned long val) Val & Val::operator<<(unsigned long long val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1313,8 +1258,6 @@ Val & Val::operator<<(unsigned long long val) Val & Val::operator<<(float val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1326,8 +1269,6 @@ Val & Val::operator<<(float val) Val & Val::operator<<(double val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1339,8 +1280,6 @@ Val & Val::operator<<(double val) Val & Val::operator<<(long double val) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << val; @@ -1352,8 +1291,6 @@ Val & Val::operator<<(long double val) Val & Val::operator<<(const pt::Stream & str) { - assert_type_output_stream(); - if( output_stream ) { *output_stream << str; diff --git a/src/val.h b/src/val.h index 739af2a..c546ea1 100644 --- a/src/val.h +++ b/src/val.h @@ -87,7 +87,6 @@ public: TYPE_MODEL_METHOD, #endif TYPE_SPACE, - TYPE_OUTPUT_STREAM, TYPE_ITEM_BLOCK, TYPE_CHAR, TYPE_WCHAR, // @@ -276,7 +275,6 @@ public: // output stream pt::Stream * output_stream; - size_t output_stream_original_size; bool is_equal_string(const wchar_t * str) const; @@ -304,8 +302,6 @@ private: bool is_space_equal_string(const pt::Space & space, const wchar_t * str) const; bool is_stream_equal_string(const pt::Stream & stream, const wchar_t * str) const; - void assert_type_output_stream(); - bool to_bool_stream() const; bool to_bool_space() const; bool to_bool_model_container_wrapper() const; @@ -383,6 +379,7 @@ typedef std::map Vals; + } // namespace Ezc #endif