GeographicLib 2.5
Constants.hpp
Go to the documentation of this file.
1/**
2 * \file Constants.hpp
3 * \brief Header for GeographicLib::Constants class
4 *
5 * Copyright (c) Charles Karney (2008-2024) <karney@alum.mit.edu> and licensed
6 * under the MIT/X11 License. For more information, see
7 * https://geographiclib.sourceforge.io/
8 **********************************************************************/
9
10#if !defined(GEOGRAPHICLIB_CONSTANTS_HPP)
11#define GEOGRAPHICLIB_CONSTANTS_HPP 1
12
13#include <GeographicLib/Config.h>
14
15/**
16 * @relates GeographicLib::Constants
17 * Pack the version components into a single integer. Users should not rely on
18 * this particular packing of the components of the version number; see the
19 * documentation for GEOGRAPHICLIB_VERSION, below.
20 **********************************************************************/
21#define GEOGRAPHICLIB_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c))
22
23/**
24 * @relates GeographicLib::Constants
25 * The version of GeographicLib as a single integer, packed as MMmmmmpp where
26 * MM is the major version, mmmm is the minor version, and pp is the patch
27 * level. Users should not rely on this particular packing of the components
28 * of the version number. Instead they should use a test such as \code
29 #if GEOGRAPHICLIB_VERSION >= GEOGRAPHICLIB_VERSION_NUM(1,37,0)
30 ...
31 #endif
32 * \endcode
33 **********************************************************************/
34#define GEOGRAPHICLIB_VERSION \
35 GEOGRAPHICLIB_VERSION_NUM(GEOGRAPHICLIB_VERSION_MAJOR, \
36 GEOGRAPHICLIB_VERSION_MINOR, \
37 GEOGRAPHICLIB_VERSION_PATCH)
38
39// For reference, here is a table of Visual Studio and _MSC_VER
40// correspondences:
41//
42// _MSC_VER Visual Studio
43// 1100 vc5
44// 1200 vc6
45// 1300 vc7
46// 1310 vc7.1 (2003)
47// 1400 vc8 (2005)
48// 1500 vc9 (2008)
49// 1600 vc10 (2010)
50// 1700 vc11 (2012)
51// 1800 vc12 (2013)
52// 1900 vc14 (2015) First version of VS to include enough C++11 support
53// 191[0-9] vc15 (2017)
54// 192[0-9] vc16 (2019)
55// 193[0-9] vc17 (2022)
56
57#if defined(_MSC_VER) && defined(GEOGRAPHICLIB_SHARED_LIB) && \
58 GEOGRAPHICLIB_SHARED_LIB
59# if GEOGRAPHICLIB_SHARED_LIB > 1
60# error GEOGRAPHICLIB_SHARED_LIB must be 0 or 1
61# elif defined(GeographicLib_SHARED_EXPORTS)
62# define GEOGRAPHICLIB_EXPORT __declspec(dllexport)
63# else
64# define GEOGRAPHICLIB_EXPORT __declspec(dllimport)
65# endif
66#else
67# define GEOGRAPHICLIB_EXPORT
68#endif
69
70// Use GEOGRAPHICLIB_DEPRECATED to mark functions, types or variables as
71// deprecated. Code inspired by Apache Subversion's svn_types.h file (via
72// MPFR).
73#if defined(__GNUC__)
74# if __GNUC__ > 4
75# define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated(msg)))
76# else
77# define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated))
78# endif
79#elif defined(_MSC_VER) && _MSC_VER >= 1300
80# define GEOGRAPHICLIB_DEPRECATED(msg) __declspec(deprecated(msg))
81#else
82# define GEOGRAPHICLIB_DEPRECATED(msg)
83#endif
84
85#include <stdexcept>
86#include <string>
88
89/**
90 * \brief Namespace for %GeographicLib
91 *
92 * All of %GeographicLib is defined within the GeographicLib namespace. In
93 * addition all the header files are included via %GeographicLib/Class.hpp.
94 * This minimizes the likelihood of conflicts with other packages.
95 **********************************************************************/
96namespace GeographicLib