Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.
/ pseudosem Public archive

Permissive semantic version comparison in C++11.

License

Notifications You must be signed in to change notification settings

Ortham/pseudosem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pseudosem

Pseudosem is a header-only version string comparison library, written in C++11, that conforms to the Semantic Versioning specification, and also supports extended version syntaxes:

  • Leading zeroes (eg. 0.05.1)
  • Arbitrary number of release version parts (eg. 1.2.3.4.5)
  • Non-numeric release version parts (eg. 1.0a, 1.0z.5)
  • Space, colon, hyphen and underscore prerelease separators (eg. 1.0.0 alpha:1-2_3)
  • Case insensitivity

See Pseudosem's test suite for a full set of examples.

Usage

Example:

#include <pseudosem.h>
#include <iostream>

int main() {
    std::string v1("1.0.0");
    std::string v2("2.4.0");

    int result = pseudosem::compare(v1, v2);

    if (result < 0)
        std::cout << "v1 is an earlier version than v2";
    else if (result == 0)
        std::cout << "v1 is an equivalent version to v2";
    else
        std::cout << "v1 is a later version than v2";

    return 0;
}

Tests

Pseudosem has a test suite built on Google Test, and uses CMake to support cross-platform building. From the Pseudosem directory root:

mkdir build
cd build
cmake ..
./tests

About

Permissive semantic version comparison in C++11.

Resources

License

Stars

Watchers

Forks

Packages

No packages published