• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Created by Phil Nash on 26/6/2018.
3  *
4  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
5  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  */
7 
8 #ifndef TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
9 #define TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
10 
11 #include <memory>
12 
13 namespace Catch {
14 
15     namespace Generators {
16         class GeneratorUntypedBase {
17         public:
18             GeneratorUntypedBase() = default;
19             virtual ~GeneratorUntypedBase();
20             // Attempts to move the generator to the next element
21              //
22              // Returns true iff the move succeeded (and a valid element
23              // can be retrieved).
24             virtual bool next() = 0;
25         };
26         using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
27 
28     } // namespace Generators
29 
30     struct IGeneratorTracker {
31         virtual ~IGeneratorTracker();
32         virtual auto hasGenerator() const -> bool = 0;
33         virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
34         virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
35     };
36 
37 } // namespace Catch
38 
39 #endif //TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
40