/usr/include/qgis/qgserror.h is in libqgis-dev 2.8.6+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /***************************************************************************
qgserror.h - Error container
-------------------
begin : October 2012
copyright : (C) 2012 Radim Blazek
email : radim dot blazek at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSERROR_H
#define QGSERROR_H
#include <QString>
#include <QList>
// Macro to create Error message including info about where it was created.
#define QGS_ERROR_MESSAGE(message, tag) QgsErrorMessage(QString(message),QString(tag), QString(__FILE__), QString(__FUNCTION__), __LINE__)
/** \ingroup core
* QgsErrorMessage represents single error message.
*/
class CORE_EXPORT QgsErrorMessage
{
public:
/** Format */
enum Format
{
Text, // Plain text
Html
};
QgsErrorMessage() : mLine( 0 ), mFormat( Text ) {}
/** Constructor.
* @param theMessage error message string
* @param theTag error label, for example GDAL, GDAL Provider, Raster layer
* @param theFile the file where error was created
* @param theFunction the function where error was created
* @param theLine the line where error was created
*/
QgsErrorMessage( const QString & theMessage, const QString & theTag = QString::null, const QString & theFile = QString::null, const QString & theFunction = QString::null, int theLine = 0 );
QString message() const { return mMessage; }
QString tag() const { return mTag; }
QString file() const { return mFile; }
QString function() const { return mFunction; }
int line() const { return mLine; }
private:
/** Error messages */
QString mMessage;
/** Short description */
QString mTag;
/** Detailed debug info */
QString mFile;
QString mFunction;
int mLine;
/* Message format */
Format mFormat;
};
/** \ingroup core
* QgsError is container for error messages (report). It may contain chain
* (sort of traceback) of error messages (e.g. GDAL - provider - layer).
* Higher level messages are appended at the end.
*/
class CORE_EXPORT QgsError
{
public:
QgsError() {}
/** Constructor with single message.
* @param theMessage error message
* @param theTag short description, e.g. GDAL, Provider, Layer
*/
QgsError( const QString & theMessage, const QString & theTag );
/** Append new error message.
* @param theMessage error message string
* @param theTag error label, for example GDAL, GDAL Provider, Raster layer
*/
void append( const QString & theMessage, const QString & theTag );
/** Append new error message.
* @param theMessage error message
*/
void append( const QgsErrorMessage & theMessage );
/** Test if any error is set.
* @return true if contains error
*/
bool isEmpty() const { return mMessageList.isEmpty(); }
/** Full error messages description
* @param theFormat output format
* @return error report
*/
QString message( QgsErrorMessage::Format theFormat = QgsErrorMessage::Html ) const;
/** Short error description, usually the first error in chain, the real error.
* @return error description
*/
QString summary() const;
/** Clear error messages */
void clear() { mMessageList.clear(); }
private:
/** List of messages */
QList<QgsErrorMessage> mMessageList;
};
#endif
|