libzypp  10.5.0
OnMediaLocation.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_SOURCE_ONMEDIALOCATION_H
00013 #define ZYPP_SOURCE_ONMEDIALOCATION_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/base/Deprecated.h"
00018 #include "zypp/Pathname.h"
00019 #include "zypp/ByteCount.h"
00020 #include "zypp/CheckSum.h"
00021 
00023 namespace zypp
00024 { 
00025 
00027   //
00028   //    CLASS NAME : OnMediaLocation
00029   //
00039   class OnMediaLocation
00040   {
00041     friend std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj );
00042 
00043   public:
00045     OnMediaLocation()
00046     : _medianr( 0 )
00047     , _optional(false)
00048     {}
00049 
00051     OnMediaLocation( const Pathname & filename_r, unsigned medianr_r = 1 )
00052     : _medianr( medianr_r )
00053     , _filename( filename_r )
00054     , _optional(false) // bnc #447010
00055     {}
00056 
00057   public:
00064     unsigned          medianr()        const { return _medianr; }
00070     const Pathname &  filename()       const { return _filename; }
00074     const CheckSum &  checksum()       const { return _checksum; }
00079     const ByteCount & downloadSize()   const { return _downloadsize; }
00086     const ByteCount & openSize()       const { return _opendownloadsize; }
00093     const CheckSum &  openChecksum()   const { return _openchecksum; }
00100     const bool optional() const { return _optional; }
00101 
00102   public:
00104     OnMediaLocation & unsetLocation()
00105     { _filename = Pathname(); _medianr = 0; return *this; }
00106 
00108     OnMediaLocation & setLocation( const Pathname & val_r,
00109                                    unsigned mediaNumber_r = 1 )
00110     { _filename = val_r; _medianr = mediaNumber_r; return *this; }
00111 
00113     OnMediaLocation & setDownloadSize( const ByteCount & val_r )
00114     { _downloadsize = val_r; return *this; }
00115 
00117     OnMediaLocation & setChecksum( const CheckSum & val_r )
00118     { _checksum = val_r; return *this; }
00119 
00121     OnMediaLocation & setOpenSize( const ByteCount & val_r )
00122     { _opendownloadsize = val_r; return *this; }
00123 
00125     OnMediaLocation & setOpenChecksum( const CheckSum & val_r )
00126     { _openchecksum = val_r; return *this; }
00127 
00132     OnMediaLocation & setOptional( bool val )
00133     { _optional = val; return *this; }
00134 
00135   public:
00141     OnMediaLocation & changeMedianr( unsigned val_r )
00142     { _medianr = val_r; return *this; }
00143 
00149     OnMediaLocation & changeFilename( const Pathname & val_r )
00150     { _filename = val_r; return *this; }
00151 
00152   private:
00153     unsigned  _medianr;
00154     Pathname  _filename;
00155     CheckSum  _checksum;
00156     ByteCount _downloadsize;
00157     ByteCount _opendownloadsize;
00158     CheckSum  _openchecksum;
00159     bool      _optional;
00160   };
00162 
00164   std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj );
00165 
00167 } // namespace zypp
00169 #endif // ZYPP_SOURCE_ONMEDIALOCATION_H