Arbiter
Dependency manager library that supports decentralization
Functions
Version.h File Reference

Go to the source code of this file.

Functions

int ArbiterCompareVersionOrdering (const ArbiterSemanticVersion *lhs, const ArbiterSemanticVersion *rhs)
 Orders two semantic versions relative to each other. More...
 
ArbiterSelectedVersionArbiterCreateSelectedVersion (const ArbiterSemanticVersion *semanticVersion, ArbiterUserValue metadata)
 Creates a selected version which corresponds to the given semantic version. More...
 
ArbiterSelectedVersionListArbiterCreateSelectedVersionList (const ArbiterSelectedVersion *const *versions, size_t count)
 Creates a version list which wraps a C array of ArbiterSelectedVersion objects. More...
 
ArbiterSemanticVersionArbiterCreateSemanticVersion (unsigned major, unsigned minor, unsigned patch, const char *prereleaseVersion, const char *buildMetadata)
 Creates a semantic version with the given components. More...
 
ArbiterSemanticVersionArbiterCreateSemanticVersionFromString (const char *string)
 Attempts to parse the given NUL-terminated string into a semantic version, returning NULL if a parse failure occurs. More...
 
const char * ArbiterGetBuildMetadata (const ArbiterSemanticVersion *version)
 Returns the build metadata string from a semantic version, or NULL if there is not one associated with the version. More...
 
unsigned ArbiterGetMajorVersion (const ArbiterSemanticVersion *version)
 Returns the major version number (X.y.z) from a semantic version. More...
 
unsigned ArbiterGetMinorVersion (const ArbiterSemanticVersion *version)
 Returns the minor version number (x.Y.z) from a semantic version. More...
 
unsigned ArbiterGetPatchVersion (const ArbiterSemanticVersion *version)
 Returns the patch version number (x.y.Z) from a semantic version. More...
 
const char * ArbiterGetPrereleaseVersion (const ArbiterSemanticVersion *version)
 Returns the prerelease version string from a semantic version, or NULL if there is not one associated with the version. More...
 
const void * ArbiterSelectedVersionMetadata (const ArbiterSelectedVersion *version)
 Returns any metadata pointer which was provided to ArbiterCreateSelectedVersion(). More...
 
const ArbiterSemanticVersionArbiterSelectedVersionSemanticVersion (const ArbiterSelectedVersion *version)
 Returns the semantic version which corresponds to the given selected version, or NULL if there is no semantic version component. More...
 

Function Documentation

§ ArbiterCompareVersionOrdering()

int ArbiterCompareVersionOrdering ( const ArbiterSemanticVersion lhs,
const ArbiterSemanticVersion rhs 
)

Orders two semantic versions relative to each other.

Returns -1 if lhs is less than rhs, 1 if lhs is greater than rhs, or 0 if the two versions have the same precedence (which may be the case even if their build metadata differs).

§ ArbiterCreateSelectedVersion()

ArbiterSelectedVersion* ArbiterCreateSelectedVersion ( const ArbiterSemanticVersion semanticVersion,
ArbiterUserValue  metadata 
)

Creates a selected version which corresponds to the given semantic version.

semanticVersion may be NULL to represent a selected version that has metadata but no semantic version component; for example, to use with ArbiterCreateRequirementUnversioned().

The returned version must be freed with ArbiterFree().

§ ArbiterCreateSelectedVersionList()

ArbiterSelectedVersionList* ArbiterCreateSelectedVersionList ( const ArbiterSelectedVersion *const *  versions,
size_t  count 
)

Creates a version list which wraps a C array of ArbiterSelectedVersion objects.

The objects in the C array can be safely freed after calling this function.

The returned list must be freed with ArbiterFree().

§ ArbiterCreateSemanticVersion()

ArbiterSemanticVersion* ArbiterCreateSemanticVersion ( unsigned  major,
unsigned  minor,
unsigned  patch,
const char *  prereleaseVersion,
const char *  buildMetadata 
)

Creates a semantic version with the given components.

The returned version must be freed with ArbiterFree().

§ ArbiterCreateSemanticVersionFromString()

ArbiterSemanticVersion* ArbiterCreateSemanticVersionFromString ( const char *  string)

Attempts to parse the given NUL-terminated string into a semantic version, returning NULL if a parse failure occurs.

The returned version must be freed with ArbiterFree().

§ ArbiterGetBuildMetadata()

const char* ArbiterGetBuildMetadata ( const ArbiterSemanticVersion version)

Returns the build metadata string from a semantic version, or NULL if there is not one associated with the version.

For example, in the version 1.0.0+20160814, the build metadata string will be 20160814.

The returned pointer is only guaranteed to remain valid for the current scope.

§ ArbiterGetMajorVersion()

unsigned ArbiterGetMajorVersion ( const ArbiterSemanticVersion version)

Returns the major version number (X.y.z) from a semantic version.

§ ArbiterGetMinorVersion()

unsigned ArbiterGetMinorVersion ( const ArbiterSemanticVersion version)

Returns the minor version number (x.Y.z) from a semantic version.

§ ArbiterGetPatchVersion()

unsigned ArbiterGetPatchVersion ( const ArbiterSemanticVersion version)

Returns the patch version number (x.y.Z) from a semantic version.

§ ArbiterGetPrereleaseVersion()

const char* ArbiterGetPrereleaseVersion ( const ArbiterSemanticVersion version)

Returns the prerelease version string from a semantic version, or NULL if there is not one associated with the version.

For example, in the version 1.0.0-alpha.1, the prerelease version string will be alpha.1.

The returned pointer is only guaranteed to remain valid for the current scope.

§ ArbiterSelectedVersionMetadata()

const void* ArbiterSelectedVersionMetadata ( const ArbiterSelectedVersion version)

Returns any metadata pointer which was provided to ArbiterCreateSelectedVersion().

The returned pointer is only guaranteed to remain valid for the current scope.

§ ArbiterSelectedVersionSemanticVersion()

const ArbiterSemanticVersion* ArbiterSelectedVersionSemanticVersion ( const ArbiterSelectedVersion version)

Returns the semantic version which corresponds to the given selected version, or NULL if there is no semantic version component.

The returned pointer is only guaranteed to remain valid for the current scope.