libzypp  10.5.0
ResourceType.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00009 
00010 #ifndef YUMRESOURCETYPE_H_
00011 #define YUMRESOURCETYPE_H_
00012 
00013 #include <iosfwd>
00014 #include<string>
00015 
00016 namespace zypp
00017 {
00018   namespace repo
00019   {
00020     namespace yum
00021     {
00022 
00023 
00027   struct ResourceType
00028   {
00029     static const ResourceType NONE; // unknown
00030     static const ResourceType REPOMD;
00031     static const ResourceType PRIMARY;
00032     static const ResourceType OTHER;
00033     static const ResourceType FILELISTS;
00034     static const ResourceType GROUP;
00035     static const ResourceType PATCHES; // suse extension
00036     static const ResourceType PATCH;   // suse extension
00037     static const ResourceType PRODUCT; // suse extension
00038     static const ResourceType PATTERNS; // suse extension
00039     // sqlite caches yum extensions:
00040     static const ResourceType PRIMARY_DB; // yum extension
00041     static const ResourceType OTHER_DB; // yum extension
00042 
00043     enum Type
00044     {
00045       NONE_e,
00046       REPOMD_e,
00047       PRIMARY_e,
00048       OTHER_e,
00049       FILELISTS_e,
00050       GROUP_e,
00051       PATCHES_e,
00052       PATCH_e,
00053       PRODUCT_e,
00054       PATTERNS_e,
00055       PRIMARY_DB_e,
00056       OTHER_DB_e,
00057     };
00058 
00059     ResourceType(Type type) : _type(type) {}
00060 
00061     explicit ResourceType(const std::string & strval_r);
00062 
00063     Type toEnum() const { return _type; }
00064 
00065     ResourceType::Type parse(const std::string & strval_r);
00066 
00067     const std::string & asString() const;
00068 
00069     Type _type;
00070   };
00071 
00072 
00073   inline std::ostream & operator<<( std::ostream & str, const ResourceType & obj )
00074   { return str << obj.asString(); }
00075 
00076   inline bool operator==(const ResourceType & obj1, const ResourceType & obj2)
00077   { return obj1._type == obj2._type; }
00078 
00079 
00080     } // ns yum
00081   } // ns source
00082 } // ns zypp
00083 
00084 #endif /*YUMRESOURCETYPE_H_*/
00085 
00086 // vim: set ts=2 sts=2 sw=2 et ai: