Moved some components into a detail sub-directory

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@522 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-07-22 07:17:37 +00:00
parent 0530c4c18c
commit ebbe042ab8
4 changed files with 54 additions and 33 deletions

View file

@ -31,6 +31,7 @@
<ClInclude Include="..\..\turtle\detail\context.hpp" />
<ClInclude Include="..\..\turtle\detail\expectation_base.hpp" />
<ClInclude Include="..\..\turtle\detail\expectation_template.hpp" />
<ClInclude Include="..\..\turtle\detail\formatter.hpp" />
<ClInclude Include="..\..\turtle\detail\function.hpp" />
<ClInclude Include="..\..\turtle\detail\function_impl_template.hpp" />
<ClInclude Include="..\..\turtle\detail\function_iterate.hpp" />

View file

@ -127,5 +127,8 @@
<ClInclude Include="..\..\turtle\detail\sequence_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\formatter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -0,0 +1,49 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_FORMATTER_HPP_INCLUDED
#define MOCK_FORMATTER_HPP_INCLUDED
#include "stream.hpp"
#include <boost/utility/addressof.hpp>
namespace mock
{
namespace detail
{
template< typename T >
struct formatter
{
explicit formatter( const T& t )
: t_( boost::addressof( t ) )
{}
void serialize( stream& s ) const
{
detail::serialize( s, *t_ );
}
const T* t_;
};
template< typename T >
stream& operator<<( stream& s, const formatter< T >& f )
{
f.serialize( s );
return s;
}
template< typename T >
std::ostream& operator<<( std::ostream& s, const formatter< T >& f )
{
stream ss( s );
f.serialize( ss );
return s;
}
}
} // mock
#endif // MOCK_FORMATTER_HPP_INCLUDED

View file

@ -9,42 +9,10 @@
#ifndef MOCK_FORMAT_HPP_INCLUDED
#define MOCK_FORMAT_HPP_INCLUDED
#include "stream.hpp"
#include <boost/utility/addressof.hpp>
#include "detail/formatter.hpp"
namespace mock
{
namespace detail
{
template< typename T >
struct formatter
{
explicit formatter( const T& t )
: t_( boost::addressof( t ) )
{}
void serialize( stream& s ) const
{
detail::serialize( s, *t_ );
}
const T* t_;
};
template< typename T >
stream& operator<<( stream& s, const formatter< T >& f )
{
f.serialize( s );
return s;
}
template< typename T >
std::ostream& operator<<( std::ostream& s, const formatter< T >& f )
{
stream ss( s );
f.serialize( ss );
return s;
}
}
template< typename T >
detail::formatter< T > format( const T& t )
{