1 /*
2  * Copyright © 2016  Igor Gnatenko <ignatenko@redhat.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include "dnf-reldep-list.h"
20 #include "dnf-sack-private.hpp"
21 #include "repo/solvable/Dependency.hpp"
22 #include "repo/solvable/DependencyContainer.hpp"
23 
24 /**
25  * dnf_reldep_list_new:
26  * @sack: a #DnfSack
27  *
28  * Returns: an #DnfReldepList
29  *
30  * Since: 0.7.0
31  */
32 DnfReldepList *
dnf_reldep_list_new(DnfSack * sack)33 dnf_reldep_list_new (DnfSack *sack)
34 {
35     return new libdnf::DependencyContainer(sack);
36 }
37 
38 /**
39  * dnf_reldep_list_free:
40  * @reldep_list: a #DnfReldepList
41  *
42  * Returns: Nothing
43  */
44 void
dnf_reldep_list_free(DnfReldepList * reldep_list)45 dnf_reldep_list_free (DnfReldepList *reldep_list)
46 {
47     delete reldep_list;
48 }
49 
50 /**
51  * dnf_reldep_list_add:
52  * @reldep_list: a #DnfReldepList
53  * @reldep: a #DnfReldep
54  *
55  * Returns: Nothing.
56  *
57  * Since: 0.7.0
58  */
59 void
dnf_reldep_list_add(DnfReldepList * reldep_list,DnfReldep * reldep)60 dnf_reldep_list_add (DnfReldepList *reldep_list,
61                      DnfReldep     *reldep)
62 {
63     reldep_list->add(reldep);
64 }
65 
66 /**
67  * dnf_reldep_list_count:
68  * @reldep_list: a #DnfReldepList
69  *
70  * Returns: Number of RelDeps in queue.
71  *
72  * Since: 0.7.0
73  */
74 gint
dnf_reldep_list_count(DnfReldepList * reldep_list)75 dnf_reldep_list_count (DnfReldepList *reldep_list)
76 {
77     return reldep_list->count();
78 }
79 
80 /**
81  * dnf_reldep_list_index:
82  * @reldep_list: a #DnfReldepList
83  * @index: Index
84  *
85  * Returns: (transfer full): an #DnfReldep
86  *
87  * Since: 0.7.0
88  */
89 DnfReldep *
dnf_reldep_list_index(DnfReldepList * reldep_list,gint index)90 dnf_reldep_list_index (DnfReldepList *reldep_list,
91                        gint           index)
92 {
93     return reldep_list->getPtr(index);
94 }
95 
96 /**
97  * dnf_reldep_list_extend:
98  * @rl1: original #DnfReldepList
99  * @rl2: additional #DnfReldepList
100  *
101  * Extends @rl1 with elements from @rl2.
102  *
103  * Returns: Nothing.
104  *
105  * Since: 0.7.0
106  */
107 void
dnf_reldep_list_extend(DnfReldepList * rl1,DnfReldepList * rl2)108 dnf_reldep_list_extend (DnfReldepList *rl1,
109                         DnfReldepList *rl2)
110 {
111     rl1->extend(rl2);
112 }
113