55 const QString &
file()
const;
57 unsigned line()
const;
103 unsigned count()
const;
107 QString
format(
const QString &indent=
" ")
const;
127 QList<Message> _errorMessageStack;
144 unsigned count() const;
153 QString
format(const QString &indent=" ") const;
162 #define errMsg(stack) (ErrorStack::MessageStream(stack, __FILE__, __LINE__))
A helper class to assemble error messages as streams.
Definition: errorstack.hh:74
const ErrorStack & _stack
Holds a weak reference to the error stack to put the message on.
Definition: errorstack.hh:83
unsigned _line
The line number.
Definition: errorstack.hh:87
QString _message
The message buffer.
Definition: errorstack.hh:89
virtual ~MessageStream()
Destructor, puts the message on the stack.
Definition: errorstack.cc:50
MessageStream(const ErrorStack &stack, const QString &file, unsigned line)
Constructor.
Definition: errorstack.cc:44
QString _file
The file path.
Definition: errorstack.hh:85
Represents a single error message.
Definition: errorstack.hh:47
Message()
Empty constructor.
Definition: errorstack.cc:8
const QString & message() const
Returns the error message.
Definition: errorstack.cc:31
const QString & file() const
Returns the file name.
Definition: errorstack.cc:21
unsigned line() const
Returns the line within the file.
Definition: errorstack.cc:26
QString format() const
Formats the error messaege.
Definition: errorstack.cc:36
unsigned _line
Holds the line.
Definition: errorstack.hh:67
QString _message
Holds the error message.
Definition: errorstack.hh:69
QString _file
Holds the file path.
Definition: errorstack.hh:65
The actual error message stack.
Definition: errorstack.hh:94
Stack() noexcept
Empty constructor.
Definition: errorstack.cc:59
void clear()
Clears the error stack.
Definition: errorstack.cc:106
const Message & message(unsigned i) const
Returns a specific error message.
Definition: errorstack.cc:90
bool isEmpty() const
Returns true if there are any error messages.
Definition: errorstack.cc:80
unsigned count() const
Returns the number of error messages.
Definition: errorstack.cc:85
void unref()
Dereferences a stack, this decreases the ref count.
Definition: errorstack.cc:117
void push(const Message &msg)
Adds an error message to the stack.
Definition: errorstack.cc:66
Stack * ref()
Returns a new reference to the stack.
Definition: errorstack.cc:111
QString format(const QString &indent=" ") const
Returns a formatted string of error messages.
Definition: errorstack.cc:95
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
ErrorStack() noexcept
Default constructor.
Definition: errorstack.cc:127
void take(const ErrorStack &other) const
Takes all messages from the other stack.
Definition: errorstack.cc:172
QString format(const QString &indent=" ") const
Returns a formatted string of error messages.
Definition: errorstack.cc:178
Stack * _stack
A reference to the actual message stack.
Definition: errorstack.hh:157
const Message & message(unsigned i) const
Returns the i-th message from the stack.
Definition: errorstack.cc:162
void push(const Message &msg) const
Pushes a message on the stack.
Definition: errorstack.cc:167
unsigned count() const
Returns the number of elements on the stack.
Definition: errorstack.cc:157
bool isEmpty() const
Returns true, if the stack is empty.
Definition: errorstack.cc:152