summaryrefslogtreecommitdiff
path: root/src/generic/apt/tasks.h
blob: 46ce83e04834c2c84a68a8dc089fdc8aeb3fe688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// tasks.h             -*-c++-*-
//
//  Copyright 2001 Daniel Burrows
//
//  Handles parsing the list of tasks and getting the task of a given
// package.

#include <string>
#include <list>
#include <map>
#include <apt-pkg/pkgcache.h>

class OpProgress;

class task
{
private:
  bool keys_present_cache;
  bool keys_present_cache_stale;
public:
  task():keys_present_cache(false), keys_present_cache_stale(true) {}

  std::string name;
  std::string section;
  std::string shortdesc;
  std::string longdesc;
  std::list<std::string> keys;

  bool keys_present();

  int relevance;
};

// The caller should **NOT** delete the list.
std::list<std::string> *get_tasks(const pkgCache::PkgIterator &pkg);

// Stores the various tasks.
extern std::map<std::string, task> *task_list;

// (re)loads in the current list of available tasks.  Necessary after a
// cache reload, for obvious reasons.  apt_reload_cache will call this.
void load_tasks(OpProgress &progress);

// Discards the current task list and readies a new one to be loaded.
// Since the task list contains package iterators, we have to do something
// in case they're still hanging around.
void reset_tasks();