00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */ 00002 00003 /* 00004 * Copyright (c) 2005, 2006, 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_REPOSITORIES_FAKE_FAKE_REPOSITORY_HH 00021 #define PALUDIS_GUARD_PALUDIS_REPOSITORIES_FAKE_FAKE_REPOSITORY_HH 1 00022 00023 #include <paludis/repositories/fake/fake_repository_base.hh> 00024 #include <paludis/util/named_value.hh> 00025 00026 namespace paludis 00027 { 00028 namespace n 00029 { 00030 struct environment; 00031 struct name; 00032 } 00033 00034 /** 00035 * Options for FakeRepository. 00036 * 00037 * \ingroup grpfakerepository 00038 * \see FakeRepository 00039 * \since 0.26 00040 * \nosubgrouping 00041 */ 00042 struct FakeRepositoryParams 00043 { 00044 NamedValue<n::environment, const Environment *> environment; 00045 NamedValue<n::name, RepositoryName> name; 00046 }; 00047 00048 /** 00049 * Fake repository for use in test cases. 00050 * 00051 * \ingroup grpfakerepository 00052 */ 00053 class PALUDIS_VISIBLE FakeRepository : 00054 private PrivateImplementationPattern<FakeRepository>, 00055 public FakeRepositoryBase, 00056 public RepositoryVirtualsInterface, 00057 public RepositoryMirrorsInterface 00058 { 00059 private: 00060 PrivateImplementationPattern<FakeRepository>::ImpPtr & _imp; 00061 00062 public: 00063 ///\name Basic operations 00064 ///\{ 00065 00066 FakeRepository(const Environment * const, const RepositoryName &); 00067 ~FakeRepository(); 00068 00069 ///\since 0.26 00070 FakeRepository(const FakeRepositoryParams &); 00071 00072 00073 ///\} 00074 00075 /** 00076 * Add a virtual package. 00077 */ 00078 void add_virtual_package(const QualifiedPackageName &, const std::tr1::shared_ptr<const PackageDepSpec> &); 00079 00080 /* RepositoryVirtualsInterface */ 00081 00082 virtual std::tr1::shared_ptr<const VirtualsSequence> virtual_packages() const 00083 PALUDIS_ATTRIBUTE((warn_unused_result)); 00084 00085 /* RepositoryMirrorsInterface */ 00086 00087 virtual MirrorsConstIterator begin_mirrors(const std::string & s) const 00088 PALUDIS_ATTRIBUTE((warn_unused_result)); 00089 virtual MirrorsConstIterator end_mirrors(const std::string & s) const 00090 PALUDIS_ATTRIBUTE((warn_unused_result)); 00091 00092 virtual bool some_ids_might_support_action(const SupportsActionTestBase &) const; 00093 00094 /* Keys */ 00095 00096 virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const; 00097 virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const; 00098 virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const; 00099 }; 00100 } 00101 00102 #endif