Calculator
Extensible stack-based calculator primarily in library form
|
Factory to create StackOperators and help from StackOperatorCreators. More...
#include <StackOperatorFactory.h>
Public Member Functions | |
StackOperatorFactory () | |
Create. More... | |
StackOperatorFactory (const StackOperatorFactory &rhs) | |
StackOperatorFactory (StackOperatorFactory &&rhs) | |
StackOperatorFactory & | operator= (const StackOperatorFactory &rhs) |
StackOperatorFactory & | operator= (StackOperatorFactory &&rhs) |
void | addCreator (std::shared_ptr< StackOperatorCreator > creator) |
Add creator as available after all previous creators. More... | |
std::string | getHelp () const |
std::shared_ptr< StackOperator > | create (const std::string &str) const |
Try to create a StackOperator for the given str. More... | |
Factory to create StackOperators and help from StackOperatorCreators.
This class is simple for a reason: if you want to change available commands, create a factory for each situation and provide it when relevant.
Definition at line 31 of file StackOperatorFactory.h.
Calculator::StackOperatorFactory::StackOperatorFactory | ( | ) |
Create.
Definition at line 32 of file StackOperatorFactory.cpp.
Calculator::StackOperatorFactory::StackOperatorFactory | ( | const StackOperatorFactory & | rhs | ) |
Definition at line 37 of file StackOperatorFactory.cpp.
Calculator::StackOperatorFactory::StackOperatorFactory | ( | StackOperatorFactory && | rhs | ) |
Definition at line 42 of file StackOperatorFactory.cpp.
void Calculator::StackOperatorFactory::addCreator | ( | std::shared_ptr< StackOperatorCreator > | creator | ) |
Add creator as available after all previous creators.
creator | to add |
Definition at line 59 of file StackOperatorFactory.cpp.
StackOperator::Ptr Calculator::StackOperatorFactory::create | ( | const std::string & | str | ) | const |
Try to create a StackOperator for the given str.
str | to use in attempting to create a StackOperator |
Definition at line 73 of file StackOperatorFactory.cpp.
std::string Calculator::StackOperatorFactory::getHelp | ( | ) | const |
Definition at line 63 of file StackOperatorFactory.cpp.
StackOperatorFactory & Calculator::StackOperatorFactory::operator= | ( | const StackOperatorFactory & | rhs | ) |
Definition at line 48 of file StackOperatorFactory.cpp.
StackOperatorFactory & Calculator::StackOperatorFactory::operator= | ( | StackOperatorFactory && | rhs | ) |
Definition at line 53 of file StackOperatorFactory.cpp.