libsemver  1.0.0
libsemver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Enrico M. Crisostomo
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 3, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program. If not, see <http://www.gnu.org/licenses/>.
15  */
28 #ifndef LIBSEMVER_H
29 #define LIBSEMVER_H
30 
31 #include <stdbool.h>
32 
33 #pragma clang diagnostic push
34 #pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
35 
36 # ifdef __cplusplus
37 extern "C"
38 {
39 # endif
40 
41 typedef struct semver_t
42 {
43  void *ptr;
44 } semver_t;
45 
46 int semver_last_error();
47 
48 semver_t *semver_from_string(const char *str);
49 semver_t *semver_create(const unsigned int *c_vers,
50  const unsigned long c_vers_num,
51  const char *prerelease,
52  const char *metadata);
53 void semver_free(semver_t *ver);
54 
55 const char *semver_str(semver_t *ver);
56 unsigned int *semver_get_versions(semver_t *ver);
57 unsigned int semver_get_version(semver_t *ver, unsigned int index);
58 const char *semver_get_prerelease(semver_t *ver);
59 const char *semver_get_metadata(semver_t *ver);
60 semver_t *semver_bump_major(semver_t *ver);
61 semver_t *semver_bump_minor(semver_t *ver);
62 semver_t *semver_bump_patch(semver_t *ver);
63 semver_t *semver_bump(semver_t *ver, unsigned int index);
64 semver_t *semver_strip_prerelease(semver_t *ver);
65 semver_t *semver_strip_metadata(semver_t *ver);
66 bool semver_is_release(semver_t *ver);
67 bool semver_equals(semver_t *lh, semver_t *rh);
68 bool semver_is_less(semver_t *lh, semver_t *rh);
69 bool semver_is_greater(semver_t *lh, semver_t *rh);
70 
71 # ifdef __cplusplus
72 }
73 # endif
74 
75 #endif /* LIBSEMVER_H */
76 
77 #pragma clang diagnostic pop
Definition: libsemver.h:41