Line data Source code
1 : // Copyright (c) 2012-2021 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/libaddr
4 : //
5 : // Permission is hereby granted, free of charge, to any person obtaining a
6 : // copy of this software and associated documentation files (the
7 : // "Software"), to deal in the Software without restriction, including
8 : // without limitation the rights to use, copy, modify, merge, publish,
9 : // distribute, sublicense, and/or sell copies of the Software, and to
10 : // permit persons to whom the Software is furnished to do so, subject to
11 : // the following conditions:
12 : //
13 : // The above copyright notice and this permission notice shall be included
14 : // in all copies or substantial portions of the Software.
15 : //
16 : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 : // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 : // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 : // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 : // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 : // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 : // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 :
24 :
25 : /** \file
26 : * \brief Implementation of the few global functions used to define the version.
27 : *
28 : * This file includes the few functions one can use to dynamically check
29 : * the version of the libaddr library. If you compiled with a different
30 : * version, then you very certainly could have an incompatible version
31 : * of the interface (i.e. C++ classes cannot always work right when
32 : * created through modified versions of such.)
33 : */
34 :
35 : // self
36 : //
37 : #include "libaddr/addr.h"
38 : #include "libaddr/version.h"
39 :
40 :
41 : // last include
42 : //
43 : #include <snapdev/poison.h>
44 :
45 :
46 :
47 : namespace addr
48 : {
49 :
50 : /** \brief Major version of the libaddr library.
51 : *
52 : * This function returns the major version of the library at the
53 : * time it was compiled.
54 : *
55 : * The C++ classes are very likely different when compiled against
56 : * a different major version of the library. This means it is likely
57 : * to crash if used.
58 : *
59 : * \return The major version of the libaddr library.
60 : */
61 1 : int get_version_major()
62 : {
63 1 : return LIBADDR_VERSION_MAJOR;
64 : }
65 :
66 :
67 : /** \brief Minor version of the libaddr library.
68 : *
69 : * This function returns the minor version of the library at the
70 : * time it was compiled.
71 : *
72 : * The C++ classes are likely different when compiled against
73 : * a different minor version of the library. This means it is likely
74 : * to crash if used.
75 : *
76 : * \return The minor version of the libaddr library.
77 : */
78 1 : int get_version_minor()
79 : {
80 1 : return LIBADDR_VERSION_MINOR;
81 : }
82 :
83 :
84 : /** \brief Patch version of the libaddr library.
85 : *
86 : * This function returns the patch version of the library at the
87 : * time it was compiled.
88 : *
89 : * The C++ classes should not have changed in such a way that it
90 : * will crash your application when compiled against a version
91 : * that has a different patching version.
92 : *
93 : * \return The patch version of the libaddr library.
94 : */
95 1 : int get_version_patch()
96 : {
97 1 : return LIBADDR_VERSION_PATCH;
98 : }
99 :
100 :
101 : /** \brief The full version of the libaddr library as a string.
102 : *
103 : * This function returns a string with the major, minor, and
104 : * path versions of the library. The build number is not included.
105 : *
106 : * If you want to compare the version, we suggest that you use
107 : * the other functions: get_version_major(), get_version_minor(),
108 : * and get_version_patch(). This function should be used for
109 : * display only.
110 : *
111 : * \return The full version of the libaddr library as a string.
112 : */
113 1 : char const * get_version_string()
114 : {
115 1 : return LIBADDR_VERSION_STRING;
116 : }
117 :
118 :
119 :
120 : }
121 : // namespace addr
122 : // vim: ts=4 sw=4 et
|