Warning, file /include/catch2/interfaces/catch_interfaces_generatortracker.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED
0009 #define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED
0010
0011 #include <catch2/internal/catch_unique_ptr.hpp>
0012 #include <catch2/internal/catch_stringref.hpp>
0013
0014 #include <string>
0015
0016 namespace Catch {
0017
0018 namespace Generators {
0019 class GeneratorUntypedBase {
0020
0021
0022 mutable std::string m_stringReprCache;
0023
0024
0025 std::size_t m_currentElementIndex = 0;
0026
0027
0028
0029
0030
0031
0032
0033 virtual bool next() = 0;
0034
0035
0036 virtual std::string stringifyImpl() const = 0;
0037
0038 public:
0039 GeneratorUntypedBase() = default;
0040
0041
0042 GeneratorUntypedBase(GeneratorUntypedBase const&) = default;
0043 GeneratorUntypedBase& operator=(GeneratorUntypedBase const&) = default;
0044
0045 virtual ~GeneratorUntypedBase();
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 bool countedNext();
0058
0059 std::size_t currentElementIndex() const { return m_currentElementIndex; }
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 StringRef currentElementAsString() const;
0075 };
0076 using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>;
0077
0078 }
0079
0080 class IGeneratorTracker {
0081 public:
0082 virtual ~IGeneratorTracker();
0083 virtual auto hasGenerator() const -> bool = 0;
0084 virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
0085 virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
0086 };
0087
0088 }
0089
0090 #endif