]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/srs/projections/impl/pj_strerrno.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / impl / pj_strerrno.hpp
1 // Boost.Geometry
2 // This file is manually converted from PROJ4
3
4 // This file was modified by Oracle on 2017, 2018.
5 // Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11
12 // This file is converted from PROJ4, http://trac.osgeo.org/proj
13 // PROJ4 is originally written by Gerald Evenden (then of the USGS)
14 // PROJ4 is maintained by Frank Warmerdam
15 // This file was converted to Geometry Library by Adam Wulkiewicz
16
17 // Original copyright notice:
18
19 // None
20
21 /* list of projection system pj_errno values */
22
23 #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_STRERRNO_HPP
24 #define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_STRERRNO_HPP
25
26 #include <cerrno>
27 #include <cstring>
28 #include <sstream>
29 #include <string>
30
31 namespace boost { namespace geometry { namespace projections
32 {
33
34 namespace detail
35 {
36
37 static const char *
38 pj_err_list[] = {
39 "no arguments in initialization list", /* -1 */
40 "no options found in 'init' file", /* -2 */
41 "no colon in init= string", /* -3 */
42 "projection not named", /* -4 */
43 "unknown projection id", /* -5 */
44 "effective eccentricity = 1.", /* -6 */
45 "unknown unit conversion id", /* -7 */
46 "invalid boolean param argument", /* -8 */
47 "unknown elliptical parameter name", /* -9 */
48 "reciprocal flattening (1/f) = 0", /* -10 */
49 "|radius reference latitude| > 90", /* -11 */
50 "squared eccentricity < 0", /* -12 */
51 "major axis or radius = 0 or not given", /* -13 */
52 "latitude or longitude exceeded limits", /* -14 */
53 "invalid x or y", /* -15 */
54 "improperly formed DMS value", /* -16 */
55 "non-convergent inverse meridional dist", /* -17 */
56 "non-convergent inverse phi2", /* -18 */
57 "acos/asin: |arg| >1.+1e-14", /* -19 */
58 "tolerance condition error", /* -20 */
59 "conic lat_1 = -lat_2", /* -21 */
60 "lat_1 >= 90", /* -22 */
61 "lat_1 = 0", /* -23 */
62 "lat_ts >= 90", /* -24 */
63 "no distance between control points", /* -25 */
64 "projection not selected to be rotated", /* -26 */
65 "W <= 0 or M <= 0", /* -27 */
66 "lsat not in 1-5 range", /* -28 */
67 "path not in range", /* -29 */
68 "h <= 0", /* -30 */
69 "k <= 0", /* -31 */
70 "lat_0 = 0 or 90 or alpha = 90", /* -32 */
71 "lat_1=lat_2 or lat_1=0 or lat_2=90", /* -33 */
72 "elliptical usage required", /* -34 */
73 "invalid UTM zone number", /* -35 */
74 "arg(s) out of range for Tcheby eval", /* -36 */
75 "failed to find projection to be rotated", /* -37 */
76 "failed to load datum shift file", /* -38 */
77 "both n & m must be spec'd and > 0", /* -39 */
78 "n <= 0, n > 1 or not specified", /* -40 */
79 "lat_1 or lat_2 not specified", /* -41 */
80 "|lat_1| == |lat_2|", /* -42 */
81 "lat_0 is pi/2 from mean lat", /* -43 */
82 "unparseable coordinate system definition", /* -44 */
83 "geocentric transformation missing z or ellps", /* -45 */
84 "unknown prime meridian conversion id", /* -46 */
85 "illegal axis orientation combination", /* -47 */
86 "point not within available datum shift grids", /* -48 */
87 "invalid sweep axis, choose x or y", /* -49 */
88 "malformed pipeline", /* -50 */
89 };
90
91 inline std::string pj_generic_strerrno(std::string const& msg, int err)
92 {
93 std::stringstream ss;
94 ss << msg << " (" << err << ")";
95 return ss.str();
96 }
97
98 inline std::string pj_strerrno(int err) {
99 if (0==err)
100 {
101 return "";
102 }
103 else if (err > 0)
104 {
105 // std::strerror function may be not thread-safe
106 //return std::strerror(err);
107
108 switch(err)
109 {
110 #ifdef EINVAL
111 case EINVAL:
112 return "Invalid argument";
113 #endif
114 #ifdef EDOM
115 case EDOM:
116 return "Math argument out of domain of func";
117 #endif
118 #ifdef ERANGE
119 case ERANGE:
120 return "Math result not representable";
121 #endif
122 default:
123 return pj_generic_strerrno("system error", err);
124 }
125 }
126 else /*if (err < 0)*/
127 {
128 size_t adjusted_err = - err - 1;
129 if (adjusted_err < (sizeof(pj_err_list) / sizeof(char *)))
130 {
131 return(pj_err_list[adjusted_err]);
132 }
133 else
134 {
135 return pj_generic_strerrno("invalid projection system error", err);
136 }
137 }
138 }
139
140 } // namespace detail
141
142 }}} // namespace boost::geometry::projections
143
144 #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_STRERRNO_HPP