1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#include "semantic_version_ffi.h"
#include "semantic_version.h"
using namespace semver;
//------------------------------------------------------------------------------
int satisfies(const semver_t* a, const semver_t* b)
{
Version va(a->major, a->minor, a->patch,
a->prerelease, a->build);
Version vb(b->major, b->minor, b->patch,
b->prerelease, b->build);
return va.Satisfies(vb) ? 1 : 0;
}
int lessThan(const semver_t* a, const semver_t* b)
{
Version va(a->major, a->minor, a->patch,
a->prerelease, a->build);
Version vb(b->major, b->minor, b->patch,
b->prerelease, b->build);
return (va < vb) ? 1 : 0;
}
void nextMajor(const semver_t* a, semver_t* b)
{
Version va(a->major, a->minor, a->patch,
a->prerelease, a->build);
Version vb = va.NextMajorVersion();
b->major = vb.GetMajorVersion();
b->minor = vb.GetMinorVersion();
b->patch = vb.GetPatchVersion();
}
void nextMinor(const semver_t* a, semver_t* b)
{
Version va(a->major, a->minor, a->patch,
a->prerelease, a->build);
Version vb = va.NextMinorVersion();
b->major = vb.GetMajorVersion();
b->minor = vb.GetMinorVersion();
b->patch = vb.GetPatchVersion();
}
void nextPatch(const semver_t* a, semver_t* b)
{
Version va(a->major, a->minor, a->patch,
a->prerelease, a->build);
Version vb = va.NextPatchVersion();
b->major = vb.GetMajorVersion();
b->minor = vb.GetMinorVersion();
b->patch = vb.GetPatchVersion();
}
|