fff30ddccea7499457284985dfa9ddd7e3597215
1 #define __VERSION_C__
3 /*
4 * Versions
5 *
6 * Authors:
7 * MenTaLguY <mental@rydia.net>
8 *
9 * Copyright (C) 2003 MenTaLguY
10 *
11 * Released under GNU GPL, read the file 'COPYING' for more information
12 */
14 #include <stdio.h>
15 #include "version.h"
17 gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version)
18 {
19 if (!string) {
20 return FALSE;
21 }
23 version->major = 0;
24 version->minor = 0;
26 return sscanf((const char *)string, "%u.%u",
27 &version->major, &version->minor) ||
28 sscanf((const char *)string, "%u", &version->major);
29 }
31 gchar *sp_version_to_string(Inkscape::Version version)
32 {
33 return g_strdup_printf("%u.%u", version.major, version.minor);
34 }
36 gboolean sp_version_inside_range(Inkscape::Version version,
37 unsigned major_min, unsigned minor_min,
38 unsigned major_max, unsigned minor_max)
39 {
40 if ( version.major < major_min || version.major > major_max ) {
41 return FALSE;
42 } else if ( version.major == major_min &&
43 version.minor <= minor_min )
44 {
45 return FALSE;
46 } else if ( version.major == major_max &&
47 version.minor >= minor_max )
48 {
49 return FALSE;
50 } else {
51 return TRUE;
52 }
53 }
55 /*
56 Local Variables:
57 mode:c++
58 c-file-style:"stroustrup"
59 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
60 indent-tabs-mode:nil
61 fill-column:99
62 End:
63 */
64 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :