]>
git.saurik.com Git - apt.git/blob - apt-pkg/statechanges.h
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 #define APT_GETTERSETTER(Name) \
18 APT::VersionVector& Name(); \
19 void Name(pkgCache::VerIterator const &Ver)
20 APT_GETTERSETTER(Hold
);
21 APT_GETTERSETTER(Unhold
);
22 APT_GETTERSETTER(Install
);
23 APT_GETTERSETTER(Remove
);
24 APT_GETTERSETTER(Purge
);
25 APT::VersionVector
& Error();
26 #undef APT_GETTERSETTER
28 // operate on all containers at once
32 /** commit the staged changes to the database(s).
34 * Makes the needed calls to store the requested states.
35 * After this call the state containers will hold only versions
36 * for which the storing operation succeeded. Versions where the
37 * storing operation failed are collected in #Error(). Note that
38 * error is an upper bound as states are changed in batches so it
39 * isn't always clear which version triggered the failure exactly.
41 * @param DiscardOutput controls if stdout/stderr should be used
42 * by subprocesses for (detailed) error reporting if needed.
43 * @return \b false if storing failed, true otherwise.
44 * Note that some states might be applied even if the whole operation failed.
46 bool Save(bool const DiscardOutput
= false);
49 StateChanges(StateChanges
&&);
50 StateChanges
& operator=(StateChanges
&&);
54 class APT_HIDDEN Private
;
55 std::unique_ptr
<Private
> d
;