Engauge Digitizer  2
LoggerUpload.cpp
1 #include <iostream>
2 #include "LoggerUpload.h"
3 #include "MainWindow.h"
4 
5 const MainWindow *LoggerUpload::m_mainWindow = (const MainWindow*) 0;
6 
8 {
9 }
10 
12 {
13  m_mainWindow = mainWindow;
14 }
15 
16 void LoggerUpload::loggerAssert(const char *condition,
17  const char* file,
18  int line)
19 {
20  loggerOutput (condition,
21  file,
22  line,
23  "assert");
24 }
25 
26 void LoggerUpload::loggerCheckPtr(const char *ptr,
27  const char *file,
28  int line)
29 {
30  loggerOutput (ptr,
31  file,
32  line,
33  "null pointer");
34 }
35 
36 void LoggerUpload::loggerOutput(const char *comment,
37  const char *file,
38  int line,
39  const char *context)
40 {
41  if (m_mainWindow != 0) {
42  m_mainWindow->saveErrorReportFileAndExit(comment,
43  file,
44  line,
45  context);
46  }
47 
48  std::cerr << "Error '" << context << "' at file " << file << " line " << line << ": " << comment << std::endl;
49  exit (-1); // Stop execution since it is no longer safe to continue
50 }
LoggerUpload()
Single constructor.
Definition: LoggerUpload.cpp:7
static void loggerAssert(const char *condition, const char *file, int line) NO_RETURN_VALUE
Smart equivalent to standard assert method and Q_ASSERT (in qglobal.h).
static void bindToMainWindow(const MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
static void loggerCheckPtr(const char *pointer, const char *file, int line) NO_RETURN_VALUE
Smart equivalent to Q_CHECK_PTR (in qglobal.h). Similar to loggerAssert but for checking newly-alloca...
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:66