Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Generators::TakeGenerator< T > Class Template Reference

#include <catch_generators_generic.hpp>

Inheritance diagram for Catch::Generators::TakeGenerator< T >:
Collaboration diagram for Catch::Generators::TakeGenerator< T >:

Public Member Functions

 TakeGenerator (size_t target, GeneratorWrapper< T > &&generator)
 
T const & get () const override
 
bool next () override
 
 TakeGenerator (size_t target, GeneratorWrapper< T > &&generator)
 
T const & get () const override
 
bool next () override
 
- Public Member Functions inherited from Catch::Generators::IGenerator< T >
virtual ~IGenerator ()=default
 
virtual ~IGenerator ()=default
 
- Public Member Functions inherited from Catch::Generators::GeneratorUntypedBase
 GeneratorUntypedBase ()=default
 
virtual ~GeneratorUntypedBase ()
 
 GeneratorUntypedBase ()=default
 
virtual ~GeneratorUntypedBase ()
 

Additional Inherited Members

- Public Types inherited from Catch::Generators::IGenerator< T >
using type = T
 

Detailed Description

template<typename T>
class Catch::Generators::TakeGenerator< T >

Definition at line 3700 of file catch.hpp.

Constructor & Destructor Documentation

◆ TakeGenerator() [1/2]

template<typename T >
Catch::Generators::TakeGenerator< T >::TakeGenerator ( size_t target,
GeneratorWrapper< T > && generator )
inline

Definition at line 21 of file catch_generators_generic.hpp.

21 :
22 m_generator(std::move(generator)),
23 m_target(target)
24 {
25 assert(target != 0 && "Empty generators are not allowed");
26 }

◆ TakeGenerator() [2/2]

template<typename T >
Catch::Generators::TakeGenerator< T >::TakeGenerator ( size_t target,
GeneratorWrapper< T > && generator )
inline

Definition at line 3705 of file catch.hpp.

3705 :
3706 m_generator(std::move(generator)),
3707 m_target(target)
3708 {
3709 assert(target != 0 && "Empty generators are not allowed");
3710 }

Member Function Documentation

◆ get() [1/2]

template<typename T >
T const & Catch::Generators::TakeGenerator< T >::get ( ) const
inlineoverridevirtual

Implements Catch::Generators::IGenerator< T >.

Definition at line 27 of file catch_generators_generic.hpp.

27 {
28 return m_generator.get();
29 }

◆ get() [2/2]

template<typename T >
T const & Catch::Generators::TakeGenerator< T >::get ( ) const
inlineoverridevirtual

Implements Catch::Generators::IGenerator< T >.

Definition at line 3711 of file catch.hpp.

3711 {
3712 return m_generator.get();
3713 }
Here is the call graph for this function:

◆ next() [1/2]

template<typename T >
bool Catch::Generators::TakeGenerator< T >::next ( )
inlineoverridevirtual

Implements Catch::Generators::GeneratorUntypedBase.

Definition at line 30 of file catch_generators_generic.hpp.

30 {
31 ++m_returned;
32 if (m_returned >= m_target) {
33 return false;
34 }
35
36 const auto success = m_generator.next();
37 // If the underlying generator does not contain enough values
38 // then we cut short as well
39 if (!success) {
40 m_returned = m_target;
41 }
42 return success;
43 }

◆ next() [2/2]

template<typename T >
bool Catch::Generators::TakeGenerator< T >::next ( )
inlineoverridevirtual

Implements Catch::Generators::GeneratorUntypedBase.

Definition at line 3714 of file catch.hpp.

3714 {
3715 ++m_returned;
3716 if (m_returned >= m_target) {
3717 return false;
3718 }
3719
3720 const auto success = m_generator.next();
3721 // If the underlying generator does not contain enough values
3722 // then we cut short as well
3723 if (!success) {
3724 m_returned = m_target;
3725 }
3726 return success;
3727 }
Here is the call graph for this function:

The documentation for this class was generated from the following files: