catch_interfaces_generatortracker.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #ifndef TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
  8. #define TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
  9. #include <memory>
  10. namespace Catch {
  11. namespace Generators {
  12. class GeneratorUntypedBase {
  13. public:
  14. GeneratorUntypedBase() = default;
  15. virtual ~GeneratorUntypedBase();
  16. // Attempts to move the generator to the next element
  17. //
  18. // Returns true iff the move succeeded (and a valid element
  19. // can be retrieved).
  20. virtual bool next() = 0;
  21. };
  22. using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
  23. } // namespace Generators
  24. struct IGeneratorTracker {
  25. virtual ~IGeneratorTracker();
  26. virtual auto hasGenerator() const -> bool = 0;
  27. virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
  28. virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
  29. };
  30. } // namespace Catch
  31. #endif //TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED