c++/parameter-lister/info/globalcode/parameterLister/OutputModule.cpp
author František Kučera <franta-hg@frantovo.cz>
Mon, 04 May 2015 00:29:17 +0200
changeset 14 d81d0a119e76
parent 12 fde958908539
child 16 65f51abd5fb8
permissions -rw-r--r--
use ostream from module arguments instead of std:cout
franta-hg@11
     1
#include <algorithm>
franta-hg@11
     2
franta-hg@7
     3
#include "OutputModule.h"
franta-hg@11
     4
#include "terminalCodes/TerminalCodes.h"
franta-hg@7
     5
franta-hg@8
     6
namespace info {
franta-hg@8
     7
namespace globalcode {
franta-hg@8
     8
namespace parameterLister {
franta-hg@8
     9
franta-hg@11
    10
void OutputModule::process(std::ostream &output, std::string &command, std::vector<std::string> &args) {
franta-hg@11
    11
	terminalCodes::Modifier fgGreen(terminalCodes::FG_GREEN);
franta-hg@11
    12
	terminalCodes::Modifier fgReset(terminalCodes::FG_DEFAULT);
franta-hg@11
    13
franta-hg@11
    14
	using namespace std;
franta-hg@11
    15
franta-hg@11
    16
	output << "<outputModule>" << endl;
franta-hg@11
    17
franta-hg@14
    18
	for_each(args.begin(), args.end(), [&output, command, fgGreen, fgReset](string s) {
franta-hg@14
    19
		output << fgGreen << command << fgReset << ": " << s << endl;
franta-hg@11
    20
	});
franta-hg@14
    21
franta-hg@11
    22
	output << "</outputModule>" << endl;
franta-hg@8
    23
}
franta-hg@8
    24
franta-hg@9
    25
franta-hg@9
    26
}
franta-hg@9
    27
}
franta-hg@9
    28
}
franta-hg@9
    29