00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_NVR_H
00013 #define ZYPP_NVR_H
00014
00015 #include <iosfwd>
00016 #include <string>
00017
00018 #include "zypp/Edition.h"
00019 #include "zypp/ResTraits.h"
00020 #include "zypp/RelCompare.h"
00021
00023 namespace zypp
00024 {
00025
00027
00028
00029
00031 struct NVR
00032 {
00034 NVR()
00035 {}
00036
00038 explicit
00039 NVR( const std::string & name_r,
00040 const Edition & edition_r = Edition() )
00041 : name( name_r )
00042 , edition( edition_r )
00043 {}
00044
00046 explicit
00047 NVR( ResTraits<Resolvable>::constPtrType res_r );
00048
00050 std::string name;
00052 Edition edition;
00053
00054 public:
00056 static int compare( const NVR & lhs, const NVR & rhs )
00057 {
00058 int res = lhs.name.compare( rhs.name );
00059 if ( res )
00060 return res;
00061 return lhs.edition.compare( rhs.edition );
00062 }
00063 };
00065
00067 std::ostream & operator<<( std::ostream & str, const NVR & obj );
00068
00070 inline bool operator==( const NVR & lhs, const NVR & rhs )
00071 { return compareByRel( Rel::EQ, lhs, rhs ); }
00072
00074 inline bool operator!=( const NVR & lhs, const NVR & rhs )
00075 { return compareByRel( Rel::NE, lhs, rhs ); }
00076
00078 inline bool operator<( const NVR & lhs, const NVR & rhs )
00079 { return compareByRel( Rel::LT, lhs, rhs ); }
00080
00082 }
00084 #endif // ZYPP_NVR_H