1.1 --- a/c++/parameter-lister/info/globalcode/parameterLister/OutputModule.cpp Tue May 05 22:30:28 2015 +0200
1.2 +++ b/c++/parameter-lister/info/globalcode/parameterLister/OutputModule.cpp Tue May 05 22:46:40 2015 +0200
1.3 @@ -11,12 +11,15 @@
1.4
1.5 for (int i = 0; i < args.size(); i++) {
1.6 string s = args[i];
1.7 - output << i + 1 << ":" << s.length() << " = \"" << s << "\"" << endl;
1.8 + output << i + 1 << ":" << s.length() << " = \"" << escapeValue(s, true) << "\"" << endl;
1.9 }
1.10
1.11 return 0;
1.12 }
1.13
1.14 +string OutputModule::escapeValue(string value, bool colorize) {
1.15 + return value;
1.16 +}
1.17
1.18 }
1.19 }
2.1 --- a/c++/parameter-lister/info/globalcode/parameterLister/OutputModule.h Tue May 05 22:30:28 2015 +0200
2.2 +++ b/c++/parameter-lister/info/globalcode/parameterLister/OutputModule.h Tue May 05 22:46:40 2015 +0200
2.3 @@ -8,16 +8,28 @@
2.4 namespace globalcode {
2.5 namespace parameterLister {
2.6
2.7 +using namespace std;
2.8 +
2.9 class OutputModule {
2.10 public:
2.11 /**
2.12 *
2.13 - * @param output
2.14 - * @param command
2.15 - * @param args
2.16 - * @return exit code
2.17 - */
2.18 - virtual int process(std::ostream &output, std::string &command, std::vector<std::string> &args);
2.19 + * @param output
2.20 + * @param command
2.21 + * @param args
2.22 + * @return exit code
2.23 + */
2.24 + virtual int process(ostream &output, string &command, vector<string> &args);
2.25 +
2.26 +protected:
2.27 + /**
2.28 + * TODO: escape line ends, tabs, esc + deal with unicode/encoding + colorize
2.29 + * @param value
2.30 + * @param colorize
2.31 + * @return
2.32 + */
2.33 + virtual string escapeValue(string value, bool colorize);
2.34 +
2.35 private:
2.36
2.37 };
3.1 --- a/c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.cpp Tue May 05 22:30:28 2015 +0200
3.2 +++ b/c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.cpp Tue May 05 22:46:40 2015 +0200
3.3 @@ -15,8 +15,8 @@
3.4
3.5 output << fgGreen << "<terminalOutputModule>" << fgReset << endl;
3.6
3.7 - for_each(args.begin(), args.end(), [&output, command, fgGreen, fgReset](string s) {
3.8 - output << fgGreen << command << fgReset << ": " << s << endl;
3.9 + for_each(args.begin(), args.end(), [this, &output, command, fgGreen, fgReset](string s) {
3.10 + output << fgGreen << command << fgReset << ": " << escapeValue(s, true) << endl;
3.11 });
3.12
3.13 output << fgGreen << "</terminalOutputModule>" << fgReset << endl;