Zen API

- Home
- Help Topics
- Types by Category
- All Types
- Files

All Classes Files Functions Variables Typedefs Macros Groups Pages
Public Member Functions
kVersion Struct Reference
kApi

## Description

Represents a version number.

Inheritance diagram for kVersion:

## Public Member Functions
kBool | kValue_Equals (kType type, const void *value, const void *other)
| Determines whether a value is equal to another value. More...
kSize | kValue_HashCode (kType type, const void *value)
| Gets a hash code representing the state of this value. More...
void | kValue_Import (kType type, void *value, const void *source)
| Imports the content of another value into this value. More...
k8u | kVersion_Build (kVersion version)
| Returns the build part of a version number. More...
k32s | kVersion_Compare (kVersion version1, kVersion version2)
| Returns an integral value indicating the relationship between the versions. More...
kVersion | kVersion_Create (k32u major, k32u minor, k32u release, k32u build)
| Creates a version value from its constituent parts. More...
kStatus | kVersion_Format (kVersion version, kChar *buffer, kSize capacity)
| Formats a version to a string buffer. More...
k8u | kVersion_Major (kVersion version)
| Returns the major part of a version number. More...
k8u | kVersion_Minor (kVersion version)
| Returns the minor part of a version number. More...
kStatus | kVersion_Parse (kVersion *version, const kChar *buffer)
| Parses a version from a formatted string. More...
k8u | kVersion_Release (kVersion version)
| Returns the release part of a version number. More...

## Member Function Documentation

kBool kValue_Equals | ( | kType | type,
|  | const void * | value,
|  | const void * | other
| ) |  |
| inherited

Determines whether a value is equal to another value.

The default implementation of this method uses type reflection to compare the values field by field. This approach is not efficient, and in some cases may not produce the desired result. Value types should override this method if it is likely that equality comparisons will be required.

Parameters

  type | Value type.
  value | Pointer to value.
  other | Pointer to other value.

Returns
  kTRUE if the values are equal.

kSize kValue_HashCode | ( | kType | type,
|  | const void * | value
| ) |  |
| inherited

Gets a hash code representing the state of this value.

The default implementation of this method uses type reflection to generate a hash code that combines the hash codes from individual fields. This approach is not efficient, and may not produce an optimal hash code. Value types should override this method if it is likely that hash codes will be required.

Parameters

  type | Value type.
  value | Pointer to value.

Returns
  Hash code.

void kValue_Import | ( | kType | type,
|  | void * | value,
|  | const void * | source
| ) |  |
| inherited

Imports the content of another value into this value.

This method supports importing content from an external source, which may have a different size. In particular, "array value" types such as kText32 can import from a null-terminated source array of a differnt length.

Parameters

  type | Value type.
  value | Pointer to value.
  source | Source for import.

k8u kVersion_Build | ( | kVersion | version | ) |

Returns the build part of a version number.

Parameters

  version | Version number.

Returns
  Build version.

k32s kVersion_Compare | ( | kVersion | version1,
|  | kVersion | version2
| ) |  |

Returns an integral value indicating the relationship between the versions.

A zero value represents both versions are equal. A positive value indicates that version2 is greater than version1; a negative value indicates the opposite.

Parameters

  version1 | Version1.
  version2 | Version2.

Returns
  Operation status.

kVersion kVersion_Create | ( | k32u | major,
|  | k32u | minor,
|  | k32u | release,
|  | k32u | build
| ) |  |

Creates a version value from its constituent parts.

Parameters

  major | Major version part.
  minor | Minor version part.
  release | Release version part.
  build | Build version part.

Returns
  Version value.

kStatus kVersion_Format | ( | kVersion | version,
|  | kChar * | buffer,
|  | kSize | capacity
| ) |  |

Formats a version to a string buffer.

Parameters

  version | Version.
  buffer | Receives formatted string (e.g. "1.2.3.4").
  capacity | Buffer capacity.

Returns
  Operation status.

k8u kVersion_Major | ( | kVersion | version | ) |

Returns the major part of a version number.

Parameters

  version | Version number.

Returns
  Major version.

k8u kVersion_Minor | ( | kVersion | version | ) |

Returns the minor part of a version number.

Parameters

  version | Version number.

Returns
  Minor version.

kStatus kVersion_Parse | ( | kVersion * | version,
|  | const kChar * | buffer
| ) |  |

Parses a version from a formatted string.

Parameters

  version | Receives the parsed version.
  buffer | Formatted string (e.g. "1.2.3.4").

Returns
  Operation status.

k8u kVersion_Release | ( | kVersion | version | ) |

Returns the release part of a version number.

Parameters

  version | Version number.

Returns
  Release version.

The documentation for this struct was generated from the following file:

- kApiDef.h