mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Use default/delete for ctor/dtor
This commit is contained in:
parent
35fa6e63e6
commit
353849e9ad
28 changed files with 100 additions and 92 deletions
|
|
@ -26,8 +26,7 @@ namespace mock
|
|||
template< typename Constraint >
|
||||
struct constraint
|
||||
{
|
||||
constraint()
|
||||
{}
|
||||
constraint() {}
|
||||
constraint( const Constraint& c )
|
||||
: c_( c )
|
||||
{}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#define MOCK_ACTION_HPP_INCLUDED
|
||||
|
||||
#include "../config.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <functional>
|
||||
|
|
@ -112,10 +111,12 @@ namespace detail
|
|||
{
|
||||
return std::move( t );
|
||||
}
|
||||
struct value : boost::noncopyable
|
||||
struct value
|
||||
{
|
||||
virtual ~value()
|
||||
{}
|
||||
value() = default;
|
||||
value(const value&) = delete;
|
||||
value& operator=(const value&) = delete;
|
||||
virtual ~value() = default;
|
||||
};
|
||||
template< typename T >
|
||||
struct value_imp : value
|
||||
|
|
@ -177,8 +178,7 @@ namespace detail
|
|||
: public action_base< std::auto_ptr< Result >, Signature >
|
||||
{
|
||||
public:
|
||||
action()
|
||||
{}
|
||||
action() = default;
|
||||
action( const action& rhs )
|
||||
: v_( rhs.v_.release() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../config.hpp"
|
||||
#include "type_name.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <ostream>
|
||||
|
|
@ -22,11 +21,14 @@ namespace detail
|
|||
{
|
||||
class verifiable;
|
||||
|
||||
class context : boost::noncopyable
|
||||
class context
|
||||
{
|
||||
public:
|
||||
context() {}
|
||||
virtual ~context() {}
|
||||
context() = default;
|
||||
context(const context&) = delete;
|
||||
context& operator=(const context&) = delete;
|
||||
|
||||
virtual ~context() = default;
|
||||
|
||||
virtual void add( const void* p, verifiable& v,
|
||||
boost::unit_test::const_string instance,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <boost/test/utils/lazy_ostream.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#define MOCK_INVOCATION_HPP_INCLUDED
|
||||
|
||||
#include "../config.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <stdexcept>
|
||||
#include <ostream>
|
||||
#include <limits>
|
||||
|
|
@ -19,11 +18,14 @@ namespace mock
|
|||
{
|
||||
namespace detail
|
||||
{
|
||||
class invocation : private boost::noncopyable
|
||||
class invocation
|
||||
{
|
||||
public:
|
||||
invocation() {}
|
||||
virtual ~invocation() {}
|
||||
invocation() = default;
|
||||
invocation(const invocation&) = delete;
|
||||
invocation& operator=(const invocation&) = delete;
|
||||
|
||||
virtual ~invocation() = default;
|
||||
|
||||
virtual bool invoke() = 0;
|
||||
virtual bool verify() const = 0;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@ namespace detail
|
|||
template<
|
||||
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) >
|
||||
class matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
|
||||
: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
virtual ~matcher_base() {}
|
||||
matcher_base() = default;
|
||||
matcher_base(const matcher_base&) = delete;
|
||||
matcher_base& operator=(const matcher_base&) = delete;
|
||||
virtual ~matcher_base() = default;
|
||||
|
||||
virtual bool operator()(
|
||||
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) = 0;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../config.hpp"
|
||||
#include "singleton.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <memory>
|
||||
|
||||
#ifdef MOCK_THREAD_SAFE
|
||||
|
|
@ -75,8 +74,12 @@ namespace mock
|
|||
{
|
||||
namespace detail
|
||||
{
|
||||
struct mutex : boost::noncopyable
|
||||
struct mutex
|
||||
{
|
||||
mutex() = default;
|
||||
mutex(const mutex&) = delete;
|
||||
mutex& operator=(const mutex&) = delete;
|
||||
|
||||
void lock()
|
||||
{}
|
||||
void unlock()
|
||||
|
|
@ -86,18 +89,17 @@ namespace detail
|
|||
// Constructor + Destructor make it RAII classes for compilers and avoid unused variable warnings
|
||||
struct scoped_lock
|
||||
{
|
||||
scoped_lock( mutex& )
|
||||
{}
|
||||
~scoped_lock()
|
||||
{}
|
||||
scoped_lock(const scoped_lock&) = delete;
|
||||
scoped_lock& operator=(const scoped_lock&) = delete;
|
||||
|
||||
scoped_lock( mutex& ) {}
|
||||
~scoped_lock() {}
|
||||
};
|
||||
class lock
|
||||
{
|
||||
public:
|
||||
lock( const std::shared_ptr< mutex >& )
|
||||
{}
|
||||
~lock()
|
||||
{}
|
||||
lock( const std::shared_ptr< mutex >& ) {}
|
||||
~lock() {}
|
||||
lock(const lock&) = delete;
|
||||
lock( lock&& ) = default;
|
||||
lock& operator=( const lock& ) = delete;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ namespace detail
|
|||
class parent
|
||||
{
|
||||
public:
|
||||
parent()
|
||||
{}
|
||||
parent() = default;
|
||||
parent( boost::unit_test::const_string instance,
|
||||
boost::optional< type_name > type )
|
||||
: instance_( instance )
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../config.hpp"
|
||||
#include "mutex.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
@ -20,7 +19,7 @@ namespace mock
|
|||
{
|
||||
namespace detail
|
||||
{
|
||||
class sequence_impl : private boost::noncopyable
|
||||
class sequence_impl
|
||||
{
|
||||
public:
|
||||
sequence_impl()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ protected:
|
|||
#define MOCK_SINGLETON_CONS( type ) \
|
||||
private: \
|
||||
friend class mock::detail::singleton< type >; \
|
||||
type() {}
|
||||
type() = default
|
||||
|
||||
#define MOCK_SINGLETON_INST( inst ) \
|
||||
static BOOST_JOIN( inst, _t )& inst = BOOST_JOIN( inst, _t )::instance();
|
||||
|
|
|
|||
|
|
@ -10,17 +10,18 @@
|
|||
#define MOCK_VERIFIABLE_HPP_INCLUDED
|
||||
|
||||
#include "../config.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class verifiable : private boost::noncopyable
|
||||
class verifiable
|
||||
{
|
||||
public:
|
||||
verifiable() {}
|
||||
virtual ~verifiable() {}
|
||||
verifiable() = default;
|
||||
verifiable(const verifiable&) = delete;
|
||||
verifiable& operator=(const verifiable&) = delete;
|
||||
virtual ~verifiable() = default;
|
||||
|
||||
virtual bool verify() const = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ namespace detail
|
|||
: impl_( std::make_shared< detail::object_impl >() )
|
||||
{}
|
||||
protected:
|
||||
~object()
|
||||
{}
|
||||
~object() = default;
|
||||
public:
|
||||
std::shared_ptr< detail::object_impl > impl_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#define MOCK_STREAM_HPP_INCLUDED
|
||||
|
||||
#include "config.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace mock
|
||||
|
|
@ -41,10 +40,13 @@ namespace conversion
|
|||
return s << '?';
|
||||
}
|
||||
|
||||
struct holder : boost::noncopyable
|
||||
struct holder
|
||||
{
|
||||
virtual ~holder()
|
||||
{}
|
||||
holder() = default;
|
||||
holder(const holder&) = delete;
|
||||
holder& operator=(const holder&) = delete;
|
||||
|
||||
virtual ~holder() = default;
|
||||
virtual void serialize( std::ostream& s ) const = 0;
|
||||
};
|
||||
|
||||
|
|
@ -64,12 +66,14 @@ namespace conversion
|
|||
const T& t_;
|
||||
};
|
||||
|
||||
struct any : boost::noncopyable
|
||||
struct any
|
||||
{
|
||||
template< typename T >
|
||||
any( const T& t )
|
||||
: h_( new holder_imp< T >( t ) )
|
||||
{}
|
||||
any(const any&) = delete;
|
||||
any& operator=(const any&) = delete;
|
||||
~any()
|
||||
{
|
||||
delete h_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue