ResourceType.h
Go to the documentation of this file.00001
00002
00003
00004
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;
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;
00036 static const ResourceType PATCH;
00037 static const ResourceType PRODUCT;
00038 static const ResourceType PATTERNS;
00039
00040 static const ResourceType PRIMARY_DB;
00041 static const ResourceType OTHER_DB;
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 }
00081 }
00082 }
00083
00084 #endif
00085
00086