OTest2
A C++ testing framework
commandstack.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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__INCLUDE_OTEST2_COMMANDSTACK_H_
21 #define OTest2__INCLUDE_OTEST2_COMMANDSTACK_H_
22 
23 #include <otest2/commandptr.h>
24 
25 namespace OTest2 {
26 
30 class CommandStack {
31  private:
32  struct Impl;
33  Impl* pimpl;
34 
35  public:
36  /* -- avoid copying */
38  const CommandStack&) = delete;
40  const CommandStack&) = delete;
41 
45  CommandStack();
46 
50  ~CommandStack();
51 
57  void pushCommand(
58  CommandPtr command_);
59 
65  void replaceCommand(
66  CommandPtr command_);
67 
73  CommandPtr topCommand() const;
74 
78  void popCommand();
79 
83  bool empty() const;
84 };
85 
86 } /* namespace OTest2 */
87 
88 #endif /* OTest2__INCLUDE_OTEST2_COMMANDSTACK_H_ */
OTest2::CommandStack::operator=
CommandStack & operator=(const CommandStack &)=delete
OTest2::CommandStack::popCommand
void popCommand()
Pop a command from the top of the stack.
Definition: commandstack.cpp:85
OTest2::CommandStack::pushCommand
void pushCommand(CommandPtr command_)
Push a command into the stack.
Definition: commandstack.cpp:67
OTest2::CommandStack::~CommandStack
~CommandStack()
Dtor.
Definition: commandstack.cpp:63
OTest2::CommandStack::empty
bool empty() const
Check whether the stack is empty.
Definition: commandstack.cpp:90
OTest2
Definition: assertbean.h:25
OTest2::CommandStack::CommandStack
CommandStack()
Ctor.
Definition: commandstack.cpp:58
OTest2::CommandStack::replaceCommand
void replaceCommand(CommandPtr command_)
Replace a command at the top of the stack.
Definition: commandstack.cpp:73
OTest2::CommandStack::topCommand
CommandPtr topCommand() const
Get the top command.
Definition: commandstack.cpp:80
OTest2::CommandPtr
std::shared_ptr< Command > CommandPtr
Definition: commandptr.h:27
OTest2::CommandStack
Stack of framework commands.
Definition: commandstack.h:30
commandptr.h