paludis Version 3.0.2
The one true package mangler
repository_name_cache.hh
Go to the documentation of this file.
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2006, 2007, 2008, 2010, 2011 Ciaran McCreesh
5 *
6 * This file is part of the Paludis package manager. Paludis is free software;
7 * you can redistribute it and/or modify it under the terms of the GNU General
8 * Public License version 2, as published by the Free Software Foundation.
9 *
10 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_CACHE_HH
21#define PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_CACHE_HH 1
22
23#include <paludis/util/pimp.hh>
24#include <paludis/util/fs_path-fwd.hh>
25#include <paludis/name.hh>
26#include <memory>
27
28/** \file
29 * Declarations for RepositoryNameCache, which is used by some Repository
30 * subclasses to implement a names class.
31 *
32 * \ingroup g_repository
33 *
34 * \section Examples
35 *
36 * - None at this time.
37 */
38
39namespace paludis
40{
41 class Repository;
42
43 /**
44 * Used by various Repository subclasses to implement a names cache.
45 *
46 * \see Repository
47 * \ingroup g_repository
48 * \nosubgrouping
49 */
50 class PALUDIS_VISIBLE RepositoryNameCache
51 {
52 private:
54
55 public:
56 ///\name Basic operations
57 ///\{
58
59 RepositoryNameCache(
60 const FSPath & location,
61 const Repository * const repo);
62
63 virtual ~RepositoryNameCache();
64
65
66 ///\}
67
68 ///\name Cache helper functions
69 ///\{
70
71 /**
72 * Implement category_names_containing_package.
73 *
74 * May return a zero pointer, in which case the repository should
75 * fall back to Repository::do_category_names_containing_package or
76 * its own implementation.
77 */
78 std::shared_ptr<const CategoryNamePartSet> category_names_containing_package(
79 const PackageNamePart & p) const;
80
81 /**
82 * Whether or not our cache is usable.
83 *
84 * Initially this will be true. After the first query the value may
85 * change to false (the query will return a zero pointer too).
86 */
87 bool usable() const noexcept;
88
89 /**
90 * Implement cache regeneration.
91 */
92 void regenerate_cache() const;
93
94 /**
95 * Add a new package to the cache.
96 */
98
99 /**
100 * Remove a package from the cache.
101 */
103
104 ///\}
105 };
106}
107
108#endif
Definition fs_path.hh:34
Definition pimp.hh:52
Definition name.hh:112
void remove(const QualifiedPackageName &)
void add(const QualifiedPackageName &)
bool usable() const noexcept
std::shared_ptr< const CategoryNamePartSet > category_names_containing_package(const PackageNamePart &p) const
Definition repository.hh:249
WrappedValue< PackageNamePartTag > PackageNamePart
Definition name-fwd.hh:47
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24