Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ADDON_INFO_HPP_INCLUDED
00017 #define ADDON_INFO_HPP_INCLUDED
00018
00019 #include "config.hpp"
00020 #include "version.hpp"
00021
00022 #include "addon/validation.hpp"
00023
00024 #include <set>
00025
00026 struct addon_info;
00027 typedef std::map<std::string, addon_info> addons_list;
00028
00029 struct addon_info
00030 {
00031 std::string id;
00032 std::string title;
00033 std::string description;
00034
00035 std::string icon;
00036
00037 version_info version;
00038
00039 std::string author;
00040
00041 int size;
00042 int downloads;
00043 int uploads;
00044
00045 ADDON_TYPE type;
00046
00047 std::vector<std::string> locales;
00048
00049 std::vector<std::string> depends;
00050
00051
00052 addon_info()
00053 : id(), title(), description(), icon()
00054 , version(), author(), size(), downloads()
00055 , uploads(), type(), locales()
00056 , depends()
00057 {}
00058
00059 explicit addon_info(const config& cfg)
00060 : id(), title(), description(), icon()
00061 , version(), author(), size(), downloads()
00062 , uploads(), type(), locales()
00063 , depends()
00064 {
00065 this->read(cfg);
00066 }
00067
00068 addon_info& operator=(const addon_info& o) {
00069 if(this != &o) {
00070 this->id = o.id;
00071 this->title = o.title;
00072 this->description = o.description;
00073 this->icon = o.icon;
00074 this->version = o.version;
00075 this->author = o.author;
00076 this->size = o.size;
00077 this->downloads = o.downloads;
00078 this->uploads = o.uploads;
00079 this->type = o.type;
00080 this->locales = o.locales;
00081 this->depends = o.depends;
00082 }
00083 return *this;
00084 }
00085
00086 void read(const config& cfg);
00087
00088 void write(config& cfg) const;
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 void write_minimal(config& cfg) const;
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 std::string display_title() const;
00110
00111
00112 std::string display_icon() const;
00113
00114
00115 std::string display_type() const;
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 std::set<std::string> resolve_dependencies(const addons_list& addons) const;
00129 };
00130
00131
00132
00133
00134
00135
00136
00137 void read_addons_list(const config& cfg, addons_list& dest);
00138
00139
00140
00141
00142
00143
00144
00145 std::string size_display_string(double size);
00146
00147
00148
00149
00150
00151
00152
00153
00154 std::string make_addon_title(const std::string& id);
00155
00156 #endif