Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2017-04-25 21:51:44 +0100
committerPhil Nash2017-04-25 21:56:14 +0100
commit8ccbf63f28efe0cd8672dfc1d0b993027cb02ab3 (patch)
treebbfb043a581846cf8561e6356b5f192b0ce7de7e /include
parente6094a9503f513480d6b01bc174d8ff725c809b3 (diff)
downloadcatch3-8ccbf63f28efe0cd8672dfc1d0b993027cb02ab3.tar.gz
Removed Ptr, Shared and SharedImpl
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_context.h2
-rw-r--r--include/internal/catch_impl.hpp1
-rw-r--r--include/internal/catch_interfaces_config.h5
-rw-r--r--include/internal/catch_interfaces_registry_hub.h3
-rw-r--r--include/internal/catch_interfaces_reporter.h1
-rw-r--r--include/internal/catch_interfaces_testcase.h3
-rw-r--r--include/internal/catch_ptr.hpp93
-rw-r--r--include/internal/catch_test_case_info.h2
-rw-r--r--include/internal/catch_test_case_registry_impl.hpp2
-rw-r--r--include/internal/catch_test_case_tracker.hpp2
-rw-r--r--include/internal/catch_test_registry.hpp2
-rw-r--r--include/reporters/catch_reporter_bases.hpp4
-rw-r--r--include/reporters/catch_reporter_multi.hpp2
13 files changed, 14 insertions, 108 deletions
diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h
index 77a7d3ac..4dd48a2f 100644
--- a/include/internal/catch_context.h
+++ b/include/internal/catch_context.h
@@ -9,8 +9,8 @@
#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
#include "catch_interfaces_generators.h"
-#include "catch_ptr.hpp"
+#include <memory>
namespace Catch {
diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp
index 9dca5084..978ca1a4 100644
--- a/include/internal/catch_impl.hpp
+++ b/include/internal/catch_impl.hpp
@@ -47,7 +47,6 @@ namespace Catch {
// These are all here to avoid warnings about not having any out of line
// virtual methods
NonCopyable::~NonCopyable() {}
- IShared::~IShared() {}
IStream::~IStream() noexcept {}
FileStream::~FileStream() noexcept {}
CoutStream::~CoutStream() noexcept {}
diff --git a/include/internal/catch_interfaces_config.h b/include/internal/catch_interfaces_config.h
index d9479e07..4f64f4e3 100644
--- a/include/internal/catch_interfaces_config.h
+++ b/include/internal/catch_interfaces_config.h
@@ -8,11 +8,12 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
+#include "catch_common.h"
+
#include <iosfwd>
#include <string>
#include <vector>
-
-#include "catch_ptr.hpp"
+#include <memory>
namespace Catch {
diff --git a/include/internal/catch_interfaces_registry_hub.h b/include/internal/catch_interfaces_registry_hub.h
index 9a42fbad..fb7d87cf 100644
--- a/include/internal/catch_interfaces_registry_hub.h
+++ b/include/internal/catch_interfaces_registry_hub.h
@@ -8,9 +8,10 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
-#include "catch_ptr.hpp"
+#include "catch_common.h"
#include <string>
+#include <memory>
namespace Catch {
diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h
index b0af150f..7679c07a 100644
--- a/include/internal/catch_interfaces_reporter.h
+++ b/include/internal/catch_interfaces_reporter.h
@@ -11,7 +11,6 @@
#include "catch_section_info.h"
#include "catch_common.h"
#include "catch_totals.hpp"
-#include "catch_ptr.hpp"
#include "catch_config.hpp"
#include "catch_test_case_info.h"
#include "catch_assertionresult.h"
diff --git a/include/internal/catch_interfaces_testcase.h b/include/internal/catch_interfaces_testcase.h
index 0c759166..c9ab3238 100644
--- a/include/internal/catch_interfaces_testcase.h
+++ b/include/internal/catch_interfaces_testcase.h
@@ -8,9 +8,8 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
-#include "catch_ptr.hpp"
-
#include <vector>
+#include <memory>
namespace Catch {
diff --git a/include/internal/catch_ptr.hpp b/include/internal/catch_ptr.hpp
deleted file mode 100644
index 4197cf79..00000000
--- a/include/internal/catch_ptr.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Created by Phil on 02/05/2012.
- * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
- *
- * 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 TWOBLUECUBES_CATCH_PTR_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_PTR_HPP_INCLUDED
-
-#include "catch_common.h"
-
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpadded"
-#endif
-
-namespace Catch {
-
- // An intrusive reference counting smart pointer.
- // T must implement addRef() and release() methods
- // typically implementing the IShared interface
- template<typename T>
- class Ptr {
- public:
- Ptr() : m_p( nullptr ){}
- Ptr( T* p ) : m_p( p ){
- if( m_p )
- m_p->addRef();
- }
- Ptr( Ptr const& other ) : m_p( other.m_p ){
- if( m_p )
- m_p->addRef();
- }
- ~Ptr(){
- if( m_p )
- m_p->release();
- }
- void reset() {
- if( m_p )
- m_p->release();
- m_p = nullptr;
- }
- Ptr& operator = ( T* p ){
- Ptr temp( p );
- swap( temp );
- return *this;
- }
- Ptr& operator = ( Ptr const& other ){
- Ptr temp( other );
- swap( temp );
- return *this;
- }
- void swap( Ptr& other ) { std::swap( m_p, other.m_p ); }
- T* get() const{ return m_p; }
- T& operator*() const { return *m_p; }
- T* operator->() const { return m_p; }
- bool operator !() const { return m_p == nullptr; }
- explicit operator bool() const { return m_p != nullptr; }
-
- private:
- T* m_p;
- };
-
- struct IShared : NonCopyable {
- virtual ~IShared();
- virtual void addRef() const = 0;
- virtual void release() const = 0;
- };
-
- template<typename T = IShared>
- struct SharedImpl : T {
-
- SharedImpl() : m_rc( 0 ){}
-
- virtual void addRef() const {
- ++m_rc;
- }
- virtual void release() const {
- if( --m_rc == 0 )
- delete this;
- }
-
- mutable unsigned int m_rc;
- };
-
-} // end namespace Catch
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
-#endif // TWOBLUECUBES_CATCH_PTR_HPP_INCLUDED
diff --git a/include/internal/catch_test_case_info.h b/include/internal/catch_test_case_info.h
index ac83cb3f..1ff0c819 100644
--- a/include/internal/catch_test_case_info.h
+++ b/include/internal/catch_test_case_info.h
@@ -9,10 +9,10 @@
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
#include "catch_common.h"
-#include "catch_ptr.hpp"
#include <string>
#include <set>
+#include <memory>
#ifdef __clang__
#pragma clang diagnostic push
diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp
index e5b1f281..cecbc253 100644
--- a/include/internal/catch_test_case_registry_impl.hpp
+++ b/include/internal/catch_test_case_registry_impl.hpp
@@ -127,7 +127,7 @@ namespace Catch {
///////////////////////////////////////////////////////////////////////////
- class FreeFunctionTestCase : public SharedImpl<ITestCase> {
+ class FreeFunctionTestCase : public ITestCase {
public:
FreeFunctionTestCase( TestFunction fun ) : m_fun( fun ) {}
diff --git a/include/internal/catch_test_case_tracker.hpp b/include/internal/catch_test_case_tracker.hpp
index 8b74e249..c7631384 100644
--- a/include/internal/catch_test_case_tracker.hpp
+++ b/include/internal/catch_test_case_tracker.hpp
@@ -9,7 +9,7 @@
#define TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
#include "catch_compiler_capabilities.h"
-#include "catch_ptr.hpp"
+#include "catch_common.h"
#include <algorithm>
#include <string>
diff --git a/include/internal/catch_test_registry.hpp b/include/internal/catch_test_registry.hpp
index b6d423c8..5be6f6d7 100644
--- a/include/internal/catch_test_registry.hpp
+++ b/include/internal/catch_test_registry.hpp
@@ -15,7 +15,7 @@
namespace Catch {
template<typename C>
-class MethodTestCase : public SharedImpl<ITestCase> {
+class MethodTestCase : public ITestCase {
public:
MethodTestCase( void (C::*method)() ) : m_method( method ) {}
diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp
index 371f9624..6782e8b3 100644
--- a/include/reporters/catch_reporter_bases.hpp
+++ b/include/reporters/catch_reporter_bases.hpp
@@ -41,7 +41,7 @@ namespace Catch {
}
- struct StreamingReporterBase : SharedImpl<IStreamingReporter> {
+ struct StreamingReporterBase : IStreamingReporter {
StreamingReporterBase( ReporterConfig const& _config )
: m_config( _config.fullConfig() ),
@@ -103,7 +103,7 @@ namespace Catch {
ReporterPreferences m_reporterPrefs;
};
- struct CumulativeReporterBase : SharedImpl<IStreamingReporter> {
+ struct CumulativeReporterBase : IStreamingReporter {
template<typename T, typename ChildNodeT>
struct Node {
explicit Node( T const& _value ) : value( _value ) {}
diff --git a/include/reporters/catch_reporter_multi.hpp b/include/reporters/catch_reporter_multi.hpp
index 0fbba771..859e3f83 100644
--- a/include/reporters/catch_reporter_multi.hpp
+++ b/include/reporters/catch_reporter_multi.hpp
@@ -12,7 +12,7 @@
namespace Catch {
-class MultipleReporters : public SharedImpl<IStreamingReporter> {
+class MultipleReporters : public IStreamingReporter {
typedef std::vector<IStreamingReporterPtr > Reporters;
Reporters m_reporters;