qa.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2007, 2008 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_QA_HH
00021 #define PALUDIS_GUARD_PALUDIS_QA_HH 1
00022 
00023 #include <paludis/qa-fwd.hh>
00024 #include <paludis/package_id.hh>
00025 #include <paludis/metadata_key-fwd.hh>
00026 #include <paludis/util/fs_entry.hh>
00027 #include <paludis/util/sequence-fwd.hh>
00028 #include <paludis/util/set-fwd.hh>
00029 #include <paludis/util/named_value.hh>
00030 
00031 /** \file
00032  * Declarations for Repository QA classes.
00033  *
00034  * \ingroup g_repository
00035  *
00036  * \section Examples
00037  *
00038  * - \ref example_repository.cc "example_repository.cc"
00039  */
00040 
00041 namespace paludis
00042 {
00043     namespace n
00044     {
00045         struct associated_ids;
00046         struct associated_keys;
00047         struct entry;
00048         struct level;
00049         struct message;
00050         struct name;
00051     }
00052 
00053     /**
00054      * Parameters for a QA message.
00055      *
00056      * \see RepositoryQAInterface
00057      * \ingroup g_repository
00058      * \since 0.26
00059      * \nosubgrouping
00060      */
00061     struct PALUDIS_VISIBLE QAMessage
00062     {
00063         typedef Sequence<std::pair<std::tr1::shared_ptr<const PackageID>, std::tr1::shared_ptr<const MetadataKey> > > KeysSequence;
00064 
00065         NamedValue<n::associated_ids, std::tr1::shared_ptr<PackageIDSet> > associated_ids;
00066         NamedValue<n::associated_keys, std::tr1::shared_ptr<KeysSequence> > associated_keys;
00067         NamedValue<n::entry, FSEntry> entry;
00068         NamedValue<n::level, QAMessageLevel> level;
00069         NamedValue<n::message, std::string> message;
00070         NamedValue<n::name, std::string> name;
00071 
00072         static std::tr1::shared_ptr<PackageIDSet> default_associated_ids();
00073         static std::tr1::shared_ptr<KeysSequence> default_associated_keys();
00074         QAMessage & with_associated_id(const std::tr1::shared_ptr<const PackageID> &);
00075         QAMessage & with_associated_key(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<const MetadataKey> &);
00076 
00077         QAMessage(const FSEntry &, const QAMessageLevel &, const std::string & name, const std::string & message);
00078     };
00079 
00080     /**
00081      * A QAReporter subclass is passed to RepositoryQAInterface::check_qa to do
00082      * the reporting.
00083      *
00084      * \ingroup g_repository
00085      */
00086     class PALUDIS_VISIBLE QAReporter
00087     {
00088         public:
00089             virtual ~QAReporter() = 0;
00090 
00091             /**
00092              * Report a QA message.
00093              */
00094             virtual void message(const QAMessage &) = 0;
00095 
00096             /**
00097              * Update status.
00098              */
00099             virtual void status(const std::string &) = 0;
00100     };
00101 }
00102 
00103 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4