Move SavingSourceAdapter to serialise.hh

This commit is contained in:
Eelco Dolstra 2017-02-07 19:21:54 +01:00
parent ce4d8e3ef8
commit ddb5577f2e
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 15 additions and 15 deletions

View file

@ -139,6 +139,21 @@ struct StringSource : Source
};
/* Adapter class of a Source that saves all data read to `s'. */
struct SavingSourceAdapter : Source
{
Source & orig;
string s;
SavingSourceAdapter(Source & orig) : orig(orig) { }
size_t read(unsigned char * data, size_t len)
{
size_t n = orig.read(data, len);
s.append((const char *) data, n);
return n;
}
};
void writePadding(size_t len, Sink & sink);
void writeString(const unsigned char * buf, size_t len, Sink & sink);

View file

@ -168,21 +168,6 @@ struct RetrieveRegularNARSink : ParseSink
};
/* Adapter class of a Source that saves all data read to `s'. */
struct SavingSourceAdapter : Source
{
Source & orig;
string s;
SavingSourceAdapter(Source & orig) : orig(orig) { }
size_t read(unsigned char * data, size_t len)
{
size_t n = orig.read(data, len);
s.append((const char *) data, n);
return n;
}
};
static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVersion,
Source & from, Sink & to, unsigned int op)
{