Cupt
cupt
cache.hpp
Go to the documentation of this file.
1
/**************************************************************************
2
* Copyright (C) 2010 by Eugene V. Lyubimkin *
3
* *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License *
6
* (version 3 or above) as published by the Free Software Foundation. *
7
* *
8
* This program is distributed in the hope that it will be useful, *
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11
* GNU General Public License for more details. *
12
* *
13
* You should have received a copy of the GNU GPL *
14
* along with this program; if not, write to the *
15
* Free Software Foundation, Inc., *
16
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
17
**************************************************************************/
18
#ifndef CUPT_CACHE_CACHE_SEEN
19
#define CUPT_CACHE_CACHE_SEEN
20
22
23
#include <set>
24
#include <map>
25
26
#include <
cupt/common.hpp
>
27
#include <cupt/fwd.hpp>
28
#include <cupt/range.hpp>
29
30
namespace
cupt {
31
32
namespace
internal {
33
34
class
CacheImpl;
35
36
}
37
38
using
std::set;
39
using
std::map;
40
41
using namespace
cache;
42
44
class
CUPT_API Cache
45
{
46
public
:
48
52
struct
IndexEntry
53
{
55
enum
Type
{ Source, Binary } category;
56
string
uri;
57
string
distribution;
58
string
component;
59
map< string, string > options;
60
};
62
struct
ExtendedInfo
63
{
64
typedef
map<string, map<string, string>> Raw;
65
Raw raw;
66
set< string > automaticallyInstalled;
67
};
68
69
class
PackageNameIterator
70
{
71
public
:
72
typedef
const
string
value_type;
73
74
class
Impl;
75
PackageNameIterator
(Impl* impl);
76
~
PackageNameIterator
();
77
PackageNameIterator
(
const
PackageNameIterator
&);
78
PackageNameIterator
& operator=(
const
PackageNameIterator
&);
79
PackageNameIterator
(
PackageNameIterator
&&) =
default
;
80
81
bool
operator==(
const
PackageNameIterator
&)
const
;
82
bool
operator!=(
const
PackageNameIterator
&)
const
;
83
84
value_type& operator*()
const
;
85
PackageNameIterator
& operator++();
86
87
private
:
88
Impl* p_impl;
89
};
90
91
private
:
92
internal::CacheImpl* __impl;
93
Cache
(
const
Cache
&);
94
Cache
& operator=(
const
Cache
&);
95
public
:
97
105
Cache
(shared_ptr< const Config > config,
bool
useSource,
bool
useBinary,
bool
useInstalled);
107
virtual
~
Cache
();
108
110
vector< shared_ptr< const ReleaseInfo > > getBinaryReleaseData()
const
;
112
vector< shared_ptr< const ReleaseInfo > > getSourceReleaseData()
const
;
113
115
Range< PackageNameIterator >
getBinaryPackageNames()
const
;
117
121
const
BinaryPackage
* getBinaryPackage(
const
string
& packageName)
const
;
123
Range< PackageNameIterator >
getSourcePackageNames()
const
;
125
129
const
SourcePackage
* getSourcePackage(
const
string
& packageName)
const
;
130
132
vector< const BinaryVersion* > getInstalledVersions()
const
;
133
135
139
bool
isAutomaticallyInstalled(
const
string
& packageName)
const
;
140
142
vector< IndexEntry > getIndexEntries()
const
;
143
145
const
system::State
* getSystemState()
const
;
146
148
ssize_t getPin(
const
Version
*)
const
;
149
151
struct
VersionWithPriority
152
{
153
const
Version
* version;
154
ssize_t priority;
155
};
157
vector<VersionWithPriority> getSortedVersionsWithPriorities(
const
Package
*)
const
;
159
const
Version
* getPreferredVersion(
const
Package
*)
const
;
160
162
vector< const BinaryVersion* > getSatisfyingVersions(
const
RelationExpression
&)
const
;
163
165
const
ExtendedInfo& getExtendedInfo()
const
;
166
168
171
string
getLocalizedDescription(
const
BinaryVersion
*)
const
;
172
174
178
static
string
getPathOfCopyright(
const
BinaryVersion
*);
180
184
static
string
getPathOfChangelog(
const
BinaryVersion
*);
185
187
191
static
bool
memoize;
192
};
193
194
}
195
196
#endif
197
cupt::Cache::IndexEntry::Type
Type
does this index entry contains source or binary packages
Definition:
cache.hpp:54
cupt::Cache::ExtendedInfo
extended package information
Definition:
cache.hpp:61
common.hpp
cupt::cache::BinaryPackage
Package for binary versions.
Definition:
binarypackage.hpp:29
cupt::Cache::PackageNameIterator
Definition:
cache.hpp:68
cupt::cache::Version
common version information
Definition:
version.hpp:38
cupt::cache::Package
a container for all versions of the same package name
Definition:
package.hpp:55
cupt::Cache::VersionWithPriority
contains version and its corresponding priority
Definition:
cache.hpp:150
cupt::cache::BinaryVersion
binary version info
Definition:
binaryversion.hpp:30
cupt::Range
Definition:
range.hpp:41
cupt::Cache
the source of package and version information
Definition:
cache.hpp:43
cupt::cache::RelationExpression
group of alternative relations
Definition:
relation.hpp:108
cupt::system::State
stores an additional information for installed packages
Definition:
state.hpp:38
cupt::cache::SourcePackage
package for source versions
Definition:
sourcepackage.hpp:29
Generated by
1.8.16