Skip to content
/ YASVL Public

Yet another semantic versioning library written in C++20.

License

Notifications You must be signed in to change notification settings

Au-lit/YASVL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yet another semantic versioning library (YASVL)

Yasvl is a single header C++20 library to handle versions:

#include "yasvl.hpp"

int main() {
	yasvl::version aVersion{ 1, 0 };
	std::cout << "The compiler version(" << yasvl::compiler_version << ") is greater than " << aVersion << ": " 
	          << std::boolalpha << (yasvl::compiler_version > aVersion) << '\n';
}

Possible output:

The compiler version(v11.0.0) is greater than v1.0.0: true

Here is a resume of the api

// constant versions
yasvl::compiler_version;
yasvl::cpp_version;
yasvl::yasvl_version;

yasvl::version ver{ 1, 0 }; // agregate (in the order depicted below)
ver.major; // the major version
ver.minor; // the minor version
ver.patch; // the patch version
ver.pre_release_type; // the pre-release type 
                      // (decltype(pre_release_type) == enum class pre_release { alpha, beta, rc, none };)
ver.pre_release_number; // the pre-release number (for example beta.1, one being the number). 
                        // decltype(pre_release_number) == std::optional</* unsigned integer type*/>
ver.build; // the build number
           // decltype(build) == std::optional</* unsigned integer type of at least 10 bits*/>

ver.to_string(); // returns a string represntation of the version
ver.format_to(OutputIterator it); // writes to it a string representation of the version

In the near future yasvl::version::from_string will be working