core-adapters 0.1.2
Third-party adapters for snicholls-core: nanobind helpers, nlohmann/json hooks, the snicholls_core Python package
Loading...
Searching...
No Matches
version.hpp File Reference

The core-adapters version, and the core version it was built against. More...

#include <snicholls/core/version.hpp>
#include <string_view>

Go to the source code of this file.

Macros

#define SNICHOLLS_CORE_ADAPTERS_VERSION_MAJOR   0
 The major version.
 
#define SNICHOLLS_CORE_ADAPTERS_VERSION_MINOR   1
 The minor version.
 
#define SNICHOLLS_CORE_ADAPTERS_VERSION_PATCH   2
 The patch version.
 
#define SNICHOLLS_CORE_ADAPTERS_VERSION
 The version as one comparable integer: major * 10000 + minor * 100 + patch.
 
#define SNICHOLLS_CORE_ADAPTERS_VERSION_STRING
 The version as a string literal, "major.minor.patch".
 
#define SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION(major, minor, patch)
 A static_assert that core-adapters is at least major.minor.patch.
 

Functions

constexpr int snicholls::core_adapters::version_major () noexcept
 The major version.
 
constexpr int snicholls::core_adapters::version_minor () noexcept
 The minor version.
 
constexpr int snicholls::core_adapters::version_patch () noexcept
 The patch version.
 
constexpr int snicholls::core_adapters::version () noexcept
 The version as one integer.
 
constexpr std::string_view snicholls::core_adapters::version_string () noexcept
 The version as text.
 
constexpr std::string_view snicholls::core_adapters::core_version_string () noexcept
 The snicholls-core version these headers were compiled against.
 

Detailed Description

The core-adapters version, and the core version it was built against.

Overview. The version of this repository, written in three places that scripts/check_version.py keeps equal: the macros below, project(... VERSION) in CMakeLists.txt and version in pyproject.toml (the Python package snicholls_core has the same number). SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION is the compile-time check for a consumer's header, like core's SNICHOLLS_CORE_REQUIRE_VERSION.

SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION(0, 1, 0); // fails to compile against an older core-adapters
const std::string adapters(snicholls::core_adapters::version_string());
const std::string core(snicholls::core_adapters::core_version_string());
std::printf("core-adapters %s, built against snicholls-core %s\n", adapters.c_str(), core.c_str());
#define SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION(major, minor, patch)
A static_assert that core-adapters is at least major.minor.patch.
Definition version.hpp:65

Relationships. snicholls::core::version() (core's own); the CMake check snicholls_core_require. Group: core-adapters.

Guarantees. constexpr, noexcept.

Errors. None; SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION is a static_assert.

Performance. Compile time only.

Tests and demos. tests/version_test.cpp, demos/version_demo.cpp.

Dependencies. <string_view>, <snicholls/core/version.hpp>.

Known issues. None.

Status. Experimental, pre-1.0.

Definition in file version.hpp.

Macro Definition Documentation

◆ SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION

#define SNICHOLLS_CORE_ADAPTERS_REQUIRE_VERSION (   major,
  minor,
  patch 
)
Value:
static_assert(SNICHOLLS_CORE_ADAPTERS_VERSION >= SNICHOLLS_CORE_VERSION_CHECK(major, minor, patch), \
"core-adapters " SNICHOLLS_CORE_ADAPTERS_VERSION_STRING " is older than the " #major "." #minor \
"." #patch " this code requires")
#define SNICHOLLS_CORE_ADAPTERS_VERSION_STRING
The version as a string literal, "major.minor.patch".
Definition version.hpp:59
#define SNICHOLLS_CORE_ADAPTERS_VERSION
The version as one comparable integer: major * 10000 + minor * 100 + patch.
Definition version.hpp:54

A static_assert that core-adapters is at least major.minor.patch.

Definition at line 65 of file version.hpp.

◆ SNICHOLLS_CORE_ADAPTERS_VERSION

#define SNICHOLLS_CORE_ADAPTERS_VERSION
Value:
#define SNICHOLLS_CORE_ADAPTERS_VERSION_MAJOR
The major version.
Definition version.hpp:47
#define SNICHOLLS_CORE_ADAPTERS_VERSION_PATCH
The patch version.
Definition version.hpp:51
#define SNICHOLLS_CORE_ADAPTERS_VERSION_MINOR
The minor version.
Definition version.hpp:49

The version as one comparable integer: major * 10000 + minor * 100 + patch.

Definition at line 54 of file version.hpp.

◆ SNICHOLLS_CORE_ADAPTERS_VERSION_MAJOR

#define SNICHOLLS_CORE_ADAPTERS_VERSION_MAJOR   0

The major version.

Definition at line 47 of file version.hpp.

◆ SNICHOLLS_CORE_ADAPTERS_VERSION_MINOR

#define SNICHOLLS_CORE_ADAPTERS_VERSION_MINOR   1

The minor version.

Definition at line 49 of file version.hpp.

◆ SNICHOLLS_CORE_ADAPTERS_VERSION_PATCH

#define SNICHOLLS_CORE_ADAPTERS_VERSION_PATCH   2

The patch version.

Definition at line 51 of file version.hpp.

◆ SNICHOLLS_CORE_ADAPTERS_VERSION_STRING

#define SNICHOLLS_CORE_ADAPTERS_VERSION_STRING
Value:
SNICHOLLS_CORE_VERSION_STRINGIFY(SNICHOLLS_CORE_ADAPTERS_VERSION_MAJOR) "." \
SNICHOLLS_CORE_VERSION_STRINGIFY(SNICHOLLS_CORE_ADAPTERS_VERSION_MINOR) "." \
SNICHOLLS_CORE_VERSION_STRINGIFY(SNICHOLLS_CORE_ADAPTERS_VERSION_PATCH)

The version as a string literal, "major.minor.patch".

Definition at line 59 of file version.hpp.

Function Documentation

◆ core_version_string()

constexpr std::string_view snicholls::core_adapters::core_version_string ( )
constexprnoexcept

The snicholls-core version these headers were compiled against.

Returns
core's version string.

Definition at line 83 of file version.hpp.

◆ version()

constexpr int snicholls::core_adapters::version ( )
constexprnoexcept

The version as one integer.

Returns
major * 10000 + minor * 100 + patch.

Definition at line 79 of file version.hpp.

◆ version_major()

constexpr int snicholls::core_adapters::version_major ( )
constexprnoexcept

The major version.

Returns
the number.

Definition at line 73 of file version.hpp.

◆ version_minor()

constexpr int snicholls::core_adapters::version_minor ( )
constexprnoexcept

The minor version.

Returns
the number.

Definition at line 75 of file version.hpp.

◆ version_patch()

constexpr int snicholls::core_adapters::version_patch ( )
constexprnoexcept

The patch version.

Returns
the number.

Definition at line 77 of file version.hpp.

◆ version_string()

constexpr std::string_view snicholls::core_adapters::version_string ( )
constexprnoexcept

The version as text.

Returns
"major.minor.patch".

Definition at line 81 of file version.hpp.