0ee41c5471d16754fd828c12fbe73c06db47d5f9
[tools/librpm-tizen.git] / lib / rpmgi.h
1 #ifndef H_RPMGI
2 #define H_RPMGI
3
4 /** \ingroup rpmio
5  * \file rpmio/rpmgi.h
6  */
7
8 #include <rpmlib.h>
9 #include <rpmts.h>
10 #include <fts.h>
11 #include <argv.h>
12
13 /**
14  */
15 /*@-exportlocal@*/
16 /*@unchecked@*/
17 extern int _rpmgi_debug;
18 /*@=exportlocal@*/
19
20 /**
21  */
22 typedef /*@abstract@*/ struct rpmgi_s * rpmgi;
23
24 /**
25  */
26 typedef enum rpmgiTag_e {
27     RPMGI_RPMDB         = RPMDBI_PACKAGES,
28     RPMGI_HDLIST        = 6,    /* XXX next after RPMDBI_AVAILABLE */
29     RPMGI_ARGLIST       = 7,
30     RPMGI_FTSWALK       = 8
31 } rpmgiTag;
32
33 #if defined(_RPMGI_INTERNAL)
34 /** \ingroup rpmio
35  */
36 struct rpmgi_s {
37     rpmts ts;
38     int tag;
39     int i;
40
41     rpmdbMatchIterator mi;
42
43     char *const * argv;
44     int argc;
45     int ftsOpts;
46     FTS * ftsp;
47     FTSENT * fts;
48
49 /*@refs@*/
50     int nrefs;
51 };
52 #endif
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 /**
59  * Unreference a generalized iterator instance.
60  * @param gi            generalized iterator
61  * @param msg
62  * @return              NULL always
63  */
64 /*@unused@*/ /*@null@*/
65 rpmgi rpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
66                 /*@null@*/ const char * msg)
67         /*@modifies gi @*/;
68
69 /** @todo Remove debugging entry from the ABI. */
70 /*@-exportlocal@*/
71 /*@null@*/
72 rpmgi XrpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
73                 /*@null@*/ const char * msg, const char * fn, unsigned ln)
74         /*@modifies gi @*/;
75 /*@=exportlocal@*/
76 #define rpmgiUnlink(_gi, _msg)  XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__)
77
78 /**
79  * Reference a generalized iterator instance.
80  * @param gi            generalized iterator
81  * @param msg
82  * @return              new generalized iterator reference
83  */
84 /*@unused@*/ /*@newref@*/ /*@null@*/
85 rpmgi rpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg)
86         /*@modifies gi @*/;
87
88 /** @todo Remove debugging entry from the ABI. */
89 /*@newref@*/ /*@null@*/
90 rpmgi XrpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg,
91                 const char * fn, unsigned ln)
92         /*@modifies gi @*/;
93 #define rpmgiLink(_gi, _msg)    XrpmgiLink(_gi, _msg, __FILE__, __LINE__)
94
95 /** Destroy a generalized iterator.
96  * @param gi            generalized iterator
97  * @return              NULL always
98  */
99 /*@only@*/
100 rpmgi rpmgiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi)
101         /*@modifies gi @*/;
102
103 /** Create a generalized iterator.
104  * @param argv          iterator argv array
105  * @param flags         iterator flags
106  * @return              new general iterator
107  */
108 /*@only@*/
109 rpmgi rpmgiNew(rpmts ts, int tag, const void * keyp, size_t keylen)
110         /*@*/;
111
112 const char * rpmgiNext(/*@null@*/ rpmgi gi)
113         /*@modifies gi @*/;
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif  /* H_RPMGI */