# HG changeset patch # User František Kučera # Date 1580217999 -3600 # Node ID 0766d298eb1c6f7c0f4421c977d8b1c74613d07f # Parent 8a8b6434e4bb6ca6060be66d268c06964f2398da streamlet examples: xpath diff -r 8a8b6434e4bb -r 0766d298eb1c src/SubProcess.h --- a/src/SubProcess.h Mon Jan 27 00:43:39 2020 +0100 +++ b/src/SubProcess.h Tue Jan 28 14:26:39 2020 +0100 @@ -57,7 +57,7 @@ std::wstringstream s; s << L"Message(code: " << code << L", parameters: "; for (int i = 0; i < parameters.size(); i++) { - if (i < parameters.size() - 1) s << parameters[i] << L","; + if (i < parameters.size() - 1) s << parameters[i] << L", "; else s << parameters[i]; } s << L")"; diff -r 8a8b6434e4bb -r 0766d298eb1c streamlet-examples/streamlet-common.h --- a/streamlet-examples/streamlet-common.h Mon Jan 27 00:43:39 2020 +0100 +++ b/streamlet-examples/streamlet-common.h Tue Jan 28 14:26:39 2020 +0100 @@ -23,6 +23,7 @@ #include #include #include +#include #include "../src/StreamletMsg.h" @@ -36,7 +37,7 @@ using S = relpipe::in::filesystem::StreamletMsg; class Streamlet { -private: +protected: class Message { public: @@ -59,6 +60,8 @@ } }; +private: + static const char SEPARATOR = '\0'; int readInt() { @@ -93,6 +96,14 @@ return m; } + /** + * The std::wsmatch contains only references to original string, + * so we need to copy it in order to make it persistent and independent from variables that may evaporate. + */ + void copyMatches(std::wsmatch& source, std::vector& destination) { + for (std::wstring s : source) destination.emplace_back(s); + } + void processMessages() { while (true) { Message m = read(); @@ -128,6 +139,11 @@ public: std::wstring name; std::wstring value; + std::vector nameMatch; + std::vector valueMatch; + + Option(std::wstring name, std::wstring value) : name(name), value(value) { + } }; std::vector versionsSupported; @@ -201,6 +217,38 @@ else return defaultValue; } + virtual std::vector