Cupt
|
00001 /************************************************************************** 00002 * Copyright (C) 2010 by Eugene V. Lyubimkin * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License * 00006 * (version 3 or above) as published by the Free Software Foundation. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU GPL * 00014 * along with this program; if not, write to the * 00015 * Free Software Foundation, Inc., * 00016 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 00017 **************************************************************************/ 00018 #ifndef CUPT_SYSTEM_STATE_SEEN 00019 #define CUPT_SYSTEM_STATE_SEEN 00020 00022 00023 #include <cupt/common.hpp> 00024 #include <cupt/fwd.hpp> 00025 00026 namespace cupt { 00027 00028 namespace internal { 00029 00030 class CacheImpl; 00031 class StateData; 00032 00033 } 00034 00036 namespace system { 00037 00039 class CUPT_API State 00040 { 00041 internal::StateData* __data; 00042 State(const State&); 00043 public: 00045 struct InstalledRecord 00046 { 00048 struct Want 00049 { 00051 enum Type { Unknown, Install, Hold, Deinstall, Purge, Count }; 00052 }; 00054 struct Flag 00055 { 00057 enum Type { Ok, Reinstreq, Hold, HoldAndReinstreq, Count }; 00058 }; 00060 struct Status 00061 { 00063 enum Type { NotInstalled, Unpacked, HalfConfigured, HalfInstalled, ConfigFiles, 00064 PostInstFailed, RemovalFailed, Installed, TriggersPending, TriggersAwaited, Count }; 00065 static const string strings[]; 00066 }; 00067 Want::Type want; 00068 Flag::Type flag; 00069 Status::Type status; 00070 00072 bool isBroken() const; 00073 }; 00074 00076 CUPT_LOCAL State(shared_ptr< const Config >, internal::CacheImpl*); 00078 ~State(); 00079 00081 00085 shared_ptr< const InstalledRecord > getInstalledInfo(const string& packageName) const; 00087 00090 vector< string > getInstalledPackageNames() const; 00092 CUPT_LOCAL vector< string > getReinstallRequiredPackageNames() const; 00094 }; 00095 00096 } 00097 } 00098 00099 #endif 00100