All Projects → easz → cpp-semver

easz / cpp-semver

Licence: MIT License
semver in c++

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to cpp-semver

semver-cli
semver-cli is a simple command line tool to compare and manipulate version strings.
Stars: ✭ 28 (+12%)
Mutual labels:  semver
next-ver
Tells you the next semantic version for your local package
Stars: ✭ 27 (+8%)
Mutual labels:  semver
verl
SemVer 2.0 parsing, matching, and comparisons for Erlang
Stars: ✭ 28 (+12%)
Mutual labels:  semver
ocaml-semver
Semantic version handling for OCaml
Stars: ✭ 16 (-36%)
Mutual labels:  semver
probot-semver
A GitHub app that provides automatic semantic versioning support
Stars: ✭ 15 (-40%)
Mutual labels:  semver
gradle-versioner
Gradle Version Plugin. Generates semantic versions with git meta data per branch.
Stars: ✭ 25 (+0%)
Mutual labels:  semver
git-version-bumper
Bump your git tag to the next version, easily. 👊
Stars: ✭ 92 (+268%)
Mutual labels:  semver
breakcheck
Backwards compatibility linter for Go.
Stars: ✭ 66 (+164%)
Mutual labels:  semver
cocogitto
The Conventional Commits toolbox
Stars: ✭ 242 (+868%)
Mutual labels:  semver
zerover
0️⃣ Minimalist versioning scheme for devs who can't be bothered.
Stars: ✭ 141 (+464%)
Mutual labels:  semver
gradle-semantic-build-versioning
Gradle plugin to generate version-numbers and tags using semantic versioning
Stars: ✭ 19 (-24%)
Mutual labels:  semver
bin-version-cli
Get the version of a binary in semver format
Stars: ✭ 36 (+44%)
Mutual labels:  semver
semver-generator
Semantic version generator using git commit keywords and overrides
Stars: ✭ 26 (+4%)
Mutual labels:  semver
dont-crack
semantic-release plugin checking if the new semantic release is breaking dependent projects
Stars: ✭ 14 (-44%)
Mutual labels:  semver
bump
A generic version tracking and update tool
Stars: ✭ 33 (+32%)
Mutual labels:  semver
xavtool
Xplat Automating Version Tool
Stars: ✭ 33 (+32%)
Mutual labels:  semver
semver
Kotlin data class for Semantic Versioning 2.0.0 specification (SemVer)
Stars: ✭ 51 (+104%)
Mutual labels:  semver
terraform-module-versions
CLI tool that checks Terraform code for module updates. Single binary, no dependencies. linux, osx, windows. #golang #cli #terraform
Stars: ✭ 143 (+472%)
Mutual labels:  semver
koji
🦊 An interactive CLI for creating conventional commits.
Stars: ✭ 25 (+0%)
Mutual labels:  semver
turbogit
Opinionated cli enforcing clean git workflow without comprising UX
Stars: ✭ 42 (+68%)
Mutual labels:  semver

cpp-semver - Semantic Versioning in C++

Features

API handling string representation

  • semver::valid( v ): return true if the given version or range is syntactically and semantically valid.
  • semver::intersects( range1, range2="*" ): return true if the given version ranges or comparators intersect.
  • semver::satisfies( version, range ): return true if the version satisfies the range.
  • semver::gt( v1, v2 ), semver::gte( v1, v2 ), semver::lt( v1, v2 ), semver::lte( v1, v2 ), semver::eq( v1, v2 ), semver::neq( v1, v2 ), semver::gtr( version, range ), semver::ltr( version, range ): various comparators.
  • semver::prerelease( version ), semver::major( version ), semver::minor( version ), semver::patch( version ): get version parts if possible.

Usage & Demo

// example/demo.cpp

#include "cpp-semver.hpp"
#include <iostream>

int main()
{
  {
    const std::string ver1 = "1.0.0 || 1.5 - 3.0";
    const std::string ver2 = ">1.1 <2.0";

    const bool intersected = semver::intersects(ver1, ver2);

    std::cout << "\"" << ver1
      << "\" and \"" << ver2
      << "\" are " << (intersected ? "" : "not ")
      << "intersected." << std::endl;
  }

  {
    const std::string comp = "<1.* >2.2";

    const bool intersected = semver::intersects(comp);

    std::cout << "\"" << comp
      << "\" is " << (intersected ? "" : "not ")
      << "intersected." << std::endl;
  }

  return 0;
}

To build:

> g++ -std=c++11 -Iinclude example/demo.cpp

Or build with optional PEGTL parser: (to cross test, or to quickly evaluate any grammar change for development purpose.)

> git submodule update --init --recursive
> g++ -std=c++11 -D USE_PEGTL -Iinclude -IPEGTL/include example/demo.cpp

The result:

> ./a.out
"1.0.0 || 1.5 - 3.0" and ">1.1 <2.0" are intersected.
"<1.* >2.2" is not intersected.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].