summaryrefslogtreecommitdiffstats
path: root/src/version.cpp
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2006-01-16 02:36:01 +0000
committermental <mental@users.sourceforge.net>2006-01-16 02:36:01 +0000
commit179fa413b047bede6e32109e2ce82437c5fb8d34 (patch)
treea5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/version.cpp
downloadinkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz
inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/version.cpp')
-rw-r--r--src/version.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/version.cpp b/src/version.cpp
new file mode 100644
index 000000000..fff30ddcc
--- /dev/null
+++ b/src/version.cpp
@@ -0,0 +1,64 @@
+#define __VERSION_C__
+
+/*
+ * Versions
+ *
+ * Authors:
+ * MenTaLguY <mental@rydia.net>
+ *
+ * Copyright (C) 2003 MenTaLguY
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <stdio.h>
+#include "version.h"
+
+gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version)
+{
+ if (!string) {
+ return FALSE;
+ }
+
+ version->major = 0;
+ version->minor = 0;
+
+ return sscanf((const char *)string, "%u.%u",
+ &version->major, &version->minor) ||
+ sscanf((const char *)string, "%u", &version->major);
+}
+
+gchar *sp_version_to_string(Inkscape::Version version)
+{
+ return g_strdup_printf("%u.%u", version.major, version.minor);
+}
+
+gboolean sp_version_inside_range(Inkscape::Version version,
+ unsigned major_min, unsigned minor_min,
+ unsigned major_max, unsigned minor_max)
+{
+ if ( version.major < major_min || version.major > major_max ) {
+ return FALSE;
+ } else if ( version.major == major_min &&
+ version.minor <= minor_min )
+ {
+ return FALSE;
+ } else if ( version.major == major_max &&
+ version.minor >= minor_max )
+ {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :