- operator ==, !=, < definition moved to RepoInfoBase
authorJan Kupec <jkupec@suse.cz>
Fri, 5 Sep 2008 09:40:34 +0000 (09:40 +0000)
committerJan Kupec <jkupec@suse.cz>
Fri, 5 Sep 2008 09:40:34 +0000 (09:40 +0000)
- fixed RepoInfo::dumpAsIniOn() to not print 'type' if it is unknown
  (bnc #407515)

zypp/RepoInfo.cc
zypp/RepoInfo.h
zypp/ServiceInfo.h
zypp/repo/RepoInfoBase.cc
zypp/repo/RepoInfoBase.h

index 89cf329..55bfcb4 100644 (file)
@@ -335,8 +335,10 @@ namespace zypp
     str
       << "<repo"
       << " alias=\"" << escape(alias()) << "\""
-      << " name=\"" << escape(name()) << "\""
-      << " type=\"" << type().asString() << "\""
+      << " name=\"" << escape(name()) << "\"";
+    if (type() != repo::RepoType::NONE)
+      str << " type=\"" << type().asString() << "\"";
+    str
       << " enabled=\"" << enabled() << "\""
       << " autorefresh=\"" << autorefresh() << "\""
       << " gpgcheck=\"" << gpgCheck() << "\"";
index 029991c..ba49994 100644 (file)
@@ -333,16 +333,14 @@ namespace zypp
   };
   ///////////////////////////////////////////////////////////////////
 
-  /** \relates RepoInfo Stream output */
-  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
-
-  inline bool operator<( const RepoInfo& lhs, const RepoInfo & rhs )
-  { return lhs.alias() < rhs.alias(); }
-
   typedef shared_ptr<RepoInfo> RepoInfo_Ptr;
 
   typedef std::list<RepoInfo> RepoInfoList;
 
+  /** \relates RepoInfo Stream output */
+  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
+
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index 2350fb3..b83605b 100644 (file)
@@ -96,17 +96,6 @@ namespace zypp
   /** \relates ServiceInfo Stream output */
   std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj );
 
-  /** \relates ServiceInfo */
-  inline bool operator==( const ServiceInfo & lhs, const ServiceInfo & rhs )
-  { return lhs.alias() == rhs.alias(); }
-
-  /** \relates ServiceInfo */
-  inline bool operator!=( const ServiceInfo & lhs, const ServiceInfo & rhs )
-  { return lhs.alias() != rhs.alias(); }
-
-  /** \relates ServiceInfo */
-  inline bool operator<( const ServiceInfo & lhs, const ServiceInfo & rhs )
-  { return lhs.alias() < rhs.alias(); }
 
     /////////////////////////////////////////////////////////////////
 } // namespace zypp
index e6fc49a..6424a1c 100644 (file)
@@ -161,6 +161,11 @@ namespace zypp
     return str;
   }
 
+  std::ostream & RepoInfoBase::dumpAsXMLOn( std::ostream & str) const
+  {
+    return str << "<!-- there's no XML representation of RepoInfoBase -->" << endl;
+  }
+
   std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj )
   {
     return obj.dumpOn(str);
index d6fbef2..0792910 100644 (file)
@@ -135,9 +135,10 @@ namespace zypp
       virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
 
       /**
-       * Write an XML representation of this object.
+       * Write an XML representation of this object. Implement in
+       * derived classes.
        */
-      virtual std::ostream & dumpAsXMLOn( std::ostream & str) const = 0;
+      virtual std::ostream & dumpAsXMLOn( std::ostream & str) const;
 
       class Impl;
     private:
@@ -146,12 +147,20 @@ namespace zypp
     };
     ///////////////////////////////////////////////////////////////////
 
-    /** \relates RepoInfoBase Stream output */
-    std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
+    /** \relates RepoInfoBase */
+    inline bool operator==( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
+    { return lhs.alias() == rhs.alias(); }
+
+    /** \relates RepoInfoBase */
+    inline bool operator!=( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
+    { return lhs.alias() != rhs.alias(); }
 
     inline bool operator<( const RepoInfoBase & lhs, const RepoInfoBase & rhs )
     { return lhs.alias() < rhs.alias(); }
 
+    /** \relates RepoInfoBase Stream output */
+    std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj );
+
     typedef shared_ptr<RepoInfoBase> RepoInfoBase_Ptr;