19 #ifndef HEADER_ADDON_HPP 20 #define HEADER_ADDON_HPP 27 #include "utils/time.hpp" 31 #include "irrString.h" 62 static bool isAddon(
const std::string &directory);
126 void deleteInvalidIconFile();
132 void writeXML(std::ofstream *out_stram);
134 void copyInstallData(
const Addon &addon);
137 const core::stringw&
getName()
const {
return m_name; }
149 void setRating(
const float rating)
const {m_rating = rating; }
152 const std::string&
getType()
const {
return m_type; }
168 StkTime::TimeType
getDate()
const {
return m_date; }
171 std::string getDateAsString()
const;
185 const std::string&
getId()
const {
return m_id; }
199 return m_installed && getInstalledRevision() < getRevision();
208 return m_revision > m_icon_revision;
218 m_installed_revision = m_revision;
228 m_icon_revision = m_revision;
244 else if(m_type==
"track")
246 else if(m_type==
"arena")
255 bool testIncluded(
const std::string &min_ver,
const std::string &max_ver);
260 std::string getDataDir()
const;
262 bool filterByWords(
const core::stringw words)
const;
273 if(testStatus(AS_FEATURED) &&
275 if(!testStatus(AS_FEATURED) &&
280 return m_id < a.
m_id;
290 const std::string& getDirName()
const {
return m_dir_name; }
static void setSortOrder(SortOrder so)
Sets the sort order used in the comparison function.
Definition: addon.hpp:130
AddonStatus
AddonStatus flags - a bit pattern.
Definition: addon.hpp:43
const core::stringw & getDescription() const
Returns the name of the addon.
Definition: addon.hpp:164
core::stringw m_description
A description of this addon.
Definition: addon.hpp:97
int m_icon_revision
The version of the icon that was downloaded.
Definition: addon.hpp:88
std::string m_icon_url
The URL of the icon (relative to the server)
Definition: addon.hpp:99
bool getStillExists() const
Returns if this addon still exists on the server.
Definition: addon.hpp:191
bool operator<(const Addon &a) const
Compares two addons according to the sort order currently defined.
Definition: addon.hpp:268
StkTime::TimeType m_date
Date when the addon was added.
Definition: addon.hpp:95
int getInstalledRevision() const
Returns the installed revision number of an addon.
Definition: addon.hpp:177
const std::string & getMinIncludeVer() const
Returns the minimum version the addon was included with.
Definition: addon.hpp:140
float m_rating
Rating for thsi addon package.
Definition: addon.hpp:111
Definition: three_d_animation.hpp:32
bool iconNeedsUpdate() const
Returns true if the (cached) icon needs to be updated.
Definition: addon.hpp:206
std::string getTypeDirectory() const
Returns the directory in which this type of addons is stored (in a separate subdirectory).
Definition: addon.hpp:240
const std::string & getMaxIncludeVer() const
Returns the maximum version the addon was included with.
Definition: addon.hpp:143
const std::string & getType() const
Returns the type of the addon.
Definition: addon.hpp:152
SortOrder
Set the sort order used in the comparison function.
Definition: addon.hpp:56
const std::string & getIconBasename() const
Returns the name of the icon (i.e.
Definition: addon.hpp:161
static std::string createAddonId(const std::string &id)
Create an addon id by adding a 'addon_' prefix to the given id.
Definition: addon.hpp:65
core::stringw m_designer
The name of the designer of the addon.
Definition: addon.hpp:82
bool needsUpdate() const
True if this addon needs to be updated.
Definition: addon.hpp:197
std::string m_zip_file
The name of the zip file on the addon server.
Definition: addon.hpp:105
bool testStatus(AddonStatus n) const
Returns if a certain status flag is set.
Definition: addon.hpp:258
bool m_still_exists
True if this addon still exists on the server, i.e.
Definition: addon.hpp:93
void setRating(const float rating) const
Sets the rating of an addon.
Definition: addon.hpp:149
int m_status
The status flags of this addon.
Definition: addon.hpp:90
bool m_installed
True if the addon is installed.
Definition: addon.hpp:107
int m_size
Compressed size of the addon package.
Definition: addon.hpp:109
void setInstalled(bool state)
Marks this addon to be installed.
Definition: addon.hpp:214
std::string m_icon_basename
Name of the icon to use.
Definition: addon.hpp:101
static SortOrder m_sort_order
The sort order to be used in the comparison.
Definition: addon.hpp:120
const core::stringw & getDesigner() const
Returns the designer of the addon.
Definition: addon.hpp:188
bool isInstalled() const
Returns if the addon is installed.
Definition: addon.hpp:174
void setStillExists()
Marks that this addon still exists on the server.
Definition: addon.hpp:194
std::string m_max_include_ver
Maximum version addon is included with.
Definition: addon.hpp:115
std::string m_dir_name
The directory name (i.d.
Definition: addon.hpp:79
StkTime::TimeType getDate() const
Returns the date (in seconds since epoch) when the addon was uploaded.
Definition: addon.hpp:168
utility class used to parse XML files
Definition: xml_node.hpp:47
const float getRating() const
Returns the rating of an addon.
Definition: addon.hpp:146
bool iconReady() const
Returns true if the icon of this addon was downloaded and is ready to be displayed.
Definition: addon.hpp:223
const std::string & getId() const
Returns the ID of this addon.
Definition: addon.hpp:185
int getRevision() const
Returns the latest revision number of this addon.
Definition: addon.hpp:182
std::string m_min_include_ver
Minimum version addon is included with.
Definition: addon.hpp:113
const std::string & getIconURL() const
Returns the name of the icon of this addon.
Definition: addon.hpp:158
bool m_icon_ready
True if the icon is cached/loaded and can be displayed.
Definition: addon.hpp:103
const core::stringw & getName() const
Returns the name of the addon.
Definition: addon.hpp:137
int m_installed_revision
The currently installed revision.
Definition: addon.hpp:86
int m_revision
The (highest) revision number available online.
Definition: addon.hpp:84
int getSize() const
Returns the size of the compressed package.
Definition: addon.hpp:233
std::string m_type
Type, must be 'kart' or 'track'.
Definition: addon.hpp:117
std::string m_id
Internal id for this addon, which is the name in lower case.
Definition: addon.hpp:77
void setIconReady()
Marks that the icon for this addon can be displayed.
Definition: addon.hpp:226
const std::string & getZipFileName() const
Returns the filename of the zip file with the addon.
Definition: addon.hpp:155
core::stringw m_name
The name to be displayed.
Definition: addon.hpp:73