summaryrefslogtreecommitdiff
path: root/plugins/shotwell-data-imports/VersionNumber.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-07-09 12:10:38 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-07-09 12:10:38 +0200
commit709e2d6f5652ec90c194a4ec2b530bebc6f952cb (patch)
tree496b2f3899e1d5728ee9ae76095cc5056c317447 /plugins/shotwell-data-imports/VersionNumber.vala
parentf1353e9ffd34db5f755c7da0b3f9c10638fbfd38 (diff)
parent5c8be07095cc04a6d8a95204b0504fd7ab030154 (diff)
Merge branch 'release/0.28.3-1'0.28.3-1
Diffstat (limited to 'plugins/shotwell-data-imports/VersionNumber.vala')
-rw-r--r--plugins/shotwell-data-imports/VersionNumber.vala49
1 files changed, 0 insertions, 49 deletions
diff --git a/plugins/shotwell-data-imports/VersionNumber.vala b/plugins/shotwell-data-imports/VersionNumber.vala
deleted file mode 100644
index 7077597..0000000
--- a/plugins/shotwell-data-imports/VersionNumber.vala
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2016 Software Freedom Conservancy Inc.
- *
- * This software is licensed under the GNU Lesser General Public License
- * (version 2.1 or later). See the COPYING file in this distribution.
- */
-
-namespace Utils {
-
-/**
- * A class that represents a version number in the form x.y.z and is able to compare
- * different versions.
- */
-public class VersionNumber : Object, Gee.Comparable<VersionNumber> {
- private int[] version;
-
- public VersionNumber(int[] version) {
- this.version = version;
- }
-
- public VersionNumber.from_string(string str_version, string separator = ".") {
- string[] version_items = str_version.split(separator);
- this.version = new int[version_items.length];
- for (int i = 0; i < version_items.length; i++)
- this.version[i] = int.parse(version_items[i]);
- }
-
- public string to_string() {
- string[] version_items = new string[this.version.length];
- for (int i = 0; i < this.version.length; i++)
- version_items[i] = this.version[i].to_string();
- return string.joinv(".", version_items);
- }
-
- public int compare_to(VersionNumber other) {
- int max_len = ((this.version.length > other.version.length) ?
- this.version.length : other.version.length);
- int res = 0;
- for(int i = 0; i < max_len; i++) {
- int this_v = (i < this.version.length ? this.version[i] : 0);
- int other_v = (i < other.version.length ? other.version[i] : 0);
- res = this_v - other_v;
- if (res != 0)
- break;
- }
- return res;
- }
-}
-
-}