SuperTuxKart
|
Public Types | |
enum | AddonStatus { AS_APPROVED = 0x0001, AS_ALPHA = 0x0002, AS_BETA = 0x0004, AS_RC = 0x0008, AS_INVISIBLE = 0x0010, AS_DFSG = 0x0040, AS_FEATURED = 0x0080, AS_LATEST = 0X0100, AS_BAD_DIM = 0x0200 } |
AddonStatus flags - a bit pattern. More... | |
enum | SortOrder { SO_DEFAULT, SO_NAME, SO_DATE } |
Set the sort order used in the comparison function. More... | |
Public Member Functions | |
Addon (const XMLNode &xml) | |
Initialises the object from an XML node. More... | |
void | deleteInvalidIconFile () |
Deletes the icon file of this addon, and marks it to be re-downloaded (next time AddonsManager::downloadIcons() is called. | |
void | writeXML (std::ofstream *out_stram) |
Writes information about an installed addon (it is only called for installed addons). More... | |
void | copyInstallData (const Addon &addon) |
Copies the installation data (like description, revision, icon) from the downloaded online list to this entry. | |
const core::stringw & | getName () const |
Returns the name of the addon. More... | |
const std::string & | getMinIncludeVer () const |
Returns the minimum version the addon was included with. More... | |
const std::string & | getMaxIncludeVer () const |
Returns the maximum version the addon was included with. More... | |
const float | getRating () const |
Returns the rating of an addon. More... | |
void | setRating (const float rating) const |
Sets the rating of an addon. More... | |
const std::string & | getType () const |
Returns the type of the addon. More... | |
const std::string & | getZipFileName () const |
Returns the filename of the zip file with the addon. More... | |
const std::string & | getIconURL () const |
Returns the name of the icon of this addon. More... | |
const std::string & | getIconBasename () const |
Returns the name of the icon (i.e. More... | |
const core::stringw & | getDescription () const |
Returns the name of the addon. More... | |
StkTime::TimeType | getDate () const |
Returns the date (in seconds since epoch) when the addon was uploaded. More... | |
std::string | getDateAsString () const |
Returns a user readable date as a string. More... | |
bool | isInstalled () const |
Returns if the addon is installed. More... | |
int | getInstalledRevision () const |
Returns the installed revision number of an addon. More... | |
int | getRevision () const |
Returns the latest revision number of this addon. More... | |
const std::string & | getId () const |
Returns the ID of this addon. More... | |
const core::stringw & | getDesigner () const |
Returns the designer of the addon. More... | |
bool | getStillExists () const |
Returns if this addon still exists on the server. More... | |
void | setStillExists () |
Marks that this addon still exists on the server. More... | |
bool | needsUpdate () const |
True if this addon needs to be updated. More... | |
bool | iconNeedsUpdate () const |
Returns true if the (cached) icon needs to be updated. More... | |
void | setInstalled (bool state) |
Marks this addon to be installed. More... | |
bool | iconReady () const |
Returns true if the icon of this addon was downloaded and is ready to be displayed. More... | |
void | setIconReady () |
Marks that the icon for this addon can be displayed. More... | |
int | getSize () const |
Returns the size of the compressed package. More... | |
std::string | getTypeDirectory () const |
Returns the directory in which this type of addons is stored (in a separate subdirectory). More... | |
bool | testIncluded (const std::string &min_ver, const std::string &max_ver) |
Returns if the current version is between min and max versions. | |
bool | testStatus (AddonStatus n) const |
Returns if a certain status flag is set. More... | |
std::string | getDataDir () const |
Returns the directory in which this addon is installed. More... | |
bool | filterByWords (const core::stringw words) const |
Filter the add-on with a list of words. More... | |
bool | operator< (const Addon &a) const |
Compares two addons according to the sort order currently defined. More... | |
const std::string & | getDirName () const |
Static Public Member Functions | |
static bool | isAddon (const std::string &directory) |
A static function that checks if the given ID is an addon. More... | |
static std::string | createAddonId (const std::string &id) |
Create an addon id by adding a 'addon_' prefix to the given id. More... | |
static void | setSortOrder (SortOrder so) |
Sets the sort order used in the comparison function. More... | |
Private Attributes | |
core::stringw | m_name |
The name to be displayed. More... | |
std::string | m_id |
Internal id for this addon, which is the name in lower case. More... | |
std::string | m_dir_name |
The directory name (i.d. More... | |
core::stringw | m_designer |
The name of the designer of the addon. More... | |
int | m_revision |
The (highest) revision number available online. More... | |
int | m_installed_revision |
The currently installed revision. More... | |
int | m_icon_revision |
The version of the icon that was downloaded. More... | |
int | m_status |
The status flags of this addon. More... | |
bool | m_still_exists |
True if this addon still exists on the server, i.e. More... | |
StkTime::TimeType | m_date |
Date when the addon was added. More... | |
core::stringw | m_description |
A description of this addon. More... | |
std::string | m_icon_url |
The URL of the icon (relative to the server) | |
std::string | m_icon_basename |
Name of the icon to use. More... | |
bool | m_icon_ready |
True if the icon is cached/loaded and can be displayed. More... | |
std::string | m_zip_file |
The name of the zip file on the addon server. More... | |
bool | m_installed |
True if the addon is installed. More... | |
int | m_size |
Compressed size of the addon package. More... | |
float | m_rating |
Rating for thsi addon package. More... | |
std::string | m_min_include_ver |
Minimum version addon is included with. More... | |
std::string | m_max_include_ver |
Maximum version addon is included with. More... | |
std::string | m_type |
Type, must be 'kart' or 'track'. More... | |
Static Private Attributes | |
static SortOrder | m_sort_order =Addon::SO_DEFAULT |
The sort order to be used in the comparison. More... | |
enum Addon::AddonStatus |
AddonStatus flags - a bit pattern.
enum Addon::SortOrder |
Set the sort order used in the comparison function.
Addon::Addon | ( | const XMLNode & | xml | ) |
Initialises the object from an XML node.
|
inlinestatic |
Create an addon id by adding a 'addon_' prefix to the given id.
bool Addon::filterByWords | ( | const core::stringw | words | ) | const |
Filter the add-on with a list of words.
words | A list of words separated by ' '. |
std::string Addon::getDataDir | ( | ) | const |
Returns the directory in which this addon is installed.
|
inline |
Returns the date (in seconds since epoch) when the addon was uploaded.
std::string Addon::getDateAsString | ( | ) | const |
Returns a user readable date as a string.
|
inline |
Returns the name of the addon.
|
inline |
Returns the designer of the addon.
|
inline |
Returns the name of the icon (i.e.
the basename of the url).
|
inline |
Returns the name of the icon of this addon.
|
inline |
Returns the ID of this addon.
|
inline |
Returns the installed revision number of an addon.
|
inline |
Returns the maximum version the addon was included with.
|
inline |
Returns the minimum version the addon was included with.
|
inline |
Returns the name of the addon.
|
inline |
Returns the rating of an addon.
|
inline |
Returns the latest revision number of this addon.
m_revision>m_installed_revision if a newer revision is available online.
|
inline |
Returns the size of the compressed package.
|
inline |
Returns if this addon still exists on the server.
|
inline |
Returns the type of the addon.
|
inline |
Returns the directory in which this type of addons is stored (in a separate subdirectory).
A kart is stored in .../karts/X and tracks in .../tracks/X. If further types are added here, make sure that the name return ends with a "/".
|
inline |
Returns the filename of the zip file with the addon.
|
inline |
Returns true if the (cached) icon needs to be updated.
This is the case if the addon revision number is higher than the revision number of the icon (this leaves some chance of false positives - i.e. icons that were not changed will still be downloaded).
|
inline |
Returns true if the icon of this addon was downloaded and is ready to be displayed.
|
static |
A static function that checks if the given ID is an addon.
This is done by testing if the directory name is in the addons directory.
|
inline |
Returns if the addon is installed.
|
inline |
True if this addon needs to be updated.
|
inline |
Compares two addons according to the sort order currently defined.
a | The addon to compare this addon to. |
|
inline |
Marks that the icon for this addon can be displayed.
|
inline |
Marks this addon to be installed.
If the addon is marked as being installed, it also updates the installed revision number to be the same as currently available revision number.
|
inline |
Sets the rating of an addon.
|
inlinestatic |
Sets the sort order used in the comparison function.
It is static, so that each instance can access the sort order.
|
inline |
Marks that this addon still exists on the server.
|
inline |
Returns if a certain status flag is set.
void Addon::writeXML | ( | std::ofstream * | out_stream | ) |
Writes information about an installed addon (it is only called for installed addons).
out_stream | Output stream to write to. |
|
private |
Date when the addon was added.
|
private |
A description of this addon.
|
private |
The name of the designer of the addon.
|
private |
The directory name (i.d.
the internal id without 'addon_' prefix.
|
private |
Name of the icon to use.
|
private |
True if the icon is cached/loaded and can be displayed.
|
private |
The version of the icon that was downloaded.
|
private |
Internal id for this addon, which is the name in lower case.
This is the name of the subdirectory for this addon with an 'addon_' prefix.
|
private |
True if the addon is installed.
|
private |
The currently installed revision.
|
private |
Maximum version addon is included with.
|
private |
Minimum version addon is included with.
|
private |
The name to be displayed.
|
mutableprivate |
Rating for thsi addon package.
|
private |
The (highest) revision number available online.
|
private |
Compressed size of the addon package.
|
staticprivate |
The sort order to be used in the comparison.
|
private |
The status flags of this addon.
|
private |
True if this addon still exists on the server, i.e.
is contained in the addons.xml file.
|
private |
Type, must be 'kart' or 'track'.
|
private |
The name of the zip file on the addon server.