libzypp  10.5.0
ServiceType.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00009 
00010 #ifndef ZYPP_SERVICE_TYPE_H_
00011 #define ZYPP_SERVICE_TYPE_H_
00012 
00013 #include <iosfwd>
00014 #include <string>
00015 
00016 namespace zypp
00017 {
00018   namespace repo
00019   {
00020 
00026   struct ServiceType
00027   {
00032     static const ServiceType RIS;
00034     static const ServiceType NONE;
00043     static const ServiceType PLUGIN;
00044 
00045     enum Type
00046     {
00047       NONE_e,
00048       RIS_e,
00049       PLUGIN_e,
00050     };
00051 
00052     ServiceType() : _type(NONE_e) {}
00053 
00054     ServiceType(Type type) : _type(type) {}
00055 
00056     explicit ServiceType(const std::string & strval_r);
00057 
00058     Type toEnum() const { return _type; }
00059 
00060     ServiceType::Type parse(const std::string & strval_r);
00061 
00062     const std::string & asString() const;
00063 
00064     Type _type;
00065   };
00066 
00067 
00068   inline std::ostream & operator<<( std::ostream & str, const ServiceType & obj )
00069   { return str << obj.asString(); }
00070 
00071   inline bool operator==(const ServiceType & obj1, const ServiceType & obj2)
00072   { return obj1._type == obj2._type; }
00073 
00074   inline bool operator!=(const ServiceType & obj1, const ServiceType & obj2)
00075   { return ! (obj1 == obj2); }
00076 
00077 
00078   } // ns repo
00079 } // ns zypp
00080 
00081 #endif /* ZYPP_SERVICE_TYPE_H_ */
00082 
00083 // vim: set ts=2 sts=2 sw=2 et ai: