diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-09-25 08:32:16 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-09-25 08:32:16 +0200 |
commit | 4853a5593cc6147e1851e537b46a5128792939a5 (patch) | |
tree | 065b3cff26da895e98f5b2052c2883b2e6503587 /include/object | |
parent | b682dc0cde9c7054174c083f44d6739f9648bd66 (diff) |
Your Templates are Bad and You Should Feel Bad
Diffstat (limited to 'include/object')
-rw-r--r-- | include/object/xdrstream.h | 10 |
1 files changed, 9 insertions, 1 deletions
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<int N> 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<int N> XDRStream & opaque(XDRStream & os); +XDRStream & fixed(XDRStream & os); +XDRStream & variable(XDRStream & os); + #endif //OUTPUTSTREAM_H |