1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = pango-Coverage-Maps.html
27  * outPack = pango
28  * outFile = PgCoverage
29  * strct   = PangoCoverage
30  * realStrct=
31  * ctorStrct=
32  * clss    = PgCoverage
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- pango_coverage_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * 	- PangoCoverage* -> PgCoverage
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module pango.PgCoverage;
54 
55 public  import gtkc.pangotypes;
56 
57 private import gtkc.pango;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 
62 
63 
64 
65 
66 /**
67  * It is often necessary in Pango to determine if a particular font can
68  * represent a particular character, and also how well it can represent
69  * that character. The PangoCoverage is a data structure that is used
70  * to represent that information.
71  */
72 public class PgCoverage
73 {
74 	
75 	/** the main Gtk struct */
76 	protected PangoCoverage* pangoCoverage;
77 	
78 	
79 	public PangoCoverage* getPgCoverageStruct()
80 	{
81 		return pangoCoverage;
82 	}
83 	
84 	
85 	/** the main Gtk struct as a void* */
86 	protected void* getStruct()
87 	{
88 		return cast(void*)pangoCoverage;
89 	}
90 	
91 	/**
92 	 * Sets our main struct and passes it to the parent class
93 	 */
94 	public this (PangoCoverage* pangoCoverage)
95 	{
96 		this.pangoCoverage = pangoCoverage;
97 	}
98 	
99 	/**
100 	 */
101 	
102 	/**
103 	 * Create a new PangoCoverage
104 	 * Throws: ConstructionException GTK+ fails to create the object.
105 	 */
106 	public this ()
107 	{
108 		// PangoCoverage * pango_coverage_new (void);
109 		auto p = pango_coverage_new();
110 		if(p is null)
111 		{
112 			throw new ConstructionException("null returned by pango_coverage_new()");
113 		}
114 		this(cast(PangoCoverage*) p);
115 	}
116 	
117 	/**
118 	 * Increase the reference count on the PangoCoverage by one
119 	 * Returns: coverage
120 	 */
121 	public PgCoverage doref()
122 	{
123 		// PangoCoverage * pango_coverage_ref (PangoCoverage *coverage);
124 		auto p = pango_coverage_ref(pangoCoverage);
125 		
126 		if(p is null)
127 		{
128 			return null;
129 		}
130 		
131 		return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) p);
132 	}
133 	
134 	/**
135 	 * Decrease the reference count on the PangoCoverage by one.
136 	 * If the result is zero, free the coverage and all associated memory.
137 	 */
138 	public void unref()
139 	{
140 		// void pango_coverage_unref (PangoCoverage *coverage);
141 		pango_coverage_unref(pangoCoverage);
142 	}
143 	
144 	/**
145 	 * Copy an existing PangoCoverage. (This function may now be unnecessary
146 	 * since we refcount the structure. File a bug if you use it.)
147 	 * Returns: the newly allocated PangoCoverage, with a reference count of one, which should be freed with pango_coverage_unref(). [transfer full]
148 	 */
149 	public PgCoverage copy()
150 	{
151 		// PangoCoverage * pango_coverage_copy (PangoCoverage *coverage);
152 		auto p = pango_coverage_copy(pangoCoverage);
153 		
154 		if(p is null)
155 		{
156 			return null;
157 		}
158 		
159 		return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) p);
160 	}
161 	
162 	/**
163 	 * Determine whether a particular index is covered by coverage
164 	 * Params:
165 	 * index = the index to check
166 	 * Returns: the coverage level of coverage for character index_.
167 	 */
168 	public PangoCoverageLevel get(int index)
169 	{
170 		// PangoCoverageLevel pango_coverage_get (PangoCoverage *coverage,  int index_);
171 		return pango_coverage_get(pangoCoverage, index);
172 	}
173 	
174 	/**
175 	 * Set the coverage for each index in coverage to be the max (better)
176 	 * value of the current coverage for the index and the coverage for
177 	 * the corresponding index in other.
178 	 * Params:
179 	 * other = another PangoCoverage
180 	 */
181 	public void max(PgCoverage other)
182 	{
183 		// void pango_coverage_max (PangoCoverage *coverage,  PangoCoverage *other);
184 		pango_coverage_max(pangoCoverage, (other is null) ? null : other.getPgCoverageStruct());
185 	}
186 	
187 	/**
188 	 * Modify a particular index within coverage
189 	 * Params:
190 	 * index = the index to modify
191 	 * level = the new level for index_
192 	 */
193 	public void set(int index, PangoCoverageLevel level)
194 	{
195 		// void pango_coverage_set (PangoCoverage *coverage,  int index_,  PangoCoverageLevel level);
196 		pango_coverage_set(pangoCoverage, index, level);
197 	}
198 	
199 	/**
200 	 * Convert a PangoCoverage structure into a flat binary format
201 	 * Params:
202 	 * bytes = location to store result (must be freed with g_free()). [out][array length=n_bytes][element-type guint8]
203 	 */
204 	public void toBytes(out char[] bytes)
205 	{
206 		// void pango_coverage_to_bytes (PangoCoverage *coverage,  guchar **bytes,  int *n_bytes);
207 		guchar* outbytes = null;
208 		int nBytes;
209 		
210 		pango_coverage_to_bytes(pangoCoverage, &outbytes, &nBytes);
211 		
212 		bytes = outbytes[0 .. nBytes];
213 	}
214 	
215 	/**
216 	 * Convert data generated from pango_converage_to_bytes() back
217 	 * to a PangoCoverage
218 	 * Params:
219 	 * bytes = binary data
220 	 * representing a PangoCoverage. [array length=n_bytes][element-type guint8]
221 	 * Returns: a newly allocated PangoCoverage, or NULL if the data was invalid. [transfer full]
222 	 */
223 	public static PgCoverage fromBytes(char[] bytes)
224 	{
225 		// PangoCoverage * pango_coverage_from_bytes (guchar *bytes,  int n_bytes);
226 		auto p = pango_coverage_from_bytes(bytes.ptr, cast(int) bytes.length);
227 		
228 		if(p is null)
229 		{
230 			return null;
231 		}
232 		
233 		return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) p);
234 	}
235 }