From 4853a5593cc6147e1851e537b46a5128792939a5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 25 Sep 2018 08:32:16 +0200 Subject: Your Templates are Bad and You Should Feel Bad --- include/object/xdrstream.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/object/xdrstream.h b/include/object/xdrstream.h index 717822e..432f952 100644 --- a/include/object/xdrstream.h +++ b/include/object/xdrstream.h @@ -7,10 +7,13 @@ class XDRStream { private: XDRStream(const XDRStream& copy); uint32_t next_array_len; + bool is_fixed_length; public: XDRStream() : next_array_len(0) {} void setNextArrayLen(uint32_t len) {next_array_len = len;} + void setFixedLength() { is_fixed_length = true; } + void setVariableLength() { is_fixed_length = false; } virtual void put(char c) = 0; @@ -26,7 +29,8 @@ class XDRStream { XDRStream & operator<<(long number); XDRStream & operator<<(unsigned long long number); XDRStream & operator<<(long long number); - XDRStream & operator<<(const char *text); + XDRStream & operator<<(char const *text); + template XDRStream & operator<<(char const (&text)[N]); XDRStream & operator<<(XDRStream & (*fun) (XDRStream &)); }; @@ -37,6 +41,10 @@ XDRStream & flush(XDRStream & os); // TERM: zero-termination XDRStream & term(XDRStream & os); +template XDRStream & opaque(XDRStream & os); +XDRStream & fixed(XDRStream & os); +XDRStream & variable(XDRStream & os); + #endif //OUTPUTSTREAM_H -- cgit v1.2.3