~ubuntu-branches/ubuntu/raring/aptitude/raring

« back to all changes in this revision

Viewing changes to .pc/gcc-4.8/src/generic/apt/tasks.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-02-26 09:14:45 UTC
  • Revision ID: package-import@ubuntu.com-20130226091445-lju4uwlytxt9zahe
Tags: 0.6.8.1-2ubuntu2
Fix build failure with GCC 4.8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// tasks.h             -*-c++-*-
 
2
//
 
3
//  Copyright (C) 2001 Daniel Burrows
 
4
//  Copyright (C) 2012 Daniel Hartwig
 
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
//
 
11
//  This program is distributed in the hope that it will be useful,
 
12
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
//  GNU General Public License for more details.
 
15
//
 
16
//  You should have received a copy of the GNU General Public License along
 
17
//  with this program; if not, write to the Free Software Foundation, Inc.,
 
18
//  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
19
//
 
20
 
 
21
#ifndef TASKS_H
 
22
#define TASKS_H
 
23
 
 
24
#include <apt-pkg/pkgcache.h>
 
25
 
 
26
#include <string>
 
27
#include <set>
 
28
#include <map>
 
29
 
 
30
/** \brief Handles parsing the list of tasks and getting the task of a given
 
31
 *  package.
 
32
 * 
 
33
 *  \file tasks.h
 
34
 */
 
35
 
 
36
class OpProgress;
 
37
 
 
38
namespace aptitude {
 
39
namespace apt {
 
40
 
 
41
class task
 
42
{
 
43
private:
 
44
  bool keys_present_cache;
 
45
  bool keys_present_cache_stale;
 
46
public:
 
47
  task()
 
48
    : keys_present_cache(false),
 
49
      keys_present_cache_stale(true),
 
50
      relevance(0)
 
51
  {
 
52
  }
 
53
 
 
54
  std::string name;
 
55
  std::string section;
 
56
  std::wstring shortdesc;
 
57
  std::wstring longdesc;
 
58
  std::set<std::string> keys;
 
59
  std::vector<std::string> packages;
 
60
 
 
61
  bool keys_present();
 
62
 
 
63
  int relevance;
 
64
};
 
65
 
 
66
// Stores the various tasks.
 
67
extern std::map<std::string, task> *task_list;
 
68
 
 
69
task *find_task(const std::string &name);
 
70
 
 
71
/** \brief Get the set of tasks associated with the given package.
 
72
 *
 
73
 *  The caller should not delete this set; it's managed internally by
 
74
 *  the tasks module.
 
75
 */
 
76
std::set<std::string> *get_tasks(const pkgCache::PkgIterator &pkg);
 
77
 
 
78
bool get_task_packages(std::set<pkgCache::PkgIterator> * const pkgset,
 
79
                       const task &task,
 
80
                       const std::string &arch);
 
81
 
 
82
/** \brief Returns \b true if the given package is a task package.
 
83
 *
 
84
 *  A task package is one that appears in the Key stanza of a task
 
85
 *  definition which has no Packages stanza.  For example, the package
 
86
 *  task-ssh-server in the following definition is a task package:
 
87
 *
 
88
 *    Task: ssh-server
 
89
 *    Section: server
 
90
 *    Key: 
 
91
 *      task-ssh-server
 
92
 */
 
93
bool is_task_package(const pkgCache::PkgIterator &pkg);
 
94
 
 
95
// (re)loads in the current list of available tasks.  Necessary after a
 
96
// cache reload, for obvious reasons.  apt_reload_cache will call this.
 
97
void load_tasks(OpProgress &progress);
 
98
 
 
99
// Discards the current task list and readies a new one to be loaded.
 
100
// Since the task list contains package iterators, we have to do something
 
101
// in case they're still hanging around.
 
102
void reset_tasks();
 
103
 
 
104
}
 
105
}
 
106
 
 
107
#endif