alternative to assert
[gtkD.git] / src / glib / Allocator.d
blob9b514461b2af78470af7d5438f125b42cd2db848
1 /*
2 * This file is part of duit.
4 * duit 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 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Memory-Allocators.html
26 * outPack = glib
27 * outFile = Allocator
28 * strct = GAllocator
29 * realStrct=
30 * ctorStrct=
31 * clss = Allocator
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_allocator_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * structWrap:
46 * local aliases:
49 module glib.Allocator;
51 private import glib.glibtypes;
53 private import lib.glib;
55 private import glib.Str;
57 /**
58 * Description
59 * Prior to 2.10, GAllocator was used as an efficient way to allocate
60 * small pieces of memory for use with the GList, GSList and GNode data
61 * structures. Since 2.10, it has been completely replaced by the
62 * slice allocator and deprecated.
64 public class Allocator
67 /** the main Gtk struct */
68 protected GAllocator* gAllocator;
71 public GAllocator* getAllocatorStruct()
73 return gAllocator;
77 /** the main Gtk struct as a void* */
78 protected void* getStruct()
80 return cast(void*)gAllocator;
83 /**
84 * Sets our main struct and passes it to the parent class
86 public this (GAllocator* gAllocator)
88 this.gAllocator = gAllocator;
91 /**
95 /**
96 * Warning
97 * g_allocator_new has been deprecated since version 2.10 and should not be used in newly-written code. Use the slice allocator
98 * instead
99 * Creates a new GAllocator.
100 * name:
101 * the name of the GAllocator. This name is used to set the name of the
102 * GMemChunk used by the GAllocator, and is only used for debugging.
103 * n_preallocs:
104 * the number of elements in each block of memory allocated.
105 * Larger blocks mean less calls to g_malloc(), but some memory may be wasted.
106 * (GLib uses 128 elements per block by default.) The value must be between 1
107 * and 65535.
108 * Returns:
109 * a new GAllocator.
111 public this (char[] name, uint nPreallocs)
113 // GAllocator* g_allocator_new (const gchar *name, guint n_preallocs);
114 this(cast(GAllocator*)g_allocator_new(Str.toStringz(name), nPreallocs) );
118 * Warning
119 * g_allocator_free has been deprecated since version 2.10 and should not be used in newly-written code. Use the slice allocator
120 * instead
121 * Frees all of the memory allocated by the GAllocator.
122 * allocator:
123 * a GAllocator.
125 public void free()
127 // void g_allocator_free (GAllocator *allocator);
128 g_allocator_free(gAllocator);