diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp index 56472058c5..3805360618 100644 --- a/src/support/docstream.cpp +++ b/src/support/docstream.cpp @@ -447,15 +447,6 @@ otexstream & operator<<(otexstream & ots, SafeBreakLine) } -otexstream & operator<<(otexstream & ots, SetEnc e) -{ - ots.os() << e; - ots.canBreakLine(true); - ots.protectSpace(false); - return ots; -} - - otexstream & operator<<(otexstream & ots, docstring const & s) { size_t const len = s.length(); @@ -511,31 +502,20 @@ otexstream & operator<<(otexstream & ots, char c) } -otexstream & operator<<(otexstream & ots, double d) +template +otexstream & operator<<(otexstream & ots, Type value) { - ots.os() << d; + ots.os() << value; ots.canBreakLine(true); ots.protectSpace(false); return ots; } - -otexstream & operator<<(otexstream & ots, int i) -{ - ots.os() << i; - ots.canBreakLine(true); - ots.protectSpace(false); - return ots; -} - - -otexstream & operator<<(otexstream & ots, unsigned int i) -{ - ots.os() << i; - ots.canBreakLine(true); - ots.protectSpace(false); - return ots; -} +template otexstream & operator<< (otexstream & os, SetEnc); +template otexstream & operator<< (otexstream &, double); +template otexstream & operator<< (otexstream &, int); +template otexstream & operator<< (otexstream &, unsigned int); +template otexstream & operator<< (otexstream &, unsigned long); } diff --git a/src/support/docstream.h b/src/support/docstream.h index 167bdd1e21..40f8e004db 100644 --- a/src/support/docstream.h +++ b/src/support/docstream.h @@ -112,7 +112,7 @@ public: /// void protectSpace(bool protectspace) { protectspace_ = protectspace; } /// - bool protectSpace() const { return protectspace_; }; + bool protectSpace() const { return protectspace_; } private: /// odocstream & os_; @@ -147,11 +147,8 @@ otexstream & operator<<(otexstream &, char const *); /// otexstream & operator<<(otexstream &, char); /// -otexstream & operator<<(otexstream &, double); -/// -otexstream & operator<<(otexstream &, int); -/// -otexstream & operator<<(otexstream &, unsigned int); +template +otexstream & operator<<(otexstream & ots, Type value); /// Helper struct for changing stream encoding struct SetEnc { @@ -171,7 +168,6 @@ SetEnc setEncoding(std::string const & encoding); \endcode */ odocstream & operator<<(odocstream & os, SetEnc e); -otexstream & operator<<(otexstream & os, SetEnc e); idocstream & operator<<(idocstream & os, SetEnc e); }