VCV Rack API v2
Loading...
Searching...
No Matches
rack::string::Version Struct Reference

Structured version string, for comparison. More...

#include <string.hpp>

Public Member Functions

 Version ()
 
 Version (const std::string &s)
 
 Version (const char *s)
 
 operator std::string () const
 
bool operator< (const Version &other)
 Returns whether this version is earlier than other.
 
std::string getMajor () const
 
std::string getMinor () const
 
std::string getRevision () const
 

Public Attributes

std::vector< std::string > parts
 

Detailed Description

Structured version string, for comparison.

Strings are split into parts by "." and compared lexicographically. Parts are compared as the following.

If both parts can be parsed as integers (such as "10" and "2"), their integer value is compared (so "10" is greater). If one part cannot be parsed as an integer (such as "2" and "beta"), the integer part is greater ("2"). If neither part can be parsed as an integer (such as "alpha" and "beta"), the parts are compared as strings in typical lexicographical order.

For example, the following versions are sorted earliest to latest.

1.a.0
1.b.0
1.0.0
1.0.1
1.2.0
1.10.0
2.0.0

Constructor & Destructor Documentation

◆ Version() [1/3]

rack::string::Version::Version ( )
inline

◆ Version() [2/3]

rack::string::Version::Version ( const std::string & s)

◆ Version() [3/3]

rack::string::Version::Version ( const char * s)
inline

Member Function Documentation

◆ operator std::string()

rack::string::Version::operator std::string ( ) const

◆ operator<()

bool rack::string::Version::operator< ( const Version & other)

Returns whether this version is earlier than other.

◆ getMajor()

std::string rack::string::Version::getMajor ( ) const
inline

◆ getMinor()

std::string rack::string::Version::getMinor ( ) const
inline

◆ getRevision()

std::string rack::string::Version::getRevision ( ) const
inline

Member Data Documentation

◆ parts

std::vector<std::string> rack::string::Version::parts

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