1 /*
2  * Copyright (c) 2012, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7 
8 /*
9  * selection.h
10  *
11  */
12 
13 #ifndef LIBSOLV_SELECTION_H
14 #define LIBSOLV_SELECTION_H
15 
16 #include "pool.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /* what to match */
23 #define SELECTION_NAME			(1 << 0)
24 #define SELECTION_PROVIDES		(1 << 1)
25 #define SELECTION_FILELIST		(1 << 2)
26 #define SELECTION_CANON			(1 << 3)
27 
28 /* match extensions */
29 #define SELECTION_DOTARCH		(1 << 4)	/* allow ".arch" suffix */
30 #define SELECTION_REL			(1 << 5)	/* allow "<=> rel" suffix */
31 
32 /* string comparison modifiers */
33 #define SELECTION_GLOB			(1 << 9)
34 #define SELECTION_NOCASE		(1 << 11)
35 
36 /* extra flags */
37 #define SELECTION_FLAT			(1 << 10)	/* flatten the resulting selection */
38 #define SELECTION_SKIP_KIND		(1 << 14)	/* remove kind: name prefix in SELECTION_NAME matches */
39 #define SELECTION_MATCH_DEPSTR		(1 << 15)	/* match dep2str result */
40 
41 /* package selection */
42 #define SELECTION_INSTALLED_ONLY	(1 << 8)
43 #define SELECTION_SOURCE_ONLY		(1 << 12)
44 #define SELECTION_WITH_SOURCE		(1 << 13)
45 #define SELECTION_WITH_DISABLED		(1 << 16)
46 #define SELECTION_WITH_BADARCH		(1 << 17)
47 #define SELECTION_WITH_ALL		(SELECTION_WITH_SOURCE | SELECTION_WITH_DISABLED | SELECTION_WITH_BADARCH)
48 
49 /* result operator */
50 #define SELECTION_REPLACE		(0 << 28)
51 #define SELECTION_ADD			(1 << 28)
52 #define SELECTION_SUBTRACT		(2 << 28)
53 #define SELECTION_FILTER		(3 << 28)
54 
55 
56 /* extra SELECTION_FILTER bits */
57 #define SELECTION_FILTER_KEEP_IFEMPTY	(1 << 30)
58 #define SELECTION_FILTER_SWAPPED	(1 << 31)
59 
60 /* internal */
61 #define SELECTION_MODEBITS		(3 << 28)
62 
63 extern int  selection_make(Pool *pool, Queue *selection, const char *name, int flags);
64 extern int  selection_make_matchdeps(Pool *pool, Queue *selection, const char *name, int flags, int keyname, int marker);
65 extern int  selection_make_matchdepid(Pool *pool, Queue *selection, Id dep, int flags, int keyname, int marker);
66 extern int selection_make_matchsolvable(Pool *pool, Queue *selection, Id solvid, int flags, int keyname, int marker);
67 extern int selection_make_matchsolvablelist(Pool *pool, Queue *selection, Queue *solvidq, int flags, int keyname, int marker);
68 
69 extern void selection_filter(Pool *pool, Queue *sel1, Queue *sel2);
70 extern void selection_add(Pool *pool, Queue *sel1, Queue *sel2);
71 extern void selection_subtract(Pool *pool, Queue *sel1, Queue *sel2);
72 
73 extern void selection_solvables(Pool *pool, Queue *selection, Queue *pkgs);
74 
75 extern const char *pool_selection2str(Pool *pool, Queue *selection, Id flagmask);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
82