00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00009 00010 #ifndef XMLParserData_h 00011 #define XMLParserData_h 00012 00013 #include "zypp/base/ReferenceCounted.h" 00014 #include "zypp/base/NonCopyable.h" 00015 #include "zypp/Pathname.h" 00016 #include "zypp/TranslatedText.h" 00017 #include <string> 00018 #include <list> 00019 #include <iostream> 00020 #include <zypp/base/PtrTypes.h> 00021 00022 using namespace zypp::base; 00023 00024 00025 namespace zypp { 00026 namespace parser { 00027 namespace xmlstore { 00028 00029 DEFINE_PTR_TYPE(XMLResObjectData); 00030 DEFINE_PTR_TYPE(XMLProductData); 00031 DEFINE_PTR_TYPE(XMLPatternData); 00032 DEFINE_PTR_TYPE(XMLLanguageData); 00033 DEFINE_PTR_TYPE(XMLPatchData); 00034 DEFINE_PTR_TYPE(XMLPatchAtomData); 00035 DEFINE_PTR_TYPE(XMLPatchMessageData); 00036 DEFINE_PTR_TYPE(XMLPatchScriptData); 00037 00041 class XMLDependency { 00042 public: 00043 XMLDependency(); 00044 XMLDependency(const std::string& kind, const std::string& encoded); 00045 std::string kind; 00046 std::string encoded; 00047 }; 00048 00049 00050 class XMLResObjectData : public base::ReferenceCounted, private base::NonCopyable { 00051 public: 00052 XMLResObjectData(); 00053 std::string name; 00054 std::string epoch; 00055 std::string ver; 00056 std::string rel; 00057 std::string arch; 00058 std::list<XMLDependency> provides; 00059 std::list<XMLDependency> conflicts; 00060 std::list<XMLDependency> obsoletes; 00061 std::list<XMLDependency> freshens; 00062 std::list<XMLDependency> requires; 00063 std::list<XMLDependency> prerequires; 00064 std::list<XMLDependency> recommends; 00065 std::list<XMLDependency> suggests; 00066 std::list<XMLDependency> supplements; 00067 std::list<XMLDependency> enhances; 00068 }; 00069 00073 class XMLPatternData : public XMLResObjectData 00074 { 00075 public: 00076 XMLPatternData(); 00077 TranslatedText summary; 00078 TranslatedText description; 00079 00080 std::string default_; 00081 std::string userVisible; 00082 TranslatedText category; 00083 std::string icon; 00084 std::string script; 00085 }; 00086 00087 class XMLLanguageData : public XMLResObjectData 00088 { 00089 public: 00090 XMLLanguageData() {}; 00091 ~XMLLanguageData() {}; 00092 00093 TranslatedText summary; 00094 TranslatedText description; 00095 }; 00096 00097 class XMLProductData : public XMLResObjectData 00098 { 00099 public: 00100 XMLProductData() {}; 00101 ~XMLProductData() {}; 00102 00103 std::string type; 00104 std::string vendor; 00105 TranslatedText summary; 00106 TranslatedText description; 00107 TranslatedText short_name; 00108 // those are suse specific tags 00109 std::string releasenotesurl; 00110 std::list<std::string> update_urls; 00111 std::list<std::string> flags; 00112 }; 00113 00114 class XMLPatchAtomData : public XMLResObjectData 00115 { 00116 public: 00117 enum AtomType { Atom, Script, Message }; 00118 virtual AtomType atomType() { return Atom; }; 00119 }; 00120 00121 class XMLPatchScriptData : public XMLPatchAtomData 00122 { 00123 public: 00124 XMLPatchScriptData() {}; 00125 virtual AtomType atomType() { return Script; }; 00126 std::string do_script; 00127 std::string undo_script; 00128 }; 00129 00130 class XMLPatchMessageData : public XMLPatchAtomData 00131 { 00132 public: 00133 XMLPatchMessageData() {}; 00134 virtual AtomType atomType() { return Message; }; 00135 TranslatedText text; 00136 }; 00137 00138 class XMLPatchData : public XMLResObjectData 00139 { 00140 public: 00141 XMLPatchData() {}; 00142 ~XMLPatchData() 00143 { 00144 } 00145 00146 std::string patchId; 00147 std::string timestamp; 00148 std::string engine; 00149 TranslatedText summary; 00150 TranslatedText description; 00151 std::string category; 00152 bool rebootNeeded; 00153 bool packageManager; 00154 bool interactive; 00155 std::string updateScript; 00156 std::list<XMLPatchAtomData_Ptr > atoms; 00157 }; 00158 00159 00160 /* Easy output */ 00161 std::ostream& operator<<(std::ostream &out, const XMLDependency& data); 00162 std::ostream& operator<<(std::ostream &out, const XMLPatternData& data); 00163 std::ostream& operator<<(std::ostream& out, const XMLProductData& data); 00164 00165 00166 } // namespace xmlstore 00167 } // namespace parser 00168 } // namespace zypp 00169 00170 00171 00172 00173 00174 00175 #endif
1.4.6