xref: /haiku/src/libs/libsolv/solv/solvable.h (revision 909af08f4328301fbdef1ffb41f566c3b5bec0c7)
1 /*
2  * Copyright (c) 2007-2012, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7 
8 /*
9  * solvable.h
10  *
11  * A solvable represents an object with name-epoch:version-release.arch
12  * and dependencies
13  */
14 
15 #ifndef LIBSOLV_SOLVABLE_H
16 #define LIBSOLV_SOLVABLE_H
17 
18 #include "pooltypes.h"
19 #include "queue.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 struct _Repo;
26 
27 typedef struct _Solvable {
28   Id name;
29   Id arch;
30   Id evr;			/* epoch:version-release */
31   Id vendor;
32 
33   struct _Repo *repo;		/* repo we belong to */
34 
35   /* dependencies are offsets into repo->idarraydata */
36   Offset provides;		/* terminated with Id 0 */
37   Offset obsoletes;
38   Offset conflicts;
39 
40   Offset requires;
41   Offset recommends;
42   Offset suggests;
43 
44   Offset supplements;
45   Offset enhances;
46 
47 } Solvable;
48 
49 /* lookup functions */
50 Id solvable_lookup_type(Solvable *s, Id keyname);
51 Id solvable_lookup_id(Solvable *s, Id keyname);
52 unsigned long long solvable_lookup_num(Solvable *s, Id keyname, unsigned long long notfound);
53 unsigned int solvable_lookup_sizek(Solvable *s, Id keyname, unsigned int notfound);
54 const char *solvable_lookup_str(Solvable *s, Id keyname);
55 const char *solvable_lookup_str_poollang(Solvable *s, Id keyname);
56 const char *solvable_lookup_str_lang(Solvable *s, Id keyname, const char *lang, int usebase);
57 int solvable_lookup_bool(Solvable *s, Id keyname);
58 int solvable_lookup_void(Solvable *s, Id keyname);
59 const char *solvable_get_location(Solvable *s, unsigned int *medianrp);	/* old name */
60 const char *solvable_lookup_location(Solvable *s, unsigned int *medianrp);
61 const char *solvable_lookup_sourcepkg(Solvable *s);
62 const unsigned char *solvable_lookup_bin_checksum(Solvable *s, Id keyname, Id *typep);
63 const char *solvable_lookup_checksum(Solvable *s, Id keyname, Id *typep);
64 int solvable_lookup_idarray(Solvable *s, Id keyname, Queue *q);
65 int solvable_lookup_deparray(Solvable *s, Id keyname, Queue *q, Id marker);
66 
67 /* setter functions */
68 void solvable_set_id(Solvable *s, Id keyname, Id id);
69 void solvable_set_num(Solvable *s, Id keyname, unsigned long long num);
70 void solvable_set_str(Solvable *s, Id keyname, const char *str);
71 void solvable_set_poolstr(Solvable *s, Id keyname, const char *str);
72 void solvable_add_poolstr_array(Solvable *s, Id keyname, const char *str);
73 void solvable_add_idarray(Solvable *s, Id keyname, Id id);
74 void solvable_add_deparray(Solvable *s, Id keyname, Id dep, Id marker);
75 void solvable_set_idarray(Solvable *s, Id keyname, Queue *q);
76 void solvable_set_deparray(Solvable *s, Id keyname, Queue *q, Id marker);
77 void solvable_unset(Solvable *s, Id keyname);
78 
79 int solvable_identical(Solvable *s1, Solvable *s2);
80 Id solvable_selfprovidedep(Solvable *s);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* LIBSOLV_SOLVABLE_H */
87