Author: mlandres
Date: Tue Oct 7 13:20:08 2008
New Revision: 11251
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11251&view=rev
Log:
added stream output operator
Added:
trunk/libzypp/zypp/media/MediaSource.cc
Modified:
trunk/libzypp/zypp/media/MediaSource.h
trunk/libzypp/zypp/media/Mount.cc
trunk/libzypp/zypp/media/Mount.h
Added: trunk/libzypp/zypp/media/MediaSource.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaSource.cc?rev=11251&view=auto
==============================================================================
--- trunk/libzypp/zypp/media/MediaSource.cc (added)
+++ trunk/libzypp/zypp/media/MediaSource.cc Tue Oct 7 13:20:08 2008
@@ -0,0 +1,29 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/media/MediaSource.cc
+*/
+#include <iostream>
+
+#include "zypp/media/MediaSource.h"
+
+namespace zypp {
+ namespace media {
+
+ std::ostream & operator<<( std::ostream & str, const AttachPoint & obj )
+ {
+ return str << (obj.temp ? "*" : "") << obj.path;
+ }
+
+ std::ostream & operator<<( std::ostream & str, const AttachedMedia & obj )
+ {
+ return str << "media(" << obj.mediaSource << ")attached(" << obj.attachPoint << ")";
+ }
+
+ } // namespace media
+} // namespace zypp
Modified: trunk/libzypp/zypp/media/MediaSource.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaSource.h?rev=11251&r1=11250&r2=11251&view=diff
==============================================================================
--- trunk/libzypp/zypp/media/MediaSource.h (original)
+++ trunk/libzypp/zypp/media/MediaSource.h Tue Oct 7 13:20:08 2008
@@ -12,6 +12,8 @@
#ifndef ZYPP_MEDIA_MEDIASOURCE_H
#define ZYPP_MEDIA_MEDIASOURCE_H
+#include <iosfwd>
+
#include "zypp/Pathname.h"
#include "zypp/base/String.h"
#include "zypp/base/PtrTypes.h"
@@ -92,6 +94,9 @@
bool iown; //!< True, if mounted by media manager.
};
+ /** \relates MediaSource Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const MediaSource & obj )
+ { return str << obj.asString(); }
///////////////////////////////////////////////////////////////////
/**
@@ -112,6 +117,8 @@
bool temp; //!< If it was created temporary.
};
+ /** \relates AttachPoint Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const AttachPoint & obj );
///////////////////////////////////////////////////////////////////
typedef zypp::RW_pointer<MediaSource> MediaSourceRef;
@@ -138,6 +145,8 @@
AttachPointRef attachPoint;
};
+ /** \relates AttachedMedia Stream output */
+ std::ostream & operator<<( std::ostream & str, const AttachedMedia & obj );
} // namespace media
} // namespace zypp
Modified: trunk/libzypp/zypp/media/Mount.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/Mount.cc?rev=11251&r1=11250&r2=11251&view=diff
==============================================================================
--- trunk/libzypp/zypp/media/Mount.cc (original)
+++ trunk/libzypp/zypp/media/Mount.cc Tue Oct 7 13:20:08 2008
@@ -10,12 +10,12 @@
*
*/
-#include