* fix enabling/disabling of LyXErr.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22017 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-08 15:02:34 +00:00
parent e71e663b8e
commit cfc37ecf8e
2 changed files with 18 additions and 14 deletions

View File

@ -153,36 +153,37 @@ bool LyXErr::debugging(Debug::Type t) const
void LyXErr::endl()
{
stream() << std::endl;
if (enabled_)
stream() << std::endl;
}
LyXErr & operator<<(LyXErr & l, void const * t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, char const * t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, char t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, int t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, unsigned int t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, long t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, unsigned long t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, double t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, std::string const & t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, docstring const & t)
{ l.stream() << to_utf8(t); return l; }
{ if (l.enabled()) l.stream() << to_utf8(t); return l; }
LyXErr & operator<<(LyXErr & l, support::FileName const & t)
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, std::ostream &(*t)(std::ostream &))
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, std::ios_base &(*t)(std::ios_base &))
{ l.stream() << t; return l; }
{ if (l.enabled()) l.stream() << t; return l; }
// The global instance

View File

@ -120,10 +120,13 @@ inline void operator|=(Debug::Type & d1, Debug::Type d2)
class LyXErr
{
public:
LyXErr(): enabled_(true) {}
/// Disable the stream completely
void disable();
/// Enable the stream after a possible call of disable()
void enable();
///
bool enabled() const { return enabled_; }
/// Returns true if t is part of the current debug level.
bool debugging(Debug::Type t = Debug::ANY) const;
/// Ends output