Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_context.h
Go to the documentation of this file.
1/*
2 * Created by Phil on 31/12/2010.
3 * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
4 *
5 * Distributed under the Boost Software License, Version 1.0. (See accompanying
6 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 */
8#ifndef TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
9#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
10
11#include <memory>
12
13namespace Catch {
14
15 struct IResultCapture;
16 struct IRunner;
17 struct IConfig;
18 struct IMutableContext;
19
20 using IConfigPtr = std::shared_ptr<IConfig const>;
21
22 struct IContext
23 {
24 virtual ~IContext();
25
27 virtual IRunner* getRunner() = 0;
28 virtual IConfigPtr const& getConfig() const = 0;
29 };
30
32 {
34 virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
35 virtual void setRunner( IRunner* runner ) = 0;
36 virtual void setConfig( IConfigPtr const& config ) = 0;
37
38 private:
39 static IMutableContext *currentContext;
41 friend void cleanUpContext();
42 static void createContext();
43 };
44
46 {
47 if( !IMutableContext::currentContext )
48 IMutableContext::createContext();
49 return *IMutableContext::currentContext;
50 }
51
53 {
55 }
56
57 void cleanUpContext();
58}
59
60#endif // TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
IContext & getCurrentContext()
IMutableContext & getCurrentMutableContext()
std::shared_ptr< IConfig const > IConfigPtr
void cleanUpContext()
virtual IResultCapture * getResultCapture()=0
virtual IRunner * getRunner()=0
virtual IConfigPtr const & getConfig() const =0
virtual ~IContext()
virtual void setResultCapture(IResultCapture *resultCapture)=0
virtual void setConfig(IConfigPtr const &config)=0
friend void cleanUpContext()
friend IMutableContext & getCurrentMutableContext()
virtual void setRunner(IRunner *runner)=0