1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/sat/FileConflicts.h
11 #ifndef ZYPP_SAT_FILECONFLICTS_H
12 #define ZYPP_SAT_FILECONFLICTS_H
16 #include "zypp/base/PtrTypes.h"
17 #include "zypp/sat/Queue.h"
18 #include "zypp/sat/Solvable.h"
20 ///////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
27 /// \class FileConflicts
28 /// \brief Libsolv queue representing file conflicts.
29 ///////////////////////////////////////////////////////////////////
30 class FileConflicts : private Queue
32 friend bool operator==( const FileConflicts & lhs, const FileConflicts & rhs );
33 static constexpr size_type queueBlockSize = 6;
38 * \brief A file conflict.
42 IdString lhsFilename() const { return IdString( _data[0] ); }
43 Solvable lhsSolvable() const { return Solvable( _data[1] ); }
44 IdString lhsFilemd5() const { return IdString( _data[2] ); }
46 IdString rhsFilename() const { return IdString( _data[3] ); }
47 Solvable rhsSolvable() const { return Solvable( _data[4] ); }
48 IdString rhsFilemd5() const { return IdString( _data[5] ); }
50 /** Ready to use (translated) string describing the Conflict */
51 std::string asUserString() const;
54 detail::IdType _data[queueBlockSize];
58 using Queue::size_type;
59 typedef Conflict value_type;
60 typedef const value_type* const_iterator;
63 size_type size() const { return Queue::size()/queueBlockSize; }
64 const_iterator begin() const { return reinterpret_cast<const_iterator>(Queue::begin()); }
65 const_iterator end() const { return reinterpret_cast<const_iterator>(Queue::end()); }
68 using Queue::operator detail::CQueue *; ///< libsolv backdoor
69 using Queue::operator const detail::CQueue *; ///< libsolv backdoor
72 /** \relates FileConflicts Stream output */
73 std::ostream & operator<<( std::ostream & str, const FileConflicts & obj );
75 /** \relates FileConflicts::Conflict Stream output */
76 std::ostream & operator<<( std::ostream & str, const FileConflicts::Conflict & obj );
78 /** \relates FileConflicts XML output */
79 std::ostream & dumpAsXmlOn( std::ostream & str, const FileConflicts & obj );
81 /** \relates FileConflicts::Conflict XML output */
82 std::ostream & dumpAsXmlOn( std::ostream & str, const FileConflicts::Conflict & obj );
84 /** \relates FileConflicts */
85 inline bool operator==( const FileConflicts & lhs, const FileConflicts & rhs )
86 { return static_cast<const Queue &>(lhs) == static_cast<const Queue &>(rhs); }
88 /** \relates FileConflicts */
89 inline bool operator!=( const FileConflicts & lhs, const FileConflicts & rhs )
90 { return !( lhs == rhs ); }
93 ///////////////////////////////////////////////////////////////////
95 ///////////////////////////////////////////////////////////////////
96 #endif // ZYPP_SAT_FILECONFLICTS_H