source: appstream-generator/build/girepo/appstream/Suggested.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.7 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software 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
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module appstream.Suggested;
22
23private import gi.appstream;
24public  import gi.appstreamtypes;
25private import glib.ConstructionException;
26private import glib.PtrArray;
27private import glib.Str;
28private import gobject.ObjectG;
29
30
31/** */
32public class Suggested : ObjectG
33{
34        /** the main Gtk struct */
35        protected AsSuggested* asSuggested;
36
37        /** Get the main Gtk struct */
38        public AsSuggested* getSuggestedStruct()
39        {
40                return asSuggested;
41        }
42
43        /** the main Gtk struct as a void* */
44        protected override void* getStruct()
45        {
46                return cast(void*)asSuggested;
47        }
48
49        protected override void setStruct(GObject* obj)
50        {
51                asSuggested = cast(AsSuggested*)obj;
52                super.setStruct(obj);
53        }
54
55        /**
56         * Sets our main struct and passes it to the parent class.
57         */
58        public this (AsSuggested* asSuggested, bool ownedRef = false)
59        {
60                this.asSuggested = asSuggested;
61                super(cast(GObject*)asSuggested, ownedRef);
62        }
63
64
65        /** */
66        public static GType getType()
67        {
68                return as_suggested_get_type();
69        }
70
71        /**
72         * Creates a new #AsSuggested.
73         *
74         * Returns: a new #AsSuggested
75         *
76         * Throws: ConstructionException GTK+ fails to create the object.
77         */
78        public this()
79        {
80                auto p = as_suggested_new();
81               
82                if(p is null)
83                {
84                        throw new ConstructionException("null returned by new");
85                }
86               
87                this(cast(AsSuggested*) p, true);
88        }
89
90        /**
91         * Converts the text representation to an enumerated value.
92         *
93         * Params:
94         *     kindStr = the string.
95         *
96         * Returns: a #AsSuggestedKind or %AS_SUGGESTED_KIND_UNKNOWN for unknown
97         */
98        public static AsSuggestedKind kindFromString(string kindStr)
99        {
100                return as_suggested_kind_from_string(Str.toStringz(kindStr));
101        }
102
103        /**
104         * Converts the enumerated value to an text representation.
105         *
106         * Params:
107         *     kind = the %AsSuggestedKind.
108         *
109         * Returns: string version of @kind
110         */
111        public static string kindToString(AsSuggestedKind kind)
112        {
113                return Str.toString(as_suggested_kind_to_string(kind));
114        }
115
116        /**
117         * Add a component id to this suggested object.
118         *
119         * Params:
120         *     cid = The component id to add
121         */
122        public void addId(string cid)
123        {
124                as_suggested_add_id(asSuggested, Str.toStringz(cid));
125        }
126
127        /**
128         * Get a list of components id that generated the suggestion
129         *
130         * Returns: an array of components id
131         */
132        public PtrArray getIds()
133        {
134                auto p = as_suggested_get_ids(asSuggested);
135               
136                if(p is null)
137                {
138                        return null;
139                }
140               
141                return new PtrArray(cast(GPtrArray*) p);
142        }
143
144        /**
145         * Gets the suggested kind.
146         *
147         * Returns: the #AssuggestedKind
148         */
149        public AsSuggestedKind getKind()
150        {
151                return as_suggested_get_kind(asSuggested);
152        }
153
154        /**
155         * Check if the essential properties of this suggestion are
156         * populated with useful data.
157         *
158         * Returns: %TRUE if we have useful data.
159         */
160        public bool isValid()
161        {
162                return as_suggested_is_valid(asSuggested) != 0;
163        }
164
165        /**
166         * Sets the suggested kind.
167         *
168         * Params:
169         *     kind = the #AsSuggestedKind, e.g. %AS_SUGGESTED_KIND_HEURISTIC.
170         */
171        public void setKind(AsSuggestedKind kind)
172        {
173                as_suggested_set_kind(asSuggested, kind);
174        }
175}
Note: See TracBrowser for help on using the repository browser.