summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-09-24 16:34:15 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-09-24 16:34:15 +0200
commitb682dc0cde9c7054174c083f44d6739f9648bd66 (patch)
treebbc0827cb94b2234a4e6d31605d5bdc73313e66e /include
parentaf0e76deef42154fd9914aceb31e5ca80465410e (diff)
Start work on XDR Stream output
Diffstat (limited to 'include')
-rw-r--r--include/object/xdrstream.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/object/xdrstream.h b/include/object/xdrstream.h
new file mode 100644
index 0000000..717822e
--- /dev/null
+++ b/include/object/xdrstream.h
@@ -0,0 +1,42 @@
+#ifndef XDRSTREAM_H
+#define XDRSTREAM_H
+
+#include <stdint.h>
+
+class XDRStream {
+ private:
+ XDRStream(const XDRStream& copy);
+ uint32_t next_array_len;
+
+ public:
+ XDRStream() : next_array_len(0) {}
+ void setNextArrayLen(uint32_t len) {next_array_len = len;}
+
+ virtual void put(char c) = 0;
+
+ virtual void flush() {}
+
+ XDRStream & operator<<(char c);
+ XDRStream & operator<<(unsigned char c);
+ XDRStream & operator<<(unsigned short number);
+ XDRStream & operator<<(short number);
+ XDRStream & operator<<(unsigned int number);
+ XDRStream & operator<<(int number);
+ XDRStream & operator<<(unsigned long number);
+ XDRStream & operator<<(long number);
+ XDRStream & operator<<(unsigned long long number);
+ XDRStream & operator<<(long long number);
+ XDRStream & operator<<(const char *text);
+ XDRStream & operator<<(XDRStream & (*fun) (XDRStream &));
+};
+
+
+// FLUSH: flush XDRStream buffer
+XDRStream & flush(XDRStream & os);
+
+// TERM: zero-termination
+XDRStream & term(XDRStream & os);
+
+XDRStream & opaque(XDRStream & os);
+
+#endif //OUTPUTSTREAM_H