# HG changeset patch # User František Kučera # Date 1430689303 -7200 # Node ID 145b45ef77510aabc401395a842f4118e800c78b # Parent 598a575ae57fbd36e87fe32cf1ff10b99a2c0f1c shared_ptr diff -r 598a575ae57f -r 145b45ef7751 c++/parameter-lister/CLI.cpp --- a/c++/parameter-lister/CLI.cpp Sun May 03 22:19:03 2015 +0200 +++ b/c++/parameter-lister/CLI.cpp Sun May 03 23:41:43 2015 +0200 @@ -3,6 +3,7 @@ #include #include #include +#include #include "info/globalcode/parameterLister/terminalCodes/TerminalCodes.h" #include "info/globalcode/parameterLister/OutputModule.h" @@ -24,6 +25,9 @@ } } +void process(shared_ptr om) { + om->process(cout); +} } } @@ -62,15 +66,16 @@ cout << "ENV: " << envName << " is missing" << endl; } } - + { - OutputModule om; - TerminalOutputModule tom; - - om.process(cout); - tom.process(cout); + shared_ptr om(new OutputModule()); + shared_ptr tom(new TerminalOutputModule()); + shared_ptr o(new TerminalOutputModule()); + + process(om); + process(tom); + process(o); } - return 0; -} \ No newline at end of file +} diff -r 598a575ae57f -r 145b45ef7751 c++/parameter-lister/info/globalcode/parameterLister/OutputModule.h --- a/c++/parameter-lister/info/globalcode/parameterLister/OutputModule.h Sun May 03 22:19:03 2015 +0200 +++ b/c++/parameter-lister/info/globalcode/parameterLister/OutputModule.h Sun May 03 23:41:43 2015 +0200 @@ -12,7 +12,7 @@ OutputModule(); OutputModule(const OutputModule& orig); virtual ~OutputModule(); - void process(std::ostream &output); + virtual void process(std::ostream &output); private: }; diff -r 598a575ae57f -r 145b45ef7751 c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.h --- a/c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.h Sun May 03 22:19:03 2015 +0200 +++ b/c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.h Sun May 03 23:41:43 2015 +0200 @@ -3,16 +3,18 @@ #include +#include "OutputModule.h" + namespace info { namespace globalcode { namespace parameterLister { -class TerminalOutputModule { +class TerminalOutputModule : public OutputModule { public: TerminalOutputModule(); TerminalOutputModule(const TerminalOutputModule& orig); virtual ~TerminalOutputModule(); - void process(std::ostream &output); + virtual void process(std::ostream &output); private: };