00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: PMPackageImEx.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 Purpose: Package/Selection import and export. 00019 00020 /-*/ 00021 #ifndef PMPackageImEx_h 00022 #define PMPackageImEx_h 00023 00024 #include <iosfwd> 00025 #include <set> 00026 #include <map> 00027 00028 #include <y2util/Pathname.h> 00029 #include <y2util/LangCode.h> 00030 00031 #include <y2pm/PMPackageImExPtr.h> 00032 #include <y2pm/PMSelectablePtr.h> 00033 #include <y2pm/PkgName.h> 00034 00036 // 00037 // CLASS NAME : PMPackageImEx 00048 class PMPackageImEx : public CountedRep { 00049 REP_BODY(PMPackageImEx); 00050 00051 private: 00052 00054 // 00055 // CLASS NAME : PMPackageImEx::Magic 00059 struct Magic { 00060 static const std::string _magic; 00061 PkgEdition _version; 00062 Magic( const PkgEdition & vers_r = PkgEdition::UNSPEC ) : _version( vers_r ) {} 00063 std::istream & readFrom( std::istream & str ); 00064 std::ostream & writeOn( std::ostream & str ) const; 00065 }; 00066 00067 static const Magic _ImExMagic; 00068 00069 public: 00070 00071 typedef std::set<PkgName> NameSet; 00072 typedef std::map<PkgName,PkgEdition> NameEdSet; 00073 00074 private: 00075 00076 std::set<LangCode> _requestedLocales; 00077 00078 NameEdSet _onSystemSel; 00079 NameSet _offSystemSel; 00080 00081 NameEdSet _onSystemPkg; 00082 NameEdSet _onSystemTabooPkg; 00083 NameSet _offSystemPkg; 00084 NameSet _offSystemTabooPkg; 00085 00089 void reset(); 00090 00095 bool collect_Sel( const constPMSelectablePtr & sel_r ); 00100 bool collect_Pkg( const constPMSelectablePtr & sel_r ); 00101 00102 public: 00103 00107 PMPackageImEx(); 00108 00112 virtual ~PMPackageImEx(); 00113 00114 public: 00115 00119 void getPMState(); 00124 void setPMState(); 00125 00126 public: 00127 00132 std::istream & doImport( std::istream & str ); 00137 std::ostream & doExport( std::ostream & str ) const; 00138 00143 bool doImport( const Pathname & path_r ); 00149 bool doExport( const Pathname & path_r ) const; 00150 00151 public: 00152 00156 virtual std::ostream & dumpOn( std::ostream & str ) const; 00157 }; 00158 00160 00161 #endif // PMPackageImEx_h 00162