summary refs log tree commit diff
path: root/src/libutil/serialise.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30 22:43:55 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30 22:43:55 +0000
commit0565b5f2b35dc153dc98e1e3bd37476aa13ee4f1 (patch)
treea370db3e93b6e07f044fc436092c9d082da9c8be /src/libutil/serialise.cc
parentaac547a8b3f481fda48cc1fe1082ce4c32be0e03 (diff)
downloadguix-0565b5f2b35dc153dc98e1e3bd37476aa13ee4f1.tar.gz
* More remote operations.
* Added new operation hasSubstitutes(), which is more efficient than
  querySubstitutes().size() > 0.

Diffstat (limited to 'src/libutil/serialise.cc')
-rw-r--r--src/libutil/serialise.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc
index aa11c590af..969f638ef4 100644
--- a/src/libutil/serialise.cc
+++ b/src/libutil/serialise.cc
@@ -48,6 +48,14 @@ void writeString(const string & s, Sink & sink)
 }
 
 
+void writeStringSet(const StringSet & ss, Sink & sink)
+{
+    writeInt(ss.size(), sink);
+    for (StringSet::iterator i = ss.begin(); i != ss.end(); ++i)
+        writeString(*i, sink);
+}
+
+
 void readPadding(unsigned int len, Source & source)
 {
     if (len % 8) {
@@ -84,4 +92,14 @@ string readString(Source & source)
 }
 
  
+StringSet readStringSet(Source & source)
+{
+    unsigned int count = readInt(source);
+    StringSet ss;
+    while (count--)
+        ss.insert(readString(source));
+    return ss;
+}
+
+
 }