Dep.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_DEP_H
00013 #define ZYPP_DEP_H
00014 
00015 #include <iosfwd>
00016 #include <string>
00017 
00019 namespace zypp
00020 { 
00021 
00023   //
00024   //    CLASS NAME : Dep
00025   //
00029   struct Dep
00030   {
00031     friend bool operator==( const Dep & lhs, const Dep & rhs );
00032     friend bool operator!=( const Dep & lhs, const Dep & rhs );
00034     friend bool operator<( const Dep & lhs, const Dep & rhs );
00035 
00042     static const Dep PROVIDES;
00043     static const Dep PREREQUIRES;
00044     static const Dep REQUIRES;
00045     static const Dep CONFLICTS;
00046     static const Dep OBSOLETES;
00047     static const Dep RECOMMENDS;
00048     static const Dep SUGGESTS;
00049     static const Dep ENHANCES;
00050     static const Dep SUPPLEMENTS;
00052 
00056     enum for_use_in_switch {
00057       PROVIDES_e,
00058       PREREQUIRES_e,
00059       REQUIRES_e,
00060       CONFLICTS_e,
00061       OBSOLETES_e,
00062       RECOMMENDS_e,
00063       SUGGESTS_e,
00064       ENHANCES_e,
00065       SUPPLEMENTS_e,
00066     };
00067 
00075     explicit
00076     Dep( const std::string & strval_r );
00077 
00081     const std::string & asString() const;
00082 
00084     for_use_in_switch inSwitch() const
00085     { return _type; }
00086 
00087   private:
00089     Dep( for_use_in_switch type_r )
00090     : _type( type_r )
00091     {}
00093     for_use_in_switch _type;
00094   };
00096 
00098   inline std::ostream & operator<<( std::ostream & str, const Dep & obj )
00099   { return str << obj.asString(); }
00100 
00102 
00104   inline bool operator==( const Dep & lhs, const Dep & rhs )
00105   { return lhs._type == rhs._type; }
00106 
00108   inline bool operator!=( const Dep & lhs, const Dep & rhs )
00109   { return lhs._type != rhs._type; }
00110 
00112   inline bool operator<( const Dep & lhs, const Dep & rhs )
00113   { return lhs._type < rhs._type; }
00114 
00116 } // namespace zypp
00118 #endif // ZYPP_DEP_H

doxygen