dpkg 1.21.11
pkg-array.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * pkg-array.h - primitives for pkg array handling
4 *
5 * Copyright © 2009-2015 Guillem Jover <guillem@debian.org>
6 *
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef LIBDPKG_PKG_ARRAY_H
22#define LIBDPKG_PKG_ARRAY_H
23
24#include <dpkg/dpkg-db.h>
25#include <dpkg/pkg.h>
26
28
38struct pkg_array {
39 int n_pkgs;
40 struct pkginfo **pkgs;
41};
42
43typedef struct pkginfo *pkg_mapper_func(const char *name);
44typedef void pkg_array_visitor_func(struct pkg_array *a, struct pkginfo *pkg,
45 void *pkg_data);
46
49 const char **pkg_names);
50void pkg_array_foreach(struct pkg_array *a, pkg_array_visitor_func *pkg_visitor,
51 void *pkg_data);
52void pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort);
53void pkg_array_destroy(struct pkg_array *a);
54
58
59#endif /* LIBDPKG_PKG_ARRAY_H */
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
void pkg_array_init_from_names(struct pkg_array *a, pkg_mapper_func *pkg_mapper, const char **pkg_names)
void pkg_array_foreach(struct pkg_array *a, pkg_array_visitor_func *pkg_visitor, void *pkg_data)
Visit each non-NULL package in a package array.
Definition: pkg-array.c:89
void pkg_array_destroy(struct pkg_array *a)
Destroy a package array.
Definition: pkg-array.c:124
void pkg_array_visitor_func(struct pkg_array *a, struct pkginfo *pkg, void *pkg_data)
Definition: pkg-array.h:44
void pkg_array_init_from_hash(struct pkg_array *a)
Initialize a package array from the package database.
Definition: pkg-array.c:62
void pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort)
Sort a package array.
Definition: pkg-array.c:111
struct pkginfo * pkg_mapper_func(const char *name)
Definition: pkg-array.h:43
int pkg_sorter_func(const void *a, const void *b)
Definition: pkg.h:35
Holds an array of pointers to package data.
Definition: pkg-array.h:38
int n_pkgs
Definition: pkg-array.h:39
struct pkginfo ** pkgs
Definition: pkg-array.h:40
Node describing an architecture package instance.
Definition: dpkg-db.h:198