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 REPOMD;
00030     static const ResourceType PRIMARY;
00031     static const ResourceType OTHER;
00032     static const ResourceType FILELISTS;
00033     static const ResourceType GROUP;
00034     static const ResourceType PATCHES; // suse extension
00035     static const ResourceType PATCH;   // suse extension
00036     static const ResourceType PRODUCTS; // suse extension
00037     static const ResourceType PATTERNS; // suse extension
00038 
00039     enum Type
00040     {
00041       NONE_e,
00042       REPOMD_e,
00043       PRIMARY_e,
00044       OTHER_e,
00045       FILELISTS_e,
00046       GROUP_e,
00047       PATCHES_e,
00048       PATCH_e,
00049       PRODUCTS_e,
00050       PATTERNS_e
00051     };
00052 
00053     ResourceType(Type type) : _type(type) {}
00054 
00055     explicit ResourceType(const std::string & strval_r);
00056 
00057     const Type toEnum() const { return _type; }
00058     
00059     ResourceType::Type parse(const std::string & strval_r);
00060 
00061     const std::string & asString() const;
00062 
00063     Type _type;
00064   };
00065 
00066 
00067   inline std::ostream & operator<<( std::ostream & str, const ResourceType & obj )
00068   { return str << obj.asString(); }
00069 
00070   inline bool operator==(const ResourceType & obj1, const ResourceType & obj2)
00071   { return obj1._type == obj2._type; }
00072 
00073 
00074     } // ns yum
00075   } // ns source
00076 } // ns zypp
00077 
00078 #endif /*YUMRESOURCETYPE_H_*/
00079 
00080 // vim: set ts=2 sts=2 sw=2 et ai:

Generated on Tue Sep 25 19:23:06 2007 for libzypp by  doxygen 1.5.3