User Tools

Site Tools


DzVersion

Class representing a 8-byte (64-bit) version number.

More...

Inherits :

Static Methods

DAZ Script
DzVersionfromString ( String versionStr )

Constructors

DAZ Script
DzVersion ()
DzVersion ( String version )
DzVersion ( Number major, Number minor, Number revision, Number build )
DzVersion ( Number version )
DzVersion ( DzVersion version )

Methods

DAZ Script
Booleanequal ( DzVersion version )
NumbergetBuildNumber ()
StringgetLongVersionString ()
NumbergetMajorVersion ()
NumbergetMinorVersion ()
NumbergetRevisionNumber ()
NumbergetVersionNumber ()
NumbergetVersionNumber32 ()
StringgetVersionString ()
BooleangreaterThan ( DzVersion version )
BooleangreaterThanOrEqual ( DzVersion version )
BooleanisValid ()
BooleanlessThan ( DzVersion version )
BooleanlessThanOrEqual ( DzVersion version )
BooleannotEqual ( DzVersion version )
voidsetVersionNumber ( Number version )
voidsetVersionNumber ( Number major, Number minor, Number revision, Number build )
StringtoString ()

Detailed Description

This class was added to DAZ Studio 4.x to make it easier to work with 64-bit version numbers and to facilitate compatibility with the old 32-bit version numbers.

Version numbers are typically displayed to the user as short version strings, e.g. 4.0, or long version strings, e.g. 4.0.0.0.

The version number consists of 4 components: The Major version number, the Minor version number, the Revision number, and the Build number. This is displayed in the following order: Major.Minor.Revision.Build.

In DAZ Studio, version numbers are typically stored as 64-bit unsigned integers with 16 bits for each number. This means that each number has a valid range of 0-65535. The most significant 16 bits are the Major version number, the next most significant 16 bits are the Minor version number, the next most significant 16 bits are the Revision number and the least significant 16 bits are the Build number. So, a packed version number in hexadecimal notation might look like: 0x1111222233334444 where 1111 is the Major version number, 2222 is the Minor version number 3333 is the Revision number and 4444 is the build number.

It is recommended that this class be used when possible to reduce confusion when dealing with version numbers in code.

This class provides methods for all of the numerical comparison operators (<, >, ⇐, >=, ==, !=) to make it easy to compare version numbers without directly using the packed value, or the individual components.

Since:

  • 4.8.1.20

Static Methods


DzVersion : fromString( String versionStr )

Parses a version string into a version number.

Parameter(s):

  • versionStr - A string representation of the version number in the form “major.minor.revision.build”

Return Value:

  • The version number that was created from the string.

Constructors


DzVersion()

Default constructor. Creates an empty version number - i.e. 0.0.0.0


DzVersion( String version )

Creates a version number by parsing a version string.

Parameter(s):

  • version - A string representation of the version number in the form “major.minor.revision.build”

DzVersion( Number major, Number minor, Number revision, Number build )

Creates a version number from the 4 16-bit components.

Parameter(s):

  • major - The major version number.
  • minor - The minor version number.
  • revision - The revision number.
  • build - The build number.

DzVersion( Number version )

Compatibility constructor. Creates a 64-bit version number from an old 32-bit version number.

Parameter(s):

  • version - The 32-bit version number to convert.

Creates a version number from a 64-bit packed representation.

Parameter(s):

  • version - The 64-bit version number.

DzVersion( DzVersion version )

Copy constructor. Creates a version that is a copy of the given number.

Parameter(s):

  • version - The version number to create a copy of.

Methods


Boolean : equal( DzVersion version )

Parameter(s):

  • version - The version to compare.

Return Value:

  • true if the version numbers are the same, otherwise false.

Number : getBuildNumber()

Return Value:

  • The Build number.

String : getLongVersionString()

Return Value:

  • A string containing all four version numbers separated with a dot, e.g. “4.0.0.0”

Number : getMajorVersion()

Return Value:

  • The Major version number.

Number : getMinorVersion()

Return Value:

  • The Minor version number.

Number : getRevisionNumber()

Return Value:

  • The Revision number.

Number : getVersionNumber()

Return Value:

  • The 64-bit packed representation of the version number.

Number : getVersionNumber32()

Return Value:

  • A 32-bit packed representation of the version number.

Attention:

  • For backwards compatibility with old 32-bit version numbers - this function should only be used if absolutely necessary. It is highly recommended that all functionality be ported to the new 64-bit version number system. Using this function will result in inaccurate version numbering if one of the version numbers is greater than 255.

String : getVersionString()

Return Value:

  • A string containing the Major and Minor version numbers separated with a dot, e.g. “4.0”

Boolean : greaterThan( DzVersion version )

Parameter(s):

  • version - The version to compare.

Return Value:

  • true if the version number is greater than (newer than) this version number, otherwise false.

Boolean : greaterThanOrEqual( DzVersion version )

Parameter(s):

  • version - The version to compare.

Return Value:

  • true if the version number is greater than or equal (newer than or the same as) this version number, otherwise false.

Boolean : isValid()

Return Value:

  • true if the version number has been initialized, otherwise false.

Boolean : lessThan( DzVersion version )

Parameter(s):

  • version - The version to compare.

Return Value:

  • true if the version number is less than (older than) this version number, otherwise false.

Boolean : lessThanOrEqual( DzVersion version )

Parameter(s):

  • version - The version to compare.

Return Value:

  • true if the version number is less than or equal (older than or the same as) this version number, otherwise false.

Boolean : notEqual( DzVersion version )

Parameter(s):

  • version - The version to compare.

Return Value:

  • true if the version numbers are different, otherwise false.

void : setVersionNumber( Number version )

Sets the 64-bit version number from an old 32-bit version number.

Parameter(s):

  • version - The old 32-bit version number.

Sets the version number from a 64-bit packed version number.

Parameter(s):

  • version - The version number as a packed 64-bit value.

void : setVersionNumber( Number major, Number minor, Number revision, Number build )

Sets the version number from the 4 16-bit components.

Parameter(s):

  • major - The major version number.
  • minor - The minor version number.
  • revision - The revision number.
  • build - The build number.

String : toString()

Return Value:

  • A string representation of this version in the form “major.minor.revision.build”.