]>
git.saurik.com Git - apt.git/blob - apt-pkg/statechanges.h
fa60c586491b603fda60a89f553ba4eb96494e43
1 #include <apt-pkg/pkgcache.h>
2 #include <apt-pkg/cacheset.h>
3 #include <apt-pkg/macros.h>
10 /** Simple wrapper class to abstract away the differences in storing different
11 * states in different places potentially in different versions.
13 class APT_PUBLIC StateChanges
16 // getter/setter for the different states
17 APT::VersionVector
& Hold();
18 void Hold(pkgCache::VerIterator
const &Ver
);
19 APT::VersionVector
& Unhold();
20 void Unhold(pkgCache::VerIterator
const &Ver
);
21 APT::VersionVector
& Error();
23 // forgets all unsaved changes
26 /** commit the staged changes to the database(s).
28 * Makes the needed calls to store the requested states.
29 * After this call the state containers will hold only versions
30 * for which the storing operation succeeded. Versions where the
31 * storing operation failed are collected in #Error(). Note that
32 * error is an upper bound as states are changed in batches so it
33 * isn't always clear which version triggered the failure exactly.
35 * @param DiscardOutput controls if stdout/stderr should be used
36 * by subprocesses for (detailed) error reporting if needed.
37 * @return \b false if storing failed, true otherwise.
38 * Note that some states might be applied even if the whole operation failed.
40 bool Save(bool const DiscardOutput
= false);
43 StateChanges(StateChanges
&&);
44 StateChanges
& operator=(StateChanges
&&);
48 class APT_HIDDEN Private
;
49 std::unique_ptr
<Private
> d
;