diff options
Diffstat (limited to 'src/generic/apt/tasks.h')
-rw-r--r-- | src/generic/apt/tasks.h | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/src/generic/apt/tasks.h b/src/generic/apt/tasks.h index 7d439db5..d89fa496 100644 --- a/src/generic/apt/tasks.h +++ b/src/generic/apt/tasks.h @@ -1,12 +1,31 @@ // tasks.h -*-c++-*- // -// Copyright 2001 Daniel Burrows +// Copyright (C) 2001 Daniel Burrows +// Copyright (C) 2012 Daniel Hartwig // +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// + +#ifndef TASKS_H +#define TASKS_H + +#include <apt-pkg/pkgcache.h> #include <string> #include <set> #include <map> -#include <apt-pkg/pkgcache.h> /** \brief Handles parsing the list of tasks and getting the task of a given * package. @@ -16,6 +35,9 @@ class OpProgress; +namespace aptitude { +namespace apt { + class task { private: @@ -31,15 +53,21 @@ public: std::string name; std::string section; - std::string shortdesc; - std::string longdesc; + std::wstring shortdesc; + std::wstring longdesc; std::set<std::string> keys; + std::vector<std::string> packages; bool keys_present(); int relevance; }; +// Stores the various tasks. +extern std::map<std::string, task> *task_list; + +task *find_task(const std::string &name); + /** \brief Get the set of tasks associated with the given package. * * The caller should not delete this set; it's managed internally by @@ -47,8 +75,22 @@ public: */ std::set<std::string> *get_tasks(const pkgCache::PkgIterator &pkg); -// Stores the various tasks. -extern std::map<std::string, task> *task_list; +bool get_task_packages(std::set<pkgCache::PkgIterator> * const pkgset, + const task &task, + const std::string &arch); + +/** \brief Returns \b true if the given package is a task package. + * + * A task package is one that appears in the Key stanza of a task + * definition which has no Packages stanza. For example, the package + * task-ssh-server in the following definition is a task package: + * + * Task: ssh-server + * Section: server + * Key: + * task-ssh-server + */ +bool is_task_package(const pkgCache::PkgIterator &pkg); // (re)loads in the current list of available tasks. Necessary after a // cache reload, for obvious reasons. apt_reload_cache will call this. @@ -58,3 +100,8 @@ void load_tasks(OpProgress &progress); // Since the task list contains package iterators, we have to do something // in case they're still hanging around. void reset_tasks(); + +} +} + +#endif |