44 class AptImplementation;
45 class RecordIteratorImpl;
65 operator unsigned() {
return m_state; };
84 bool isValid()
const {
return m_state & Valid; }
88 bool install()
const {
return m_state & Install; }
90 bool reinstall()
const {
return m_state & ReInstall; }
91 bool remove()
const {
return m_state & Remove; }
93 bool purge()
const {
return m_state & Purge; }
94 bool keep()
const {
return m_state & Keep; }
95 bool willBreak()
const {
return m_state & WillBreak; }
97 bool upgrade()
const {
return hasNewVersion() && install(); }
99 bool newInstall()
const {
return !installed() && install(); }
100 bool hold()
const {
return m_state & Hold; }
104 bool upgradable()
const {
return hasNewVersion() && !hold(); }
105 bool held()
const {
return hasNewVersion() && hold(); }
108 bool modify()
const {
return install() ||
remove(); }
127 class Iterator :
public std::iterator<std::input_iterator_tag, std::string, void, void, void>
142 std::string operator*();
145 bool operator==(
const Iterator&)
const;
146 bool operator!=(
const Iterator&)
const;
155 class RecordIterator :
public std::iterator<std::input_iterator_tag, std::string, void, void, void>
157 RecordIteratorImpl* impl;
174 std::string operator*();
175 std::string* operator->();
197 iterator begin()
const;
198 iterator end()
const;
200 record_iterator recordBegin()
const;
201 record_iterator recordEnd()
const;
211 bool isValid(
const std::string& pkg)
const;
219 return std::string();
227 Version installedVersion(
const std::string& pkg)
const;
230 Version candidateVersion(
const std::string& pkg)
const;
236 Version anyVersion(
const std::string& pkg)
const;
251 std::string rawRecord(
const std::string& pkg)
const;
254 std::string rawRecord(
const Version& ver)
const;
257 const pkgCache* aptPkgCache()
const;
270 void checkCacheUpdates();
278 void invalidateTimestamp();
PackageState(unsigned a)
Definition: apt.h:77
bool purge() const
Definition: apt.h:93
Query
Definition: apt.h:48
std::string validate(const std::string &pkg) const
Validate a package name, returning it if it exists in the APT database, or returning the empty string...
Definition: apt.h:215
Exception(const std::string &message)
Definition: apt.cc:66
Iterator iterator
Definition: apt.h:187
bool install() const
Definition: apt.h:88
size_t size(const std::string &file)
File size.
Definition: sys.cc:116
bool upgradable() const
Definition: apt.h:104
PackageState & operator|=(const PackageState &s)
Definition: apt.h:72
Iterator(void *cur)
Definition: apt.h:133
bool held() const
Definition: apt.h:105
bool newInstall() const
Definition: apt.h:99
String functions.
Definition: apt.cc:38
bool installed() const
Definition: apt.h:102
RecordIterator()
Definition: apt.h:167
PackageState()
Definition: apt.h:81
bool upgrade() const
Definition: apt.h:97
bool reinstall() const
Definition: apt.h:90
High-level access to the Apt cache, as a data provider for the ept framework.
Definition: apt.h:120
~Exception() noexcept override
Definition: apt.cc:71
unsigned m_state
Definition: apt.h:111
bool isInstalled() const
Definition: apt.h:86
bool hold() const
Definition: apt.h:100
bool isValid() const
Definition: apt.h:84
Iterator()
Definition: apt.h:136
Representation of a package with a version.
AptImplementation * impl
Definition: apt.h:123
bool modify() const
Definition: apt.h:108
time_t timestamp()
Return the last update timestamp of the index.
Definition: axi.cc:48
bool willBreak() const
Definition: apt.h:95
PackageState & operator=(unsigned i)
Definition: apt.h:67
RecordIterator record_iterator
Definition: apt.h:188
bool keep() const
Definition: apt.h:94
unsigned state
Definition: apt.h:63
Lightweight Version class that represent a package with a version, with very cheap value copy operati...
Definition: version.h:40
bool nowBroken() const
Definition: apt.h:106
bool hasNewVersion() const
Definition: apt.h:103