forked from SevenChords/CipesAtHome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
semver.h
105 lines (75 loc) · 1.39 KB
/
semver.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* semver.h
*
* Copyright (c) 2015-2017 Tomas Aparicio
* MIT licensed
*/
#ifndef __SEMVER_H
#define __SEMVER_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SEMVER_VERSION
#define SEMVER_VERSION "0.2.0"
#endif
/**
* semver_t struct
*/
typedef struct semver_version_s {
int major;
int minor;
int patch;
char * metadata;
char * prerelease;
} semver_t;
/**
* Set prototypes
*/
int
semver_satisfies (semver_t x, semver_t y, const char *op);
int
semver_satisfies_caret (semver_t x, semver_t y);
int
semver_satisfies_patch (semver_t x, semver_t y);
int
semver_compare (semver_t x, semver_t y);
int
semver_compare_version (semver_t x, semver_t y);
int
semver_compare_prerelease (semver_t x, semver_t y);
int
semver_gt (semver_t x, semver_t y);
int
semver_gte (semver_t x, semver_t y);
int
semver_lt (semver_t x, semver_t y);
int
semver_lte (semver_t x, semver_t y);
int
semver_eq (semver_t x, semver_t y);
int
semver_neq (semver_t x, semver_t y);
int
semver_parse (const char *str, semver_t *ver);
int
semver_parse_version (const char *str, semver_t *ver);
void
semver_render (semver_t *x, char *dest);
int
semver_numeric (semver_t *x);
void
semver_bump (semver_t *x);
void
semver_bump_minor (semver_t *x);
void
semver_bump_patch (semver_t *x);
void
semver_free (semver_t *x);
int
semver_is_valid (const char *s);
int
semver_clean (char *s);
#ifdef __cplusplus
}
#endif
#endif