/* This file is part of the Chakra project Copyright (C) 2010 Dario Freddi 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 AKABEI_AKABEIERROR_H #define AKABEI_AKABEIERROR_H #include #include namespace Akabei { class Package; class Operation; /** * \class Error akabeierror.h "akabeierror.h" * * \brief Class for describing an error which occurred. */ class Error { public: /** * \enum Type * This enum describes the type of error which occurred. * @see type() */ enum Type { UnknownError = 0, FilesystemConflictError = 1, PackageConflictError = 2, DuplicateTargetError = 3, UnresolvableDependenciesError = 4, DatabaseError = 5, ScripletError = 6, // GenericError = 128, AkabeiInternalError = 129 }; /** * Creates an new error object. * @param type the type of the error * @param description the description of the error * @param op the operation associated with the error */ explicit Error(Type type, const QString &description = QString(), Operation *op = 0); virtual ~Error(); /** * @returns the type of error which occurred */ Type type() const; /** * @returns the description of the error */ QString description() const; /** * Sets a new description of the error. * @param description the new description */ void setDescription(const QString &description); /** * @returns the operation in which the error occurred. Can theoretically be 0. */ Operation *operation(); /** * Sets a new operation associated with the error * @param op the new operation associated with the error */ void setOperation(Operation *op); /** * @returns the targets which are associated with the error */ QList targets() const; /** * Sets new targets associated with the error * @param targets the new targets associated with the error */ void setTargets(const QList &targets); private: class Private; Private * const d; }; } #endif // AKABEI_AKABEIERROR_H