The Battle for Wesnoth  1.13.4+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 - 2016 by Ignacio Riquelme Morelle <[email protected]>
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 #ifndef ADDON_STATE_HPP_INCLUDED
16 #define ADDON_STATE_HPP_INCLUDED
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  /** Dependencies not satisfied.
32  * @todo This option isn't currently implemented! */
34  /** No tracking information available. */
36 };
37 
39 {
40  return s >= ADDON_INSTALLED && s <= ADDON_NOT_TRACKED;
41 }
42 
43 /** Stores additional status information about add-ons. */
45 {
47  : state(ADDON_NONE)
48  , can_publish(false)
49  , in_version_control(false)
51  , remote_version()
52  {
53  }
54 
60 };
61 
62 typedef std::map<std::string, addon_tracking_info> addons_tracking_list;
63 
64 /**
65  * Get information about an add-on comparing its local state with the add-ons server entry.
66  *
67  * The add-on doesn't need to be locally installed; this is part of
68  * the retrieved information.
69  *
70  * @param addon The add-ons server entry information.
71  * @return The local tracking status information.
72  */
74 
75 /**
76  * Add-on installation status filters for the user interface.
77  *
78  * These are not currently an exact match with the @a ADDON_STATUS
79  * enum type in order to keep the UI aspect simple for the user.
80  * This might change later.
81  */
88 };
89 
90 /**
91  * Add-on fallback/default sorting criteria for the user interface.
92  */
93 enum ADDON_SORT {
94  SORT_NAMES, /**< Sort by add-on name. */
95  SORT_UPDATED, /**< Sort by last upload time. */
96  SORT_CREATED /**< Sort by creation time. */
97 };
98 
99 /**
100  * Add-on fallback/default sorting direction.
101  */
103  DIRECTION_ASCENDING, /**< Ascending sort. */
104  DIRECTION_DESCENDING /**< Descending sort. */
105 };
106 
107 #endif
ADDON_STATUS state
Definition: state.hpp:55
ADDON_SORT
Add-on fallback/default sorting criteria for the user interface.
Definition: state.hpp:93
ADDON_STATUS
Defines various add-on installation statuses.
Definition: state.hpp:22
version_info installed_version
Definition: state.hpp:58
No tracking information available.
Definition: state.hpp:35
Add-on is not installed.
Definition: state.hpp:24
Sort by creation time.
Definition: state.hpp:96
ADDON_SORT_DIRECTION
Add-on fallback/default sorting direction.
Definition: state.hpp:102
Version in the server is older than local installation.
Definition: state.hpp:30
bool is_installed_addon_status(ADDON_STATUS s)
Definition: state.hpp:38
Descending sort.
Definition: state.hpp:104
ADDON_STATUS_FILTER
Add-on installation status filters for the user interface.
Definition: state.hpp:82
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:26
Version in the server is newer than local installation.
Definition: state.hpp:28
bool in_version_control
Definition: state.hpp:57
Dependencies not satisfied.
Definition: state.hpp:33
Ascending sort.
Definition: state.hpp:103
Sort by add-on name.
Definition: state.hpp:94
Represents version numbers.
Definition: version.hpp:44
Sort by last upload time.
Definition: state.hpp:95
std::map< std::string, addon_tracking_info > addons_tracking_list
Definition: state.hpp:62
Stores additional status information about add-ons.
Definition: state.hpp:44
GLdouble s
Definition: glew.h:1358
version_info remote_version
Definition: state.hpp:59
Version in the server matches local installation.
Definition: state.hpp:26