alternative to assert
[gtkD.git] / gtkD / src / cairoLib / Version.d
blob8cbd2b6770e41e2b733c3bb33a8e1a71f1965082
1 /*
2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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 = cairo-Version-Information.html
26 * outPack = cairoLib
27 * outFile = Version
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = Version
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * omit structs:
40 * omit prefixes:
41 * omit code:
42 * imports:
43 * - glib.Str
44 * structWrap:
45 * module aliases:
46 * local aliases:
49 module cairoLib.Version;
51 version(noAssert)
53 version(Tango)
55 import tango.io.Stdout; // use the tango loging?
59 private import gtkc.cairoLibtypes;
61 private import gtkc.cairoLib;
64 private import glib.Str;
69 /**
70 * Description
71 * Cairo has a three-part version number scheme. In this scheme, we use
72 * even vs. odd numbers to distinguish fixed points in the software
73 * vs. in-progress development, (such as from CVS instead of a tar file,
74 * or as a "snapshot" tar file as opposed to a "release" tar file).
75 * _____ Major. Always 1, until we invent a new scheme.
76 * / ___ Minor. Even/Odd = Release/Snapshot (tar files) or Branch/Head (CVS)
77 * | / _ Micro. Even/Odd = Tar-file/CVS
78 * | | /
79 * 1.0.0
80 * Here are a few examples of versions that one might see.
81 * Releases
82 * --------
83 * 1.0.0 - A major release
84 * 1.0.2 - A subsequent maintenance release
85 * 1.2.0 - Another major release
86 * Snapshots
87 * ---------
88 * 1.1.2 - A snapshot (working toward the 1.2.0 release)
89 * In-progress development (eg. from CVS)
90 * --------------------------------------
91 * 1.0.1 - Development on a maintenance branch (toward 1.0.2 release)
92 * 1.1.1 - Development on head (toward 1.1.2 snapshot and 1.2.0 release)
93 * Compatibility
94 * The API/ABI compatibility guarantees for various versions are as
95 * follows. First, let's assume some cairo-using application code that is
96 * successfully using the API/ABI "from" one version of cairo. Then let's
97 * ask the question whether this same code can be moved "to" the API/ABI
98 * of another version of cairo.
99 * Moving from a release to any later version (release, snapshot,
100 * development) is always guaranteed to provide compatibility.
101 * Moving from a snapshot to any later version is not guaranteed to
102 * provide compatibility, since snapshots may introduce new API that ends
103 * up being removed before the next release.
104 * Moving from an in-development version (odd micro component) to any
105 * later version is not guaranteed to provide compatibility. In fact,
106 * there's not even a guarantee that the code will even continue to work
107 * with the same in-development version number. This is because these
108 * numbers don't correspond to any fixed state of the software, but
109 * rather the many states between snapshots and releases.
110 * <hr>
111 * Examining the version
112 * Cairo provides the ability to examine the version at either
113 * compile-time or run-time and in both a human-readable form as well as
114 * an encoded form suitable for direct comparison. Cairo also provides a
115 * macro (CAIRO_VERSION_ENCODE) to perform the encoding.
116 * Compile-time
117 * ------------
118 * CAIRO_VERSION_STRING Human-readable
119 * CAIRO_VERSION Encoded, suitable for comparison
120 * Run-time
121 * --------
122 * cairo_version_string() Human-readable
123 * cairo_version() Encoded, suitable for comparison
124 * For example, checking that the cairo version is greater than or equal
125 * to 1.0.0 could be achieved at compile-time or run-time as follows:
126 * #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 0, 0)
127 * printf ("Compiling with suitable cairo version: %s\n", CAIRO_VERSION_STRING);
128 * #endif
129 * if (cairo_version() >= CAIRO_VERSION_ENCODE(1, 0, 0))
130 * printf ("Running with suitable cairo version: %s\n", cairo_version_string());
132 public class Version
145 * Returns the version of the cairo library encoded in a single
146 * integer as per CAIRO_VERSION_ENCODE. The encoding ensures that
147 * later versions compare greater than earlier versions.
148 * A run-time comparison to check that cairo's version is greater than
149 * or equal to version X.Y.Z could be performed as follows:
150 * if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...}
151 * See also cairo_version_string() as well as the compile-time
152 * equivalents CAIRO_VERSION and CAIRO_VERSION_STRING.
153 * Returns:
154 * the encoded version.
156 public static int cairoVersion()
158 // int cairo_version (void);
159 return cairo_version();
163 * Returns the version of the cairo library as a human-readable string
164 * of the form "X.Y.Z".
165 * See also cairo_version() as well as the compile-time equivalents
166 * CAIRO_VERSION_STRING and CAIRO_VERSION.
167 * Returns:
168 * a string containing the version.
170 public static char[] cairoVersionString()
172 // const char* cairo_version_string (void);
173 return Str.toString(cairo_version_string() );