Cupt
state.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_SYSTEM_STATE_SEEN
19#define CUPT_SYSTEM_STATE_SEEN
20
22
23#include <cupt/common.hpp>
24#include <cupt/fwd.hpp>
25
26namespace cupt {
27
28namespace internal {
29
30class CacheImpl;
31struct StateData;
32
33}
34
36namespace system {
37
39class CUPT_API State
40{
41 internal::StateData* __data;
42 State(const State&);
43 public:
46 {
48 struct Want
49 {
51 enum Type { Unknown, Install, Hold, Deinstall, Purge, Count };
52 };
54 struct Flag
55 {
57 enum Type { Ok, Reinstreq, Count };
58 };
60 struct Status
61 {
63 enum Type { NotInstalled, Unpacked, HalfConfigured, HalfInstalled, ConfigFiles,
64 Installed, TriggersPending, TriggersAwaited, Count };
65 static const string strings[];
66 };
67 Want::Type want;
68 Flag::Type flag;
69 Status::Type status;
70
72 bool isBroken() const;
73 };
74
76 CUPT_LOCAL State(shared_ptr< const Config >, internal::CacheImpl*);
79
81
85 const InstalledRecord* getInstalledInfo(const string& packageName) const;
87
90 vector< string > getInstalledPackageNames() const;
92 string getArchitecture() const;
94 CUPT_LOCAL vector< string > getReinstallRequiredPackageNames() const;
96};
97
98}
99}
100
101#endif
102
stores an additional information for installed packages
Definition state.hpp:40
string getArchitecture() const
gets system binary architecture
vector< string > getInstalledPackageNames() const
gets installed package names
~State()
destructor
CUPT_LOCAL State(shared_ptr< const Config >, internal::CacheImpl *)
constructor, not for public use
const InstalledRecord * getInstalledInfo(const string &packageName) const
gets installed record for a package
package state flag
Definition state.hpp:55
package installation status
Definition state.hpp:61
wanted package state
Definition state.hpp:49
installed package's information
Definition state.hpp:46
bool isBroken() const
returns true when the package is not installed properly