From ebbe042ab82122bce53e10bd44778c9e2dc03de3 Mon Sep 17 00:00:00 2001 From: mat007 Date: Sun, 22 Jul 2012 07:17:37 +0000 Subject: [PATCH] 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 --- build/vc100/turtle.vcxproj | 1 + build/vc100/turtle.vcxproj.filters | 3 ++ turtle/detail/formatter.hpp | 49 ++++++++++++++++++++++++++++++ turtle/format.hpp | 34 +-------------------- 4 files changed, 54 insertions(+), 33 deletions(-) create mode 100644 turtle/detail/formatter.hpp diff --git a/build/vc100/turtle.vcxproj b/build/vc100/turtle.vcxproj index f87da0f..07825ef 100644 --- a/build/vc100/turtle.vcxproj +++ b/build/vc100/turtle.vcxproj @@ -31,6 +31,7 @@ + diff --git a/build/vc100/turtle.vcxproj.filters b/build/vc100/turtle.vcxproj.filters index cefd6a2..0d98328 100644 --- a/build/vc100/turtle.vcxproj.filters +++ b/build/vc100/turtle.vcxproj.filters @@ -127,5 +127,8 @@ Source Files\detail + + Source Files\detail + \ No newline at end of file diff --git a/turtle/detail/formatter.hpp b/turtle/detail/formatter.hpp new file mode 100644 index 0000000..af711d6 --- /dev/null +++ b/turtle/detail/formatter.hpp @@ -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 + +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 diff --git a/turtle/format.hpp b/turtle/format.hpp index 31306c7..e64d012 100644 --- a/turtle/format.hpp +++ b/turtle/format.hpp @@ -9,42 +9,10 @@ #ifndef MOCK_FORMAT_HPP_INCLUDED #define MOCK_FORMAT_HPP_INCLUDED -#include "stream.hpp" -#include +#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 ) {