Commit 5e6cbc63 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3ba362ba
...@@ -194,3 +194,22 @@ error errorf(const char *format, ...) { ...@@ -194,3 +194,22 @@ error errorf(const char *format, ...) {
} }
} // fmt:: } // fmt::
// strings::
namespace strings {
vector<string> split(const string &s, char sep) {
vector<string> r;
int psep_prev=-1, psep;
while (1) {
psep = s.find(sep, psep_prev+1);
if (psep == string::npos)
return r;
r.push_back(s.substr(psep_prev+1, sep-(psep_prev+1)));
psep_prev = sep;
}
}
} // strings::
...@@ -30,6 +30,9 @@ using std::tuple; ...@@ -30,6 +30,9 @@ using std::tuple;
using std::make_tuple; using std::make_tuple;
using std::tie; using std::tie;
#include <vector>
using std::vector;
// nil is synonym for nullptr and NULL. // nil is synonym for nullptr and NULL.
const nullptr_t nil = nullptr; const nullptr_t nil = nullptr;
...@@ -137,6 +140,13 @@ error errorf (const char *format, ...) ...@@ -137,6 +140,13 @@ error errorf (const char *format, ...)
} // fmt:: } // fmt::
// strings::
namespace strings {
vector<string> split(const string &s, char sep);
} // strings::
// ---- misc ---- // ---- misc ----
......
...@@ -684,6 +684,13 @@ error WatchLink::recvReq(IContext *ctx, SrvReq *rx) { ...@@ -684,6 +684,13 @@ error WatchLink::recvReq(IContext *ctx, SrvReq *rx) {
return SrvReq(wlink, stream, msg) return SrvReq(wlink, stream, msg)
} }
// _parsePinReq parses message into PinReq according to wcfs invalidation protocol.
error _parsePinReq(PinReq *out, const string &msg) {
// pin <foid>) #<blk> @<at>
msgv = strings::split(msg, ' ');
if
}
// _readline reads next raw line sent from wcfs. // _readline reads next raw line sent from wcfs.
tuple<string, error> WatchLink::_readline() { tuple<string, error> WatchLink::_readline() {
WatchLink& wlink = *this; WatchLink& wlink = *this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment