From a2cf4dbb0243877dc9cd806758abbb8cb8431edb Mon Sep 17 00:00:00 2001 From: mat007 Date: Wed, 10 Mar 2010 22:43:32 +0000 Subject: [PATCH] Refactoring git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@140 860be788-9bd5-4423-9f1e-828f051e677b --- src/libraries/turtle/function.hpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/libraries/turtle/function.hpp b/src/libraries/turtle/function.hpp index 27a305f..7c32045 100644 --- a/src/libraries/turtle/function.hpp +++ b/src/libraries/turtle/function.hpp @@ -267,31 +267,29 @@ namespace mock typedef BOOST_DEDUCED_TYPENAME expectations_type::const_iterator expectations_cit; - void serialize( std::ostream& s ) const - { - for( expectations_cit it = expectations_.begin(); - it != expectations_.end(); ++it ) - s << std::endl << *it; - } - std::string context() const { std::stringstream s; - s << parent_->tag() << name_; - serialize( s ); + serialize( s, "" ); return s.str(); } std::string context( const std::string& parameters ) const { std::stringstream s; - s << name_; if( parameters.empty() ) - s << "()"; + serialize( s, "()" ); else - s << "( " << parameters << " )"; - serialize( s ); + serialize( s, "( " + parameters + " )" ); return s.str(); } + void serialize( std::ostream& s, + const std::string& parameters ) const + { + s << parent_->tag() << name_ << parameters; + for( expectations_cit it = expectations_.begin(); + it != expectations_.end(); ++it ) + s << std::endl << *it; + } std::string name_; node* parent_;