mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
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
This commit is contained in:
parent
9a1ad0f833
commit
a745ecfb0a
4 changed files with 61 additions and 39 deletions
|
|
@ -46,6 +46,7 @@
|
||||||
<ClInclude Include="..\..\turtle\detail\parameters.hpp" />
|
<ClInclude Include="..\..\turtle\detail\parameters.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\parent.hpp" />
|
<ClInclude Include="..\..\turtle\detail\parent.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\root.hpp" />
|
<ClInclude Include="..\..\turtle\detail\root.hpp" />
|
||||||
|
<ClInclude Include="..\..\turtle\detail\sequence_impl.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\signature.hpp" />
|
<ClInclude Include="..\..\turtle\detail\signature.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\type_name.hpp" />
|
<ClInclude Include="..\..\turtle\detail\type_name.hpp" />
|
||||||
<ClInclude Include="..\..\turtle\detail\verifiable.hpp" />
|
<ClInclude Include="..\..\turtle\detail\verifiable.hpp" />
|
||||||
|
|
|
||||||
|
|
@ -130,5 +130,8 @@
|
||||||
<ClInclude Include="..\..\turtle\detail\parameter.hpp">
|
<ClInclude Include="..\..\turtle\detail\parameter.hpp">
|
||||||
<Filter>Source Files\detail</Filter>
|
<Filter>Source Files\detail</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\turtle\detail\sequence_impl.hpp">
|
||||||
|
<Filter>Source Files\detail</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
56
turtle/detail/sequence_impl.hpp
Normal file
56
turtle/detail/sequence_impl.hpp
Normal file
|
|
@ -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 <boost/noncopyable.hpp>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
@ -9,49 +9,11 @@
|
||||||
#ifndef MOCK_SEQUENCE_HPP_INCLUDED
|
#ifndef MOCK_SEQUENCE_HPP_INCLUDED
|
||||||
#define MOCK_SEQUENCE_HPP_INCLUDED
|
#define MOCK_SEQUENCE_HPP_INCLUDED
|
||||||
|
|
||||||
#include <boost/noncopyable.hpp>
|
#include "detail/sequence_impl.hpp"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <algorithm>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace mock
|
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
|
class sequence
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue