11 #include <QTextStream> 15 #define LOGGING_ENABLED 37 LastError& setError(std::string& where, std::string& msg);
38 LastError& setError(
const char* where,
const char* msg, ...);
40 std::string getError();
41 std::string getErrorMsg();
51 #define LASTERROR(msg, ...) Core::LastError::Instance().setError(__FUNCTION__, msg, __VA_ARGS__) 52 #define CLEARLASTERROR() Core::LastError::Instance().setError("", "") 57 virtual void write(
const QString& s) = 0;
67 static int getIndent();
131 Stream(QIODevice* device) : ts(device), ref(1), type(QtDebugMsg),
space(
true), message_output(
false) {}
132 Stream(QString*
string) : ts(
string, QIODevice::WriteOnly), ref(1), type(QtDebugMsg),
space(
true), message_output(
false) {}
133 Stream(QtMsgType t) : ts(&buffer, QIODevice::WriteOnly), ref(1), type(t),
space(
true), message_output(
true) {}
143 #if QT_VERSION >= 0x050000 144 QMessageLogContext context;
153 inline LogClass(QIODevice* device) : stream(new Stream(device)) {}
154 inline LogClass(QString*
string) : stream(new Stream(string)) {}
162 if (stream->message_output && !stream->buffer.isEmpty())
167 if (mylevel ==
D_ALL)
179 if (mylevel ==
D_OFF)
182 QString msg = QString(buf2) + QString(stream->buffer);
183 QMessageLogContext context;
184 qt_message_output(stream->type, context, msg);
192 stream->space =
true;
198 stream->space =
false;
210 stream->ts << qSetRealNumberPrecision(12) << p.
x() <<
" " << p.
y();
215 stream->ts << qSetRealNumberPrecision(12) << p.
x() <<
" " << p.
y() <<
" " << p.
z();
220 stream->ts << qSetRealNumberPrecision(12) << p.
x() <<
" " << p.
y() <<
" " << p.
z();
225 stream->ts << qSetRealNumberPrecision(12) << p.
x() <<
" " << p.
y() <<
" " << p.
z();
237 stream->ts <<
"\'" << t <<
"\'";
242 stream->ts << (bool(t) ?
"true" :
"false");
282 stream->ts << QString::number(t);
287 stream->ts << QString::number(t);
302 stream->ts << qPrintable(t);
313 stream->ts << t.latin1();
341 #ifdef LOGGING_ENABLED 342 void LogV(
LOGLEVEL level,
const QString& s, va_list ap);
351 #define LOGCOMMAND_DEBUG(x) Core::ScopedLogger _____scopedLogger(Core::D_DEBUG, x); 352 #define LOGCOMMAND_INFO(x) Core::ScopedLogger _____scopedLogger(Core::D_INFO, x); 353 #define LOGCOMMAND(x) Core::ScopedLogger _____scopedLogger(Core::D_WARN, x); 354 #define LOGCOMMAND_WARN(x) Core::ScopedLogger _____scopedLogger(Core::D_WARN, x); 355 #define cUserDebug(...) \ 356 if (Core::Settings::getInstance()->getDebugUser()) \ 358 cWarn( __VA_ARGS__); \ 360 #define LOGVAR(var) cDebug() << QString("%1 = %2").arg(#var).arg(var); 372 void setCallBack( std::function<
bool(std::string)> f ) { mCallback = f; }
373 bool callCallBack(std::string s) {
if(mCallback)
return mCallback(s);
return false; }
376 std::function<bool(std::string)> mCallback;
389 #ifdef LOGGING_ENABLED 413 #define cDebug while(false) noDebug 414 #define cInfo while(false) noDebug 415 #define cError while(false) noDebug 416 #define cWarn while(false) noDebug LogClass & operator<<(const Geom::Pnt2d &p)
Definition: Log.h:208
CORE_EXPORT Core::LogClass cWarn()
double z() const
For this point, returns its X coordinate.
NoDebugClass & maybeQuote(const char='"')
Definition: Log.h:120
LogClass & operator<<(const QLatin1String &t)
Definition: Log.h:311
void LogV(LOGLEVEL level, const QString &s, va_list ap)
#define CORE_EXPORT
Definition: core_defines2.h:10
double x() const
Returns the X coordinate for a unit vector.
double y() const
Returns the Y coordinate for a unit vector.
LogClass & operator<<(QTextStreamManipulator m)
Definition: Log.h:332
virtual LogBaseClass & space()=0
double z() const
Returns the Z coordinate for a unit vector.
CORE_EXPORT void cDebuggerBreak(char *message)
LogClass(const LogClass &o)
Definition: Log.h:156
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:42
LogClass & operator<<(char t)
Definition: Log.h:245
LogClass & operator<<(const Geom::Vec &p)
Definition: Log.h:218
NoDebugClass & nospace()
Definition: Log.h:116
NoDebugClass & noquote()
Definition: Log.h:119
CORE_EXPORT Core::LogClass cDebug()
double y() const
For this point, returns its X coordinate.
double x() const
For this vector, returns its X coordinate.
LogClass & space()
Definition: Log.h:190
static CORE_EXPORT void removeLogWriter(LogWriter *writer)
LogClass & operator<<(const void *t)
Definition: Log.h:321
CORE_EXPORT void setLogLevel(LOGLEVEL)
LogClass(LOGLEVEL level, QtMsgType t)
Definition: Log.h:155
LogClass & operator<<(const Geom::Pnt &p)
Definition: Log.h:213
LogClass & operator<<(const Geom::Ax2 &p)
Definition: Log.h:228
LogClass & operator<<(unsigned long t)
Definition: Log.h:275
static bool is_activated
Definition: Log.h:338
LogClass & operator<<(unsigned int t)
Definition: Log.h:265
virtual void write(const QString &s)=0
static CORE_EXPORT void addLogWriter(LogWriter *writer)
CORE_EXPORT void MessageAtScreen(QString fontName, int fontsize, Geom::Vec2d position, Geom::Vec color, const char *msg,...)
double y() const
For this point, returns its y coordinate.
double x() const
For this point, returns its X coordinate.
LogClass & operator<<(QTextStreamFunction f)
Definition: Log.h:326
void setCallBack(std::function< bool(std::string)> f)
Definition: Log.h:372
LogClass & operator<<(unsigned short t)
Definition: Log.h:255
virtual LogBaseClass & maybeSpace()=0
double z() const
For this vector, returns its Z coordinate.
LogClass & operator<<(quint64 t)
Definition: Log.h:285
LogClass & operator<<(bool t)
Definition: Log.h:240
LogClass & operator<<(float t)
Definition: Log.h:290
LogClass & operator<<(const QStringRef &t)
Definition: Log.h:310
LogClass & operator<<(signed short t)
Definition: Log.h:250
ScopedLoggerP * _piml
Definition: Log.h:69
LogClass & operator<<(const QByteArray &t)
Definition: Log.h:316
LogClass & operator<<(double t)
Definition: Log.h:295
virtual LogBaseClass & operator<<(const Geom::Pnt2d &p)=0
LogClass & operator<<(const QString &t)
Definition: Log.h:305
Defines a non-persistent vector in 2D space.
Definition: Vec2d.h:34
static AssertSingleton & getInstance()
Definition: Log.h:365
LogClass & operator<<(QChar t)
Definition: Log.h:235
bool callCallBack(std::string s)
Definition: Log.h:373
LogClass & operator<<(const Geom::Dir &p)
Definition: Log.h:223
CORE_EXPORT LogClass Log(Core::LOGLEVEL level)
LogClass & nospace()
Definition: Log.h:196
LOGLEVEL
Definition: Log.h:19
Defines a non-persistent vector in 3D space.
Definition: Vec.h:45
NoDebugClass & quote()
Definition: Log.h:118
LogClass & operator<<(signed int t)
Definition: Log.h:260
LogClass(QString *string)
Definition: Log.h:154
LogClass & operator<<(signed long t)
Definition: Log.h:270
double x() const
For this point, returns its x coordinate.
LogClass & maybeSpace()
Definition: Log.h:201
~LogClass()
Definition: Log.h:158
CORE_EXPORT Core::LogClass cError()
virtual LogBaseClass & nospace()=0
LogClass & operator<<(const char *t)
Definition: Log.h:300
NoDebugClass & operator<<(QTextStreamFunction)
Definition: Log.h:113
NoDebugClass & operator<<(QTextStreamManipulator)
Definition: Log.h:114
LogClass & operator=(const QDebug &other)
NoDebugClass & space()
Definition: Log.h:115
double y() const
For this vector, returns its Y coordinate.
CORE_EXPORT LOGLEVEL getLogLevel()
LogClass(QIODevice *device)
Definition: Log.h:153
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:33
static std::vector< LogWriter * > logwriter
Definition: Log.h:151
NoDebugClass & operator<<(const T &)
Definition: Log.h:123
LogClass & operator<<(qint64 t)
Definition: Log.h:280
NoDebugClass & maybeSpace()
Definition: Log.h:117
CORE_EXPORT Core::LogClass cInfo()