4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef TASK_STORE_HPP
25 #define TASK_STORE_HPP
28 #include "Util/tstring.hpp"
38 * Class to load multiple tasks on demand, e.g. for browsing
51 Item(tstring::const_pointer the_filename
,
52 tstring::const_pointer _task_name
,
53 unsigned _task_index
= 0)
54 :task_name(_task_name
),
55 filename(the_filename
),
56 task_index(_task_index
),
63 tstring::const_pointer
GetName() const {
64 return task_name
.c_str();
68 tstring::const_pointer
GetPath() const {
69 return filename
.c_str();
72 OrderedTask
*GetTask(const TaskBehaviour
&task_behaviour
);
75 bool operator<(const TaskStore::Item
&other
) const {
76 return task_name
.compare(other
.task_name
) < 0;
80 typedef std::vector
<TaskStore::Item
> ItemVector
;
84 * Internal task storage
90 * Scan the XCSoarData folder for .tsk files and add them to the TaskStore
92 * @param extra scan all "extra" (non-XCSoar) task files, e.g. *.cup
93 * and task declarations from *.igc
95 void Scan(bool extra
=false);
98 * Clear all the tasks from the TaskStore
103 * Return the number of tasks in the TaskStore
104 * @return The number of tasks in the TaskStore
107 size_t Size() const {
112 * Return the filename of the task defined by the given index
113 * (e.g. TestTask.tsk)
114 * @param index TaskStore index of the desired Task
115 * @return Filename of the task defined by the given index
118 tstring::const_pointer
GetName(unsigned index
) const;
121 * Return the pathname of the task defined by the given index
122 * (e.g. tasks/TestTask.tsk)
123 * @param index TaskStore index of the desired Task
124 * @return pathname of the task defined by the given index
127 tstring::const_pointer
GetPath(unsigned index
) const;
130 * Return the task defined by the given index
131 * @param index TaskStore index of the desired Task
132 * @return The task defined by the given index
134 OrderedTask
*GetTask(unsigned index
, const TaskBehaviour
&task_behaviour
);