Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@140 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2010-03-10 22:43:32 +00:00
parent f6f80d4192
commit a2cf4dbb02

View file

@ -267,31 +267,29 @@ namespace mock
typedef BOOST_DEDUCED_TYPENAME typedef BOOST_DEDUCED_TYPENAME
expectations_type::const_iterator expectations_cit; 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::string context() const
{ {
std::stringstream s; std::stringstream s;
s << parent_->tag() << name_; serialize( s, "" );
serialize( s );
return s.str(); return s.str();
} }
std::string context( const std::string& parameters ) const std::string context( const std::string& parameters ) const
{ {
std::stringstream s; std::stringstream s;
s << name_;
if( parameters.empty() ) if( parameters.empty() )
s << "()"; serialize( s, "()" );
else else
s << "( " << parameters << " )"; serialize( s, "( " + parameters + " )" );
serialize( s );
return s.str(); 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_; std::string name_;
node* parent_; node* parent_;