From a745ecfb0ad364c0c85b6091ef11900dae53e51b Mon Sep 17 00:00:00 2001 From: mat007 Date: Sun, 22 Jul 2012 07:16:22 +0000 Subject: [PATCH] Moved some components into a detail sub-directory git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@518 860be788-9bd5-4423-9f1e-828f051e677b --- build/vc100/turtle.vcxproj | 1 + build/vc100/turtle.vcxproj.filters | 3 ++ turtle/detail/sequence_impl.hpp | 56 ++++++++++++++++++++++++++++++ turtle/sequence.hpp | 40 +-------------------- 4 files changed, 61 insertions(+), 39 deletions(-) create mode 100644 turtle/detail/sequence_impl.hpp diff --git a/build/vc100/turtle.vcxproj b/build/vc100/turtle.vcxproj index a9906d5..c453ca7 100644 --- a/build/vc100/turtle.vcxproj +++ b/build/vc100/turtle.vcxproj @@ -46,6 +46,7 @@ + diff --git a/build/vc100/turtle.vcxproj.filters b/build/vc100/turtle.vcxproj.filters index f0de3b3..ac96323 100644 --- a/build/vc100/turtle.vcxproj.filters +++ b/build/vc100/turtle.vcxproj.filters @@ -130,5 +130,8 @@ Source Files\detail + + Source Files\detail + \ No newline at end of file diff --git a/turtle/detail/sequence_impl.hpp b/turtle/detail/sequence_impl.hpp new file mode 100644 index 0000000..e7048a8 --- /dev/null +++ b/turtle/detail/sequence_impl.hpp @@ -0,0 +1,56 @@ +// 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_SEQUENCE_IMPL_HPP_INCLUDED +#define MOCK_SEQUENCE_IMPL_HPP_INCLUDED + +#include +#include +#include +#include + +namespace mock +{ +namespace detail +{ + class sequence_impl : private boost::noncopyable + { + public: + void add( void* e ) + { + elements_.push_back( e ); + } + void remove( void* e ) + { + elements_.erase( std::remove( elements_.begin(), + elements_.end(), e ), elements_.end() ); + } + + bool is_valid( const void* e ) const + { + return std::find( elements_.begin(), elements_.end(), e ) + != elements_.end(); + } + + void invalidate( const void* e ) + { + elements_type::iterator it = + std::find( elements_.begin(), elements_.end(), e ); + if( it != elements_.end() ) + elements_.erase( elements_.begin(), it ); + } + + private: + typedef std::vector< void* > elements_type; + + elements_type elements_; + }; +} +} // mock + +#endif // MOCK_SEQUENCE_IMPL_HPP_INCLUDED diff --git a/turtle/sequence.hpp b/turtle/sequence.hpp index 4d4e86d..b5e5408 100644 --- a/turtle/sequence.hpp +++ b/turtle/sequence.hpp @@ -9,49 +9,11 @@ #ifndef MOCK_SEQUENCE_HPP_INCLUDED #define MOCK_SEQUENCE_HPP_INCLUDED -#include +#include "detail/sequence_impl.hpp" #include -#include -#include namespace mock { -namespace detail -{ - class sequence_impl : private boost::noncopyable - { - public: - void add( void* e ) - { - elements_.push_back( e ); - } - void remove( void* e ) - { - elements_.erase( std::remove( elements_.begin(), - elements_.end(), e ), elements_.end() ); - } - - bool is_valid( const void* e ) const - { - return std::find( elements_.begin(), elements_.end(), e ) - != elements_.end(); - } - - void invalidate( const void* e ) - { - elements_type::iterator it = - std::find( elements_.begin(), elements_.end(), e ); - if( it != elements_.end() ) - elements_.erase( elements_.begin(), it ); - } - - private: - typedef std::vector< void* > elements_type; - - elements_type elements_; - }; -} - class sequence { public: