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