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 
26 namespace cupt {
27 
28 namespace internal {
29 
30 class CacheImpl;
31 struct StateData;
32 
33 }
34 
36 namespace system {
37 
39 class 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*);
78  ~State();
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 
common.hpp
cupt::system::State::InstalledRecord::Flag::Type
Type
type
Definition: state.hpp:57
cupt::system::State::InstalledRecord::Want
wanted package state
Definition: state.hpp:48
cupt::system::State::InstalledRecord::Status
package installation status
Definition: state.hpp:60
cupt::system::State::InstalledRecord
installed package's information
Definition: state.hpp:45
cupt::system::State::InstalledRecord::Want::Type
Type
type
Definition: state.hpp:51
cupt::system::State::InstalledRecord::Flag
package state flag
Definition: state.hpp:54
cupt::system::State
stores an additional information for installed packages
Definition: state.hpp:39
cupt::system::State::InstalledRecord::Status::Type
Type
type
Definition: state.hpp:63