Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / IdString.h
index ac82cc6..407a113 100644 (file)
 #include <iosfwd>
 #include <string>
 
-#include "zypp/base/SafeBool.h"
-
 #include "zypp/sat/detail/PoolMember.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  class IdString;
+  typedef std::tr1::unordered_set<IdString> IdStringSet;
+
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : IdString
@@ -35,15 +36,17 @@ namespace zypp
    * While comparison differs between \ref IdString::Null and \ref IdString::Empty
    * ( \c NULL and \c "" ), both are represented by an empty string \c "".
    */
-  class IdString : protected sat::detail::PoolMember,
-                   private base::SafeBool<IdString>
+  class IdString : protected sat::detail::PoolMember
   {
     public:
+      typedef sat::detail::IdType IdType;
+
+    public:
       /** Default ctor, empty string. */
       IdString() : _id( sat::detail::emptyId ) {}
 
       /** Ctor from id. */
-      explicit IdString( sat::detail::IdType id_r ) : _id( id_r ) {}
+      explicit IdString( IdType id_r ) : _id( id_r ) {}
 
       /** Ctor from string. */
       explicit IdString( const char * str_r );
@@ -60,7 +63,8 @@ namespace zypp
 
     public:
       /** Evaluate in a boolean context <tt>( != \c Null )</tt>. */
-      using base::SafeBool<IdString>::operator bool_type;
+      explicit operator bool() const
+      { return _id; }
 
       /** Whether the string is empty.
        * This is true for \ref Null and \ref Empty.
@@ -96,19 +100,20 @@ namespace zypp
 
     public:
       /** Expert backdoor. */
-      sat::detail::IdType id() const
+      IdType id() const
       { return _id; }
+
     private:
-      friend base::SafeBool<IdString>::operator bool_type() const;
-      bool boolTest() const { return _id; }
-    private:
-      sat::detail::IdType _id;
+      IdType _id;
   };
   ///////////////////////////////////////////////////////////////////
 
   /** \relates IdString Stream output */
   std::ostream & operator<<( std::ostream & str, const IdString & obj );
 
+  /** \relates IdString Stream output */
+  std::ostream & dumpOn( std::ostream & str, const IdString & obj );
+
   /** \relates IdString Equal */
   inline bool operator==( const IdString & lhs, const IdString & rhs )
   { return lhs.compareEQ( rhs ); }
@@ -209,6 +214,6 @@ namespace zypp
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
 
-ZYPP_DEFINE_ID_HASHABLE( ::zypp::IdString )
+ZYPP_DEFINE_ID_HASHABLE( ::zypp::IdString );
 
 #endif // ZYPP_SAT_IDSTR_H