OTest2
A C++ testing framework
scenarioitercontainer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Ondrej Starek
3  *
4  * This file is part of OTest2
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OTest2_LIB_SCENARIOITERCONTAINER_H_
21 #define OTest2_LIB_SCENARIOITERCONTAINER_H_
22 
23 #include <map>
24 #include <vector>
25 
26 #include <scenarioiter.h>
27 #include <scenarioptr.h>
28 
29 namespace OTest2 {
30 
32  private:
33  typedef std::vector<ScenarioPtr> Items;
34  Items items;
35  int index;
36 
37  public:
38  explicit ScenarioIterContainer(
39  const std::map<std::string, ScenarioPtr>& children_);
40  explicit ScenarioIterContainer(
41  const std::vector<ScenarioPtr>& children_);
42  virtual ~ScenarioIterContainer() = default;
43 
44  /* -- avoid copying */
46  const ScenarioIterContainer&) = delete;
48  const ScenarioIterContainer&) = delete;
49 
50  /* -- scenario iterator */
51  virtual bool isValid() const noexcept override;
52  virtual ScenarioPtr getScenario() const noexcept override;
53  virtual void next() noexcept override;
54 };
55 
56 } /* -- namespace OTest2 */
57 
58 #endif /* -- OTest2_LIB_SCENARIOITERCONTAINER_H_ */
OTest2::ScenarioIterContainer::ScenarioIterContainer
ScenarioIterContainer(const std::map< std::string, ScenarioPtr > &children_)
Definition: scenarioitercontainer.cpp:25
OTest2::ScenarioIterContainer::operator=
ScenarioIterContainer & operator=(const ScenarioIterContainer &)=delete
OTest2::ScenarioIterContainer
Definition: scenarioitercontainer.h:31
OTest2::ScenarioIterContainer::isValid
virtual bool isValid() const noexcept override
Check whether the iterator points a valid scenario object.
Definition: scenarioitercontainer.cpp:42
OTest2::ScenarioIterContainer::next
virtual void next() noexcept override
Move the iterator to next scenario.
Definition: scenarioitercontainer.cpp:51
OTest2
Definition: assertbean.h:25
OTest2::ScenarioIterContainer::getScenario
virtual ScenarioPtr getScenario() const noexcept override
Get pointed scenario object.
Definition: scenarioitercontainer.cpp:46
OTest2::ScenarioIterContainer::~ScenarioIterContainer
virtual ~ScenarioIterContainer()=default
OTest2::ScenarioIter
Generic scenario iterator.
Definition: scenarioiter.h:32
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition: scenarioptr.h:27
scenarioiter.h
scenarioptr.h