The Battle for Wesnoth  1.17.0-dev
state.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2021
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 };
ADDON_STATUS state
Definition: state.hpp:57
ADDON_STATUS
Defines various add-on installation statuses.
Definition: state.hpp:22
version_info installed_version
Definition: state.hpp:60
No tracking information available.
Definition: state.hpp:37
Add-on is not installed.
Definition: state.hpp:24
Version in the server is older than local installation.
Definition: state.hpp:30
bool is_installed_addon_status(ADDON_STATUS s)
Definition: state.hpp:40
ADDON_STATUS_FILTER
Add-on installation status filters for the user interface.
Definition: state.hpp:84
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
Version in the server is newer than local installation.
Definition: state.hpp:28
bool in_version_control
Definition: state.hpp:59
Dependencies not satisfied.
Definition: state.hpp:35
static map_location::DIRECTION s
No version in the server.
Definition: state.hpp:32
Represents version numbers.
std::map< std::string, addon_tracking_info > addons_tracking_list
Definition: state.hpp:64
Stores additional status information about add-ons.
Definition: state.hpp:46
version_info remote_version
Definition: state.hpp:61
Version in the server matches local installation.
Definition: state.hpp:26