Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PkgSplit.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       PkgSplit.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose:
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 //      CLASS NAME : PkgSplit
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 // PkgSplit_h
00132 

Generated on Mon Sep 12 21:52:13 2005 for yast2-packagemanager by  doxygen 1.4.4