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 module glib.TestLogBuffer;
26 
27 private import glib.ConstructionException;
28 private import glib.TestLogMsg;
29 private import glib.c.functions;
30 public  import glib.c.types;
31 private import gtkd.Loader;
32 
33 
34 /** */
35 public class TestLogBuffer
36 {
37 	/** the main Gtk struct */
38 	protected GTestLogBuffer* gTestLogBuffer;
39 	protected bool ownedRef;
40 
41 	/** Get the main Gtk struct */
42 	public GTestLogBuffer* getTestLogBufferStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return gTestLogBuffer;
47 	}
48 
49 	/** the main Gtk struct as a void* */
50 	protected void* getStruct()
51 	{
52 		return cast(void*)gTestLogBuffer;
53 	}
54 
55 	/**
56 	 * Sets our main struct and passes it to the parent class.
57 	 */
58 	public this (GTestLogBuffer* gTestLogBuffer, bool ownedRef = false)
59 	{
60 		this.gTestLogBuffer = gTestLogBuffer;
61 		this.ownedRef = ownedRef;
62 	}
63 
64 	~this ()
65 	{
66 		if ( Linker.isLoaded(LIBRARY_GLIB) && ownedRef )
67 			g_test_log_buffer_free(gTestLogBuffer);
68 	}
69 
70 
71 	/**
72 	 * Internal function for gtester to free test log messages, no ABI guarantees provided.
73 	 */
74 	public void free()
75 	{
76 		g_test_log_buffer_free(gTestLogBuffer);
77 		ownedRef = false;
78 	}
79 
80 	/**
81 	 * Internal function for gtester to retrieve test log messages, no ABI guarantees provided.
82 	 */
83 	public TestLogMsg pop()
84 	{
85 		auto __p = g_test_log_buffer_pop(gTestLogBuffer);
86 
87 		if(__p is null)
88 		{
89 			return null;
90 		}
91 
92 		return new TestLogMsg(cast(GTestLogMsg*) __p);
93 	}
94 
95 	/**
96 	 * Internal function for gtester to decode test log messages, no ABI guarantees provided.
97 	 */
98 	public void push(uint nBytes, ubyte* bytes)
99 	{
100 		g_test_log_buffer_push(gTestLogBuffer, nBytes, bytes);
101 	}
102 
103 	/**
104 	 * Internal function for gtester to decode test log messages, no ABI guarantees provided.
105 	 *
106 	 * Throws: ConstructionException GTK+ fails to create the object.
107 	 */
108 	public this()
109 	{
110 		auto __p = g_test_log_buffer_new();
111 
112 		if(__p is null)
113 		{
114 			throw new ConstructionException("null returned by new");
115 		}
116 
117 		this(cast(GTestLogBuffer*) __p);
118 	}
119 }