1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/base/nsIVersionComparator.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +/** 1.12 + * Version strings are dot-separated sequences of version-parts. 1.13 + * 1.14 + * A version-part consists of up to four parts, all of which are optional: 1.15 + * 1.16 + * <number-a><string-b><number-c><string-d (everything else)> 1.17 + * 1.18 + * A version-part may also consist of a single asterisk "*" which indicates 1.19 + * "infinity". 1.20 + * 1.21 + * Numbers are base-10, and are zero if left out. 1.22 + * Strings are compared bytewise. 1.23 + * 1.24 + * For additional backwards compatibility, if "string-b" is "+" then 1.25 + * "number-a" is incremented by 1 and "string-b" becomes "pre". 1.26 + * 1.27 + * 1.0pre1 1.28 + * < 1.0pre2 1.29 + * < 1.0 == 1.0.0 == 1.0.0.0 1.30 + * < 1.1pre == 1.1pre0 == 1.0+ 1.31 + * < 1.1pre1a 1.32 + * < 1.1pre1 1.33 + * < 1.1pre10a 1.34 + * < 1.1pre10 1.35 + * 1.36 + * Although not required by this interface, it is recommended that 1.37 + * numbers remain within the limits of a signed char, i.e. -127 to 128. 1.38 + */ 1.39 +[scriptable, uuid(e6cd620a-edbb-41d2-9e42-9a2ffc8107f3)] 1.40 +interface nsIVersionComparator : nsISupports 1.41 +{ 1.42 + /** 1.43 + * Compare two version strings 1.44 + * @param A The first version 1.45 + * @param B The second version 1.46 + * @returns < 0 if A < B 1.47 + * = 0 if A == B 1.48 + * > 0 if A > B 1.49 + */ 1.50 + long compare(in ACString A, in ACString B); 1.51 +}; 1.52 +