mirror of https://git.sr.ht/~hrbrmstr/vershist
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
568 B
33 lines
568 B
#include <Rcpp.h>
|
|
#include <iostream>
|
|
|
|
#include "cpp-semver.h"
|
|
|
|
using namespace Rcpp;
|
|
|
|
bool one_is_valid(std::string v) {
|
|
|
|
try {
|
|
return(semver::intersects(v));
|
|
} catch(...) {
|
|
return(FALSE);
|
|
}
|
|
|
|
}
|
|
|
|
//' Test if semantic version strings are valid tri-string
|
|
//'
|
|
//' @param v character verctor of version strings
|
|
//' @export
|
|
// [[Rcpp::export]]
|
|
std::vector < bool > is_valid_semver(std::vector < std::string > v) {
|
|
|
|
std::vector < bool > ret(v.size());
|
|
|
|
for (unsigned int i = 0; i < v.size(); i++) {
|
|
ret[i] = one_is_valid(v[i]);
|
|
}
|
|
|
|
return(ret);
|
|
|
|
}
|
|
|