Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

F_Media.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       F_Media.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose:
00019 
00020 /-*/
00021 #ifndef F_Media_h
00022 #define F_Media_h
00023 
00024 #include <iosfwd>
00025 #include <string>
00026 
00027 #include <y2util/Vendor.h>
00028 #include <y2util/Pathname.h>
00029 
00030 #include <y2pm/PMError.h>
00031 #include <y2pm/PMLangCode.h>
00032 
00034 //
00035 //      CLASS NAME : F_Media
00039 class F_Media {
00040 
00041   friend std::ostream & operator<<( std::ostream & str, const F_Media & obj );
00042 
00043   public:
00044 
00045     enum Flag {
00046       DOUBLESIDED = 0x01
00047     };
00048 
00049     typedef std::map<unsigned,PM::LocaleString> LabelMap;
00050 
00051     static const PM::LocaleString _noLabel;
00052 
00053   private:
00054 
00055     Vendor       _vendor;
00056     std::string  _ident;
00057     unsigned     _count;
00058     unsigned     _flags;
00059     LabelMap     _labels;
00060 
00061   public:
00062 
00063     F_Media();
00064     ~F_Media();
00065 
00066     const Vendor & vendor() const { return _vendor; }
00067     const std::string & ident() const { return _ident; }
00068     unsigned count() const { return _count; }
00069 
00070     bool doublesided() const { return( _flags & DOUBLESIDED ); }
00071 
00072     const LabelMap & labels() const { return _labels; }
00073 
00074     const PM::LocaleString & label( unsigned number_r ) const {
00075       LabelMap::const_iterator found( _labels.find( number_r ) );
00076       return( found == _labels.end() ? _noLabel : found->second );
00077     }
00078 
00079   public:
00080 
00081    void reset() { *this = F_Media(); }
00082 
00083    PMError read( std::istream & stream_r, const bool quick_r = false );
00084    PMError read( const Pathname & file_r, const bool quick_r = false  );
00085 
00086    PMError quickRead( std::istream & stream_r ) { return read( stream_r, /*quick*/true ); }
00087    PMError quickread( const Pathname & file_r ) { return read( file_r, /*quick*/true ); }
00088 };
00089 
00091 
00092 #endif // F_Media_h

Generated on Fri Nov 9 14:30:31 2007 for yast2-packagemanager by doxygen 1.3.6