Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:08

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_SESSION_HPP_INCLUDED
0009 #define CATCH_SESSION_HPP_INCLUDED
0010 
0011 #include <catch2/internal/catch_commandline.hpp>
0012 #include <catch2/internal/catch_noncopyable.hpp>
0013 #include <catch2/catch_config.hpp>
0014 #include <catch2/internal/catch_unique_ptr.hpp>
0015 #include <catch2/internal/catch_config_wchar.hpp>
0016 
0017 namespace Catch {
0018 
0019     class Session : Detail::NonCopyable {
0020     public:
0021 
0022         Session();
0023         ~Session();
0024 
0025         void showHelp() const;
0026         void libIdentify();
0027 
0028         int applyCommandLine( int argc, char const * const * argv );
0029     #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)
0030         int applyCommandLine( int argc, wchar_t const * const * argv );
0031     #endif
0032 
0033         void useConfigData( ConfigData const& configData );
0034 
0035         template<typename CharT>
0036         int run(int argc, CharT const * const argv[]) {
0037             if (m_startupExceptions)
0038                 return 1;
0039             int returnCode = applyCommandLine(argc, argv);
0040             if (returnCode == 0)
0041                 returnCode = run();
0042             return returnCode;
0043         }
0044 
0045         int run();
0046 
0047         Clara::Parser const& cli() const;
0048         void cli( Clara::Parser const& newParser );
0049         ConfigData& configData();
0050         Config& config();
0051     private:
0052         int runInternal();
0053 
0054         Clara::Parser m_cli;
0055         ConfigData m_configData;
0056         Detail::unique_ptr<Config> m_config;
0057         bool m_startupExceptions = false;
0058     };
0059 
0060 } // end namespace Catch
0061 
0062 #endif // CATCH_SESSION_HPP_INCLUDED