19#ifndef HEADER_ADDON_HPP
20#define HEADER_ADDON_HPP
27#include "utils/time.hpp"
62 static bool isAddon(
const std::string &directory);
132 void writeXML(std::ofstream *out_stram);
255 bool testIncluded(
const std::string &min_ver,
const std::string &max_ver);
290 const std::string& getDirName()
const {
return m_dir_name; }
int m_revision
The (highest) revision number available online.
Definition: addon.hpp:84
bool m_icon_ready
True if the icon is cached/loaded and can be displayed.
Definition: addon.hpp:103
std::string m_type
Type, must be 'kart' or 'track'.
Definition: addon.hpp:117
bool filterByWords(const core::stringw words) const
Filter the add-on with a list of words.
Definition: addon.cpp:187
static void setSortOrder(SortOrder so)
Sets the sort order used in the comparison function.
Definition: addon.hpp:130
int m_icon_revision
The version of the icon that was downloaded.
Definition: addon.hpp:88
const core::stringw & getDescription() const
Returns the name of the addon.
Definition: addon.hpp:164
StkTime::TimeType getDate() const
Returns the date (in seconds since epoch) when the addon was uploaded.
Definition: addon.hpp:168
std::string m_dir_name
The directory name (i.d.
Definition: addon.hpp:79
void writeXML(std::ofstream *out_stram)
Writes information about an installed addon (it is only called for installed addons).
Definition: addon.cpp:142
bool iconNeedsUpdate() const
Returns true if the (cached) icon needs to be updated.
Definition: addon.hpp:206
void setInstalled(bool state)
Marks this addon to be installed.
Definition: addon.hpp:214
void setIconReady()
Marks that the icon for this addon can be displayed.
Definition: addon.hpp:226
const std::string & getId() const
Returns the ID of this addon.
Definition: addon.hpp:185
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
std::string m_icon_url
The URL of the icon (relative to the server)
Definition: addon.hpp:99
core::stringw m_description
A description of this addon.
Definition: addon.hpp:97
bool m_installed
True if the addon is installed.
Definition: addon.hpp:107
const float getRating() const
Returns the rating of an addon.
Definition: addon.hpp:146
const std::string & getMinIncludeVer() const
Returns the minimum version the addon was included with.
Definition: addon.hpp:140
std::string getDataDir() const
Returns the directory in which this addon is installed.
Definition: addon.cpp:243
const std::string & getIconURL() const
Returns the name of the icon of this addon.
Definition: addon.hpp:158
std::string m_id
Internal id for this addon, which is the name in lower case.
Definition: addon.hpp:77
AddonStatus
AddonStatus flags - a bit pattern.
Definition: addon.hpp:43
bool testIncluded(const std::string &min_ver, const std::string &max_ver)
Returns if the current version is between min and max versions.
Definition: addon.cpp:169
void deleteInvalidIconFile()
Deletes the icon file of this addon, and marks it to be re-downloaded (next time AddonsManager::downl...
Definition: addon.cpp:224
bool operator<(const Addon &a) const
Compares two addons according to the sort order currently defined.
Definition: addon.hpp:268
int getInstalledRevision() const
Returns the installed revision number of an addon.
Definition: addon.hpp:177
const std::string & getZipFileName() const
Returns the filename of the zip file with the addon.
Definition: addon.hpp:155
std::string m_max_include_ver
Maximum version addon is included with.
Definition: addon.hpp:115
float m_rating
Rating for thsi addon package.
Definition: addon.hpp:111
const std::string & getType() const
Returns the type of the addon.
Definition: addon.hpp:152
const core::stringw & getName() const
Returns the name of the addon.
Definition: addon.hpp:137
const std::string & getIconBasename() const
Returns the name of the icon (i.e.
Definition: addon.hpp:161
const core::stringw & getDesigner() const
Returns the designer of the addon.
Definition: addon.hpp:188
void setStillExists()
Marks that this addon still exists on the server.
Definition: addon.hpp:194
int m_size
Compressed size of the addon package.
Definition: addon.hpp:109
bool isInstalled() const
Returns if the addon is installed.
Definition: addon.hpp:174
int getSize() const
Returns the size of the compressed package.
Definition: addon.hpp:233
core::stringw m_name
The name to be displayed.
Definition: addon.hpp:73
bool needsUpdate() const
True if this addon needs to be updated.
Definition: addon.hpp:197
StkTime::TimeType m_date
Date when the addon was added.
Definition: addon.hpp:95
std::string getDateAsString() const
Returns a user readable date as a string.
Definition: addon.cpp:163
int getRevision() const
Returns the latest revision number of this addon.
Definition: addon.hpp:182
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
bool iconReady() const
Returns true if the icon of this addon was downloaded and is ready to be displayed.
Definition: addon.hpp:223
int m_installed_revision
The currently installed revision.
Definition: addon.hpp:86
void copyInstallData(const Addon &addon)
Copies the installation data (like description, revision, icon) from the downloaded online list to th...
Definition: addon.cpp:117
core::stringw m_designer
The name of the designer of the addon.
Definition: addon.hpp:82
static SortOrder m_sort_order
The sort order to be used in the comparison.
Definition: addon.hpp:120
std::string m_zip_file
The name of the zip file on the addon server.
Definition: addon.hpp:105
std::string m_min_include_ver
Minimum version addon is included with.
Definition: addon.hpp:113
const std::string & getMaxIncludeVer() const
Returns the maximum version the addon was included with.
Definition: addon.hpp:143
std::string getTypeDirectory() const
Returns the directory in which this type of addons is stored (in a separate subdirectory).
Definition: addon.hpp:240
bool getStillExists() const
Returns if this addon still exists on the server.
Definition: addon.hpp:191
bool testStatus(AddonStatus n) const
Returns if a certain status flag is set.
Definition: addon.hpp:258
int m_status
The status flags of this addon.
Definition: addon.hpp:90
std::string m_icon_basename
Name of the icon to use.
Definition: addon.hpp:101
SortOrder
Set the sort order used in the comparison function.
Definition: addon.hpp:56
static bool isAddon(const std::string &directory)
A static function that checks if the given ID is an addon.
Definition: addon.cpp:236
utility class used to parse XML files
Definition: xml_node.hpp:48