fake_repository_base.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2005, 2006, 2007, 2008, 2009 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_FAKE_REPOSITORY_BASE_HH
00021 #define PALUDIS_GUARD_PALUDIS_FAKE_REPOSITORY_BASE_HH 1
00022 
00023 #include <paludis/repository.hh>
00024 #include <paludis/action-fwd.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 
00027 /** \file
00028  * Declarations for the FakeRepositoryBase class.
00029  *
00030  * \ingroup grpfakerepository
00031  */
00032 
00033 namespace paludis
00034 {
00035     class FakePackageID;
00036 
00037     /**
00038      * A FakeRepositoryBase is a Repository subclass whose subclasses are used for
00039      * various test cases.
00040      *
00041      * \see FakeRepository
00042      * \see FakeInstalledRepository
00043      * \ingroup grpfakerepository
00044      */
00045     class PALUDIS_VISIBLE FakeRepositoryBase :
00046         public Repository,
00047         private PrivateImplementationPattern<FakeRepositoryBase>,
00048         public std::tr1::enable_shared_from_this<FakeRepositoryBase>
00049     {
00050         private:
00051             PrivateImplementationPattern<FakeRepositoryBase>::ImpPtr & _imp;
00052 
00053         protected:
00054             /**
00055              * Constructor.
00056              */
00057             FakeRepositoryBase(const Environment * const env, const RepositoryName & name,
00058                     const RepositoryCapabilities & caps);
00059 
00060             virtual void need_keys_added() const;
00061 
00062         public:
00063             /**
00064              * Destructor.
00065              */
00066             ~FakeRepositoryBase();
00067 
00068             /**
00069              * Add a category.
00070              */
00071             void add_category(const CategoryNamePart &);
00072 
00073             /**
00074              * Add a package, and a category if necessary.
00075              */
00076             void add_package(const QualifiedPackageName &);
00077 
00078             /**
00079              * Add a version, and a package and category if necessary, and set some
00080              * default values for its metadata, and return said metadata.
00081              */
00082             std::tr1::shared_ptr<FakePackageID> add_version(const QualifiedPackageName &, const VersionSpec &);
00083 
00084             /**
00085              * Add a version, and a package and category if necessary, and set some
00086              * default values for its metadata, and return said metadata (convenience
00087              * overload taking strings).
00088              */
00089             std::tr1::shared_ptr<FakePackageID> add_version(const std::string & c, const std::string & p,
00090                     const std::string & v);
00091 
00092             virtual void invalidate();
00093 
00094             virtual void invalidate_masks();
00095 
00096             /**
00097              * Fetch our associated environment.
00098              */
00099             const Environment * environment() const;
00100 
00101             /* Repository */
00102 
00103             virtual std::tr1::shared_ptr<const PackageIDSequence> package_ids(
00104                     const QualifiedPackageName &) const
00105                 PALUDIS_ATTRIBUTE((warn_unused_result));
00106 
00107             virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> package_names(
00108                     const CategoryNamePart &) const
00109                 PALUDIS_ATTRIBUTE((warn_unused_result));
00110 
00111             virtual std::tr1::shared_ptr<const CategoryNamePartSet> category_names() const
00112                 PALUDIS_ATTRIBUTE((warn_unused_result));
00113 
00114             virtual bool has_package_named(const QualifiedPackageName &) const
00115                 PALUDIS_ATTRIBUTE((warn_unused_result));
00116 
00117             virtual bool has_category_named(const CategoryNamePart &) const
00118                 PALUDIS_ATTRIBUTE((warn_unused_result));
00119 
00120             ///\name Set methods
00121             ///\{
00122 
00123             virtual void populate_sets() const;
00124 
00125             ///\}
00126     };
00127 }
00128 
00129 
00130 #endif

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