File indexing completed on 2025-09-17 08:53:27
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_CONTEXT_HPP_INCLUDED
0009 #define CATCH_CONTEXT_HPP_INCLUDED
0010
0011 #include <catch2/internal/catch_compiler_capabilities.hpp>
0012
0013 namespace Catch {
0014
0015 class IResultCapture;
0016 class IConfig;
0017
0018 class Context {
0019 IConfig const* m_config = nullptr;
0020 IResultCapture* m_resultCapture = nullptr;
0021
0022 CATCH_EXPORT static Context* currentContext;
0023 friend Context& getCurrentMutableContext();
0024 friend Context const& getCurrentContext();
0025 static void createContext();
0026 friend void cleanUpContext();
0027
0028 public:
0029 constexpr IResultCapture* getResultCapture() const {
0030 return m_resultCapture;
0031 }
0032 constexpr IConfig const* getConfig() const { return m_config; }
0033 constexpr void setResultCapture( IResultCapture* resultCapture ) {
0034 m_resultCapture = resultCapture;
0035 }
0036 constexpr void setConfig( IConfig const* config ) { m_config = config; }
0037
0038 };
0039
0040 Context& getCurrentMutableContext();
0041
0042 inline Context const& getCurrentContext() {
0043
0044
0045 if ( !Context::currentContext ) { Context::createContext(); }
0046
0047 return *Context::currentContext;
0048 }
0049
0050 void cleanUpContext();
0051
0052 class SimplePcg32;
0053 SimplePcg32& sharedRng();
0054 }
0055
0056 #endif