ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
toy::application::Version Struct Reference

Application version information structure. More...

Public Attributes

uint32_t major {0}
 Major version; incompatible API changes.
uint32_t minor {0}
 Minor version; backward-compatible additions.
uint32_t maintenance {0}
 Maintenance version; backward-compatible fixes.
uint32_t revision {0}
 Revision (e.g. build or patch level).

Detailed Description

Application version information structure.

Version represents a semantic version number following the major.minor.maintenance.revision format. This structure is designed for compile-time version management and provides a simple way to track application versions throughout the development lifecycle.

Key Features

  • Semantic versioning: major.minor.maintenance.revision format.
  • Constexpr: Usable in constexpr contexts; comparison operators are constexpr.
  • Exception safety: All operations are noexcept.
  • Type safety: uint32_t components; no implicit conversions.

Usage Example

#include "application.hpp"
constexpr toy::application::Version version;
constexpr toy::application::Version customVersion{1, 2, 3, 4};
if (customVersion >= toy::application::Version{1, 0, 0, 0}) {
// API 1.x or later
}
Umbrella header for the app module.
Application version information structure.
Definition version.hpp:85

Performance Characteristics

  • Construction: O(1).
  • Access: O(1) for all members.
  • Comparison: O(1) for operator== and operator<=>.
  • Memory: 16 bytes (4 × uint32_t).

Safety Guarantees

  • Type safety: Strong typing; no overflow in normal version ranges.
  • Exception safety: All operations are noexcept; no dynamic allocation.
  • Thread safety: Trivially copyable; safe to copy across threads.

Compatibility

  • Semantic versioning: Aligns with semver.org (major.minor.patch); maintenance and revision map to patch/build.
  • ABI: Plain layout; safe to pass across translation units and use in stable ABIs.
Note
For runtime parsing from strings, use separate utility functions.
See also
https://semver.org/

Member Data Documentation

◆ maintenance

uint32_t toy::application::Version::maintenance {0}

Maintenance version; backward-compatible fixes.

◆ major

uint32_t toy::application::Version::major {0}

Major version; incompatible API changes.

◆ minor

uint32_t toy::application::Version::minor {0}

Minor version; backward-compatible additions.

◆ revision

uint32_t toy::application::Version::revision {0}

Revision (e.g. build or patch level).


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