use template instead of macro,

no template parsing in debug.h

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32676 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2009-12-30 15:37:14 +00:00
parent 75f6ced64b
commit 1dda726507

View File

@ -197,45 +197,46 @@ void LyXErr::endl()
// It seems not possible to instantiate operator template out of class body // It seems not possible to instantiate operator template out of class body
#define STREAM_OPERATOR(t) \ template<class T>
{\ LyXErr & toStream(LyXErr & l, T t)
if (l.enabled()){\ {
l.stream() << t;\ if (l.enabled()){
if (l.second_used()){\ l.stream() << t;
l.second() << t;\ if (l.second_used()){
ProgressInterface::instance()->lyxerrFlush();\ l.second() << t;
}\ ProgressInterface::instance()->lyxerrFlush();
}\ }
return l;\ }
return l;
} }
LyXErr & operator<<(LyXErr & l, void const * t) LyXErr & operator<<(LyXErr & l, void const * t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, char const * t) LyXErr & operator<<(LyXErr & l, char const * t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, char t) LyXErr & operator<<(LyXErr & l, char t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, int t) LyXErr & operator<<(LyXErr & l, int t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, unsigned int t) LyXErr & operator<<(LyXErr & l, unsigned int t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, long t) LyXErr & operator<<(LyXErr & l, long t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, unsigned long t) LyXErr & operator<<(LyXErr & l, unsigned long t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, double t) LyXErr & operator<<(LyXErr & l, double t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, string const & t) LyXErr & operator<<(LyXErr & l, string const & t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, docstring const & t) LyXErr & operator<<(LyXErr & l, docstring const & t)
STREAM_OPERATOR(to_utf8(t)); { return toStream(l, to_utf8(t)); }
LyXErr & operator<<(LyXErr & l, FileName const & t) LyXErr & operator<<(LyXErr & l, FileName const & t)
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &)) LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &))
STREAM_OPERATOR(t) { return toStream(l, t); }
LyXErr & operator<<(LyXErr & l, ios_base &(*t)(ios_base &)) LyXErr & operator<<(LyXErr & l, ios_base &(*t)(ios_base &))
STREAM_OPERATOR(t) { return toStream(l, t); }
// The global instance // The global instance