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