Clean-ups to logging and type signatures
[invirt/third/libt4.git] / rpc / marshall.h
index 597c0fc..69b10df 100644 (file)
@@ -32,7 +32,7 @@ class marshall {
         // with header
         inline operator string() const { return buf_.substr(0,index_); }
         // without header
-        inline string content() { return buf_.substr(RPC_HEADER_SZ,index_-RPC_HEADER_SZ); }
+        inline string content() const { return buf_.substr(RPC_HEADER_SZ,index_-RPC_HEADER_SZ); }
 
         // letting S be a defaulted template parameter forces the compiler to
         // delay looking up operator<<(marshall&, rpc_sz_t) until we define it
@@ -234,4 +234,17 @@ operator>>(unmarshall &u, E &e) {
     return u;
 }
 
+//
+// Recursive marshalling
+//
+
+inline marshall & operator<<(marshall &m, marshall &n) {
+    return m << n.content();
+}
+
+inline unmarshall & operator>>(unmarshall &u, unmarshall &v) {
+    v = unmarshall(u._grab<string>(), false);
+    return u;
+}
+
 #endif