xmlwrapp
Lightweight C++ XML parsing library
Loading...
Searching...
No Matches
version.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Vaclav Slavik <vslavik@gmail.com>
3 * All Rights Reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * 3. Neither the name of the Author nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
23 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33/**
34 @file
35
36 This file contains the XMLWRAPP_CHECK_VERSION macro.
37 */
38
39#ifndef _xmlwrapp_version_h_
40#define _xmlwrapp_version_h_
41
42#include "xmlwrapp/export.h"
43
44/**
45 Compile-time major version of the library.
46
47 This is the first version component.
48
49 @see XMLWRAPP_CHECK_VERSION()
50 */
51#define XMLWRAPP_VERSION_MAJOR 0
52
53/**
54 Compile-time minor version of the library.
55
56 This is the second version component.
57
58 @see XMLWRAPP_CHECK_VERSION()
59 */
60#define XMLWRAPP_VERSION_MINOR 10
61
62/**
63 Compile-time micro version of the library.
64
65 This is the third version component.
66
67 @see XMLWRAPP_CHECK_VERSION()
68 */
69#define XMLWRAPP_VERSION_MICRO 0
70
71#define XMLWRAPP_VERSION_STRING_CONCAT(major, minor, micro) \
72 #major "." #minor "." #micro
73
74#define XMLWRAPP_VERSION_STRING_IMPL(major, minor, micro) \
75 XMLWRAPP_VERSION_STRING_CONCAT(major, minor, micro)
76
77/**
78 Compile-time version of the library as a string.
79
80 This is a string in the form "major.minor.micro".
81
82 @see XMLWRAPP_VERSION_MAJOR, XMLWRAPP_VERSION_MINOR,
83 XMLWRAPP_VERSION_MICRO, XMLWRAPP_CHECK_VERSION()
84
85 @since 0.10.0
86 */
87#define XMLWRAPP_VERSION_STRING \
88 XMLWRAPP_VERSION_STRING_IMPL(XMLWRAPP_VERSION_MAJOR, \
89 XMLWRAPP_VERSION_MINOR, \
90 XMLWRAPP_VERSION_MICRO)
91
92/**
93 Checks if xmlwrapp version is at least @a major.@a minor.@a micro.
94
95 This is a compile-time check, see check_version() for a runtime check.
96 */
97#define XMLWRAPP_CHECK_VERSION(major, minor, micro) \
98 ( \
99 XMLWRAPP_VERSION_MAJOR > (major) \
100 || \
101 (XMLWRAPP_VERSION_MAJOR == (major) && \
102 XMLWRAPP_VERSION_MINOR >= (minor)) \
103 || \
104 (XMLWRAPP_VERSION_MAJOR == (major) && \
105 (XMLWRAPP_VERSION_MINOR == (minor) && \
106 XMLWRAPP_VERSION_MICRO >= (micro))) \
107 )
108
109namespace xml
110{
111
112/**
113 Return major runtime version of xmlwrapp library.
114
115 This can be different from XMLWRAPP_VERSION_MAJOR if a different version of
116 the library is used at runtime than the one that was used to compile the
117 code.
118
119 @see XMLWRAPP_VERSION_MAJOR
120
121 @since 0.10.0
122 */
123XMLWRAPP_API int get_major_version();
124
125/**
126 Return minor runtime version of xmlwrapp library.
127
128 @see get_major_version(), XMLWRAPP_VERSION_MINOR
129
130 @since 0.10.0
131 */
132XMLWRAPP_API int get_minor_version();
133
134/**
135 Return micro runtime version of xmlwrapp library.
136
137 @see get_major_version(), get_minor_version(), XMLWRAPP_VERSION_MICRO
138
139 @since 0.10.0
140 */
141XMLWRAPP_API int get_micro_version();
142
143/**
144 Return the full runtime version of xmlwrapp library.
145
146 This is a string in the form "major.minor.micro".
147
148 @see get_major_version(), get_minor_version(), get_micro_version()
149
150 @since 0.10.0
151 */
152XMLWRAPP_API const char* get_version_string();
153
154/**
155 Check that the library version is at least the given one.
156
157 Returns true if the version is at least @a major.@a minor.@a micro, false
158 otherwise,
159
160 @see XMLWRAPP_CHECK_VERSION(), get_version_string()
161
162 @since 0.10.0
163 */
164XMLWRAPP_API bool check_version(int major, int minor, int micro);
165
166} // namespace xml
167
168#endif // _xmlwrapp_version_h_
XML library namespace.
Definition attributes.h:55
int get_major_version()
Return major runtime version of xmlwrapp library.
int get_minor_version()
Return minor runtime version of xmlwrapp library.
const char * get_version_string()
Return the full runtime version of xmlwrapp library.
bool check_version(int major, int minor, int micro)
Check that the library version is at least the given one.
int get_micro_version()
Return micro runtime version of xmlwrapp library.