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/ByteCount.h" 00017 #include "zypp/Date.h" 00018 #include "zypp/TranslatedText.h" 00019 #include <string> 00020 #include <list> 00021 #include <iostream> 00022 #include <zypp/base/PtrTypes.h> 00023 00024 using namespace zypp::base; 00025 00026 00027 namespace zypp { 00028 namespace parser { 00029 namespace xmlstore { 00030 00031 DEFINE_PTR_TYPE(XMLResObjectData); 00032 DEFINE_PTR_TYPE(XMLProductData); 00033 DEFINE_PTR_TYPE(XMLPatternData); 00034 DEFINE_PTR_TYPE(XMLLanguageData); 00035 DEFINE_PTR_TYPE(XMLPatchData); 00036 DEFINE_PTR_TYPE(XMLPatchAtomData); 00037 DEFINE_PTR_TYPE(XMLPatchMessageData); 00038 DEFINE_PTR_TYPE(XMLPatchScriptData); 00039 00043 class XMLDependency { 00044 public: 00045 XMLDependency(); 00046 XMLDependency(const std::string& kind, const std::string& encoded); 00047 std::string kind; 00048 std::string encoded; 00049 }; 00050 00051 00052 class XMLResObjectData : public base::ReferenceCounted, private base::NonCopyable { 00053 public: 00054 XMLResObjectData(); 00055 std::string name; 00056 std::string epoch; 00057 std::string ver; 00058 std::string rel; 00059 std::string arch; 00060 std::list<XMLDependency> provides; 00061 std::list<XMLDependency> conflicts; 00062 std::list<XMLDependency> obsoletes; 00063 std::list<XMLDependency> freshens; 00064 std::list<XMLDependency> requires; 00065 std::list<XMLDependency> prerequires; 00066 std::list<XMLDependency> recommends; 00067 std::list<XMLDependency> suggests; 00068 std::list<XMLDependency> supplements; 00069 std::list<XMLDependency> enhances; 00070 00071 // in the future move above to XMLResolvableData 00072 TranslatedText summary; 00073 TranslatedText description; 00074 00075 TranslatedText install_notify; 00076 TranslatedText delete_notify; 00077 TranslatedText license_to_confirm; 00078 std::string vendor; 00079 ByteCount size; 00080 ByteCount archive_size; 00081 bool install_only; 00082 Date build_time; 00083 Date install_time; 00084 00085 }; 00086 00090 class XMLPatternData : public XMLResObjectData 00091 { 00092 public: 00093 XMLPatternData(); 00094 00095 std::string default_; 00096 bool userVisible; 00097 TranslatedText category; 00098 std::string icon; 00099 std::string script; 00100 }; 00101 00102 class XMLLanguageData : public XMLResObjectData 00103 { 00104 public: 00105 XMLLanguageData() {}; 00106 ~XMLLanguageData() {}; 00107 }; 00108 00109 class XMLProductData : public XMLResObjectData 00110 { 00111 public: 00112 XMLProductData() {}; 00113 ~XMLProductData() {}; 00114 00115 std::string type; 00116 TranslatedText short_name; 00117 // those are suse specific tags 00118 std::string releasenotesurl; 00119 std::list<std::string> update_urls; 00120 std::list<std::string> flags; 00121 }; 00122 00123 class XMLPatchAtomData : public XMLResObjectData 00124 { 00125 public: 00126 enum AtomType { Atom, Script, Message }; 00127 virtual AtomType atomType() { return Atom; }; 00128 }; 00129 00130 class XMLPatchScriptData : public XMLPatchAtomData 00131 { 00132 public: 00133 XMLPatchScriptData() {}; 00134 virtual AtomType atomType() { return Script; }; 00135 std::string do_script; 00136 std::string undo_script; 00137 }; 00138 00139 class XMLPatchMessageData : public XMLPatchAtomData 00140 { 00141 public: 00142 XMLPatchMessageData() {}; 00143 virtual AtomType atomType() { return Message; }; 00144 TranslatedText text; 00145 }; 00146 00147 class XMLPatchData : public XMLResObjectData 00148 { 00149 public: 00150 XMLPatchData() {}; 00151 ~XMLPatchData() 00152 { 00153 } 00154 00155 std::string patchId; 00156 std::string timestamp; 00157 std::string engine; 00158 std::string category; 00159 bool rebootNeeded; 00160 bool packageManager; 00161 bool interactive; 00162 std::string updateScript; 00163 std::list<XMLPatchAtomData_Ptr > atoms; 00164 }; 00165 00166 00167 /* Easy output */ 00168 std::ostream& operator<<(std::ostream &out, const XMLDependency& data); 00169 std::ostream& operator<<(std::ostream &out, const XMLPatternData& data); 00170 std::ostream& operator<<(std::ostream& out, const XMLProductData& data); 00171 00172 00173 } // namespace xmlstore 00174 } // namespace parser 00175 } // namespace zypp 00176 00177 00178 00179 00180 00181 00182 #endif