00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PkgSplit_h
00022 #define PkgSplit_h
00023
00024 #include <iosfwd>
00025 #include <string>
00026 #include <set>
00027 #include <functional>
00028
00029 #include <y2util/Pathname.h>
00030
00031 #include <y2pm/PkgName.h>
00032
00034 class PkgSplit;
00035
00036 typedef std::set<PkgSplit> PkgSplitSet;
00037
00039
00041
00042
00058 class PkgSplit {
00059
00060 private:
00061
00062 PkgName _ipkg;
00063 Pathname _file;
00064
00065 public:
00066
00070 PkgSplit() {}
00071
00078 PkgSplit( const std::string & splitprovides_r, const bool quiet_r = false );
00079
00083 PkgSplit( const PkgName & ipkg_r, const Pathname & file_r );
00084
00085 ~PkgSplit();
00086
00092 bool valid() const { return ! ( _ipkg->empty() || _file.empty() ); }
00093
00097 const PkgName & ipkg() const { return _ipkg; }
00098
00102 const Pathname & file() const { return _file; }
00103
00104 public:
00105
00109 friend std::ostream & operator<<( std::ostream & str, const PkgSplit & obj );
00110 };
00111
00113
00121 template<>
00122 inline bool std::less<PkgSplit>::operator()(const PkgSplit & lhs, const PkgSplit & rhs ) const {
00123 int d = lhs.ipkg().asString().compare( rhs.ipkg().asString() );
00124 if ( d )
00125 return( d < 0 );
00126 return( lhs.file().asString() < rhs.file().asString() );
00127 }
00128
00130
00131 #endif
00132