The Battle for Wesnoth  1.19.7+dev
state.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2024
3  by Iris Morelle <shadowm2006@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include "addon/info.hpp"
19 #include <map>
20 
21 /** Defines various add-on installation statuses. */
23  /** Add-on is not installed. */
25  /** Version in the server matches local installation. */
27  /** Version in the server is newer than local installation. */
29  /** Version in the server is older than local installation. */
31  /** No version in the server. */
33  /** Dependencies not satisfied.
34  * @todo This option isn't currently implemented! */
36  /** No tracking information available. */
38 };
39 
41 {
42  return s >= ADDON_INSTALLED && s <= ADDON_NOT_TRACKED;
43 }
44 
45 /** Stores additional status information about add-ons. */
47 {
49  : state(ADDON_NONE)
50  , can_publish(false)
51  , in_version_control(false)
53  , remote_version()
54  {
55  }
56 
62 };
63 
64 typedef std::map<std::string, addon_tracking_info> addons_tracking_list;
65 
66 /**
67  * Get information about an add-on comparing its local state with the add-ons server entry.
68  *
69  * The add-on doesn't need to be locally installed; this is part of
70  * the retrieved information.
71  *
72  * @param addon The add-ons server entry information.
73  * @return The local tracking status information.
74  */
76 
77 /**
78  * Add-on installation status filters for the user interface.
79  *
80  * These are not currently an exact match with the @a ADDON_STATUS
81  * enum type in order to keep the UI aspect simple for the user.
82  * This might change later.
83  */
91 };
Represents version numbers.
bool is_installed_addon_status(ADDON_STATUS s)
Definition: state.hpp:40
ADDON_STATUS
Defines various add-on installation statuses.
Definition: state.hpp:22
@ ADDON_NOT_TRACKED
No tracking information available.
Definition: state.hpp:37
@ ADDON_INSTALLED_OUTDATED
Version in the server is older than local installation.
Definition: state.hpp:30
@ ADDON_NONE
Add-on is not installed.
Definition: state.hpp:24
@ ADDON_INSTALLED_UPGRADABLE
Version in the server is newer than local installation.
Definition: state.hpp:28
@ ADDON_INSTALLED
Version in the server matches local installation.
Definition: state.hpp:26
@ ADDON_INSTALLED_LOCAL_ONLY
No version in the server.
Definition: state.hpp:32
@ ADDON_INSTALLED_BROKEN
Dependencies not satisfied.
Definition: state.hpp:35
addon_tracking_info get_addon_tracking_info(const addon_info &addon)
Get information about an add-on comparing its local state with the add-ons server entry.
Definition: state.cpp:25
ADDON_STATUS_FILTER
Add-on installation status filters for the user interface.
Definition: state.hpp:84
@ FILTER_INSTALLED
Definition: state.hpp:86
@ FILTER_PUBLISHABLE
Definition: state.hpp:88
@ FILTER_NOT_INSTALLED
Definition: state.hpp:89
@ FILTER_ALL
Definition: state.hpp:85
@ FILTER_COUNT
Definition: state.hpp:90
@ FILTER_UPGRADABLE
Definition: state.hpp:87
std::map< std::string, addon_tracking_info > addons_tracking_list
Definition: state.hpp:64
Stores additional status information about add-ons.
Definition: state.hpp:47
version_info remote_version
Definition: state.hpp:61
ADDON_STATUS state
Definition: state.hpp:57
version_info installed_version
Definition: state.hpp:60
bool in_version_control
Definition: state.hpp:59
static map_location::direction s