Line data Source code
1 : // Network Address -- classes functions to ease handling IP addresses
2 : // Copyright (C) 2012-2017 Made to Order Software Corp.
3 : //
4 : // http://snapwebsites.org/project/libaddr
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 :
20 : /** \file
21 : * \brief Implementation of the few global functions used to define the version.
22 : *
23 : * This file includes the few functions one can use to dynamically check
24 : * the version of the libaddr library. If you compiled with a different
25 : * version, then you very certainly could have an incompatible version
26 : * of the interface (i.e. C++ classes cannot always work right when
27 : * created through modified versions of such.)
28 : */
29 :
30 : // self
31 : //
32 : #include "libaddr/addr.h"
33 : #include "libaddr/version.h"
34 :
35 :
36 : namespace addr
37 : {
38 :
39 : /** \brief Major version of the libaddr library.
40 : *
41 : * This function returns the major version of the library at the
42 : * time it was compiled.
43 : *
44 : * The C++ classes are very likely different when compiled against
45 : * a different major version of the library. This means it is likely
46 : * to crash if used.
47 : *
48 : * \return The major version of the libaddr library.
49 : */
50 1 : int get_version_major()
51 : {
52 1 : return LIBADDR_VERSION_MAJOR;
53 : }
54 :
55 :
56 : /** \brief Minor version of the libaddr library.
57 : *
58 : * This function returns the minor version of the library at the
59 : * time it was compiled.
60 : *
61 : * The C++ classes are likely different when compiled against
62 : * a different minor version of the library. This means it is likely
63 : * to crash if used.
64 : *
65 : * \return The minor version of the libaddr library.
66 : */
67 1 : int get_version_minor()
68 : {
69 1 : return LIBADDR_VERSION_MINOR;
70 : }
71 :
72 :
73 : /** \brief Patch version of the libaddr library.
74 : *
75 : * This function returns the patch version of the library at the
76 : * time it was compiled.
77 : *
78 : * The C++ classes should not have changed in such a way that it
79 : * will crash your application when compiled against a version
80 : * that has a different patching version.
81 : *
82 : * \return The patch version of the libaddr library.
83 : */
84 1 : int get_version_patch()
85 : {
86 1 : return LIBADDR_VERSION_PATCH;
87 : }
88 :
89 :
90 : /** \brief The full version of the libaddr library as a string.
91 : *
92 : * This function returns a string with the major, minor, and
93 : * path versions of the library. The build number is not included.
94 : *
95 : * If you want to compare the version, we suggest that you use
96 : * the other functions: get_version_major(), get_version_minor(),
97 : * and get_version_patch(). This function should be used for
98 : * display only.
99 : *
100 : * \return The full version of the libaddr library as a string.
101 : */
102 1 : char const * get_version_string()
103 : {
104 1 : return LIBADDR_VERSION_STRING;
105 : }
106 :
107 : }
108 : // snap_addr namespace
109 : // vim: ts=4 sw=4 et
|