libzypp  10.5.0
RepoType.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00009 
00010 #ifndef ZYPP_REPO_TYPE_H_
00011 #define ZYPP_REPO_TYPE_H_
00012 
00013 #include <iosfwd>
00014 #include <string>
00015 
00016 namespace zypp
00017 {
00018   namespace repo
00019   {
00020 
00027   struct RepoType
00028   {
00029     static const RepoType RPMMD;
00030     static const RepoType YAST2;
00031     static const RepoType RPMPLAINDIR;
00032     static const RepoType NONE;
00033 
00034     enum Type
00035     {
00036       NONE_e,
00037       RPMMD_e,
00038       YAST2_e,
00039       RPMPLAINDIR_e,
00040     };
00041 
00042     RepoType() : _type(NONE_e) {}
00043 
00044     RepoType(Type type) : _type(type) {}
00045 
00046     explicit RepoType(const std::string & strval_r);
00047 
00048     Type toEnum() const { return _type; }
00049 
00050     RepoType::Type parse(const std::string & strval_r);
00051 
00052     const std::string & asString() const;
00053 
00054     Type _type;
00055   };
00056 
00057 
00058   inline std::ostream & operator<<( std::ostream & str, const RepoType & obj )
00059   { return str << obj.asString(); }
00060 
00061   inline bool operator==(const RepoType & obj1, const RepoType & obj2)
00062   { return obj1._type == obj2._type; }
00063 
00064   inline bool operator!=(const RepoType & obj1, const RepoType & obj2)
00065   { return ! (obj1 == obj2); }
00066 
00067   } // ns repo
00068 } // ns zypp
00069 
00070 #endif
00071 
00072 // vim: set ts=2 sts=2 sw=2 et ai: