akabeierror.h 1.35 KB
Newer Older
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
/* This file is part of the Chakra project

   Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>

   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 <QtCore/QString>
#include <QtCore/QList>

namespace Akabei {
class Package;
class Operation;

class Error
{
    public:
        enum Type {
            UnknownError = 0,
            FilesystemConflictError = 1,
            PackageConflictError = 2,
            DuplicateTargetError = 3,
            UnresolvableDependenciesError = 4,
            //
            GenericError = 128,
            AkabeiInternalError = 129
        };

        explicit Error(Type type, const QString &description = QString(), Operation *op = 0);
        virtual ~Error();

        Type type() const;

        QString description() const;
        void setDescription(const QString &description);

        Operation *operation();
        void setOperation(Operation *op);

        QList<Package*> targets() const;
        void setTargets(const QList<Package*> &targets);

    private:
        class Private;
        Private * const d;
};

}

#endif // AKABEI_AKABEIERROR_H