The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
state.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2017 by Ignacio Riquelme Morelle <shadowm2006@gmail.com>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include "addon/info.hpp"
18 #include <map>
19 
20 /** Defines various add-on installation statuses. */
22  /** Add-on is not installed. */
24  /** Version in the server matches local installation. */
26  /** Version in the server is newer than local installation. */
28  /** Version in the server is older than local installation. */
30  /** No version in the server. */
32  /** Dependencies not satisfied.
33  * @todo This option isn't currently implemented! */
35  /** No tracking information available. */
37 };
38 
40 {
41  return s >= ADDON_INSTALLED && s <= ADDON_NOT_TRACKED;
42 }
43 
44 /** Stores additional status information about add-ons. */
46 {
48  : state(ADDON_NONE)
49  , can_publish(false)
50  , in_version_control(false)
52  , remote_version()
53  {
54  }
55 
61 };
62 
63 typedef std::map<std::string, addon_tracking_info> addons_tracking_list;
64 
65 /**
66  * Get information about an add-on comparing its local state with the add-ons server entry.
67  *
68  * The add-on doesn't need to be locally installed; this is part of
69  * the retrieved information.
70  *
71  * @param addon The add-ons server entry information.
72  * @return The local tracking status information.
73  */
75 
76 /**
77  * Add-on installation status filters for the user interface.
78  *
79  * These are not currently an exact match with the @a ADDON_STATUS
80  * enum type in order to keep the UI aspect simple for the user.
81  * This might change later.
82  */
90 };
91 
92 /**
93  * Add-on fallback/default sorting criteria for the user interface.
94  */
95 enum ADDON_SORT {
96  SORT_NAMES, /**< Sort by add-on name. */
97  SORT_UPDATED, /**< Sort by last upload time. */
98  SORT_CREATED /**< Sort by creation time. */
99 };
100 
101 /**
102  * Add-on fallback/default sorting direction.
103  */
105  DIRECTION_ASCENDING, /**< Ascending sort. */
106  DIRECTION_DESCENDING /**< Descending sort. */
107 };
ADDON_STATUS state
Definition: state.hpp:56
ADDON_SORT
Add-on fallback/default sorting criteria for the user interface.
Definition: state.hpp:95
ADDON_STATUS
Defines various add-on installation statuses.
Definition: state.hpp:21
version_info installed_version
Definition: state.hpp:59
No tracking information available.
Definition: state.hpp:36
Add-on is not installed.
Definition: state.hpp:23
Sort by creation time.
Definition: state.hpp:98
ADDON_SORT_DIRECTION
Add-on fallback/default sorting direction.
Definition: state.hpp:104
Version in the server is older than local installation.
Definition: state.hpp:29
bool is_installed_addon_status(ADDON_STATUS s)
Definition: state.hpp:39
Descending sort.
Definition: state.hpp:106
ADDON_STATUS_FILTER
Add-on installation status filters for the user interface.
Definition: state.hpp:83
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:24
Version in the server is newer than local installation.
Definition: state.hpp:27
bool in_version_control
Definition: state.hpp:58
Dependencies not satisfied.
Definition: state.hpp:34
Ascending sort.
Definition: state.hpp:105
static map_location::DIRECTION s
Sort by add-on name.
Definition: state.hpp:96
No version in the server.
Definition: state.hpp:31
Represents version numbers.
Definition: version.hpp:43
Sort by last upload time.
Definition: state.hpp:97
std::map< std::string, addon_tracking_info > addons_tracking_list
Definition: state.hpp:63
Stores additional status information about add-ons.
Definition: state.hpp:45
version_info remote_version
Definition: state.hpp:60
Version in the server matches local installation.
Definition: state.hpp:25