/usr/include/mapnik/value.hpp is in libmapnik-dev 3.0.12+ds-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2015 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_VALUE_HPP
#define MAPNIK_VALUE_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/value_hash.hpp>
#include <mapnik/util/variant.hpp>
namespace mapnik {
using value_base = util::variant<value_null, value_bool, value_integer,value_double, value_unicode_string>;
namespace value_adl_barrier {
class MAPNIK_DECL value : public value_base
{
friend MAPNIK_DECL value operator+(value const&,value const&);
friend MAPNIK_DECL value operator-(value const&,value const&);
friend MAPNIK_DECL value operator*(value const&,value const&);
friend MAPNIK_DECL value operator/(value const&,value const&);
friend MAPNIK_DECL value operator%(value const&,value const&);
public:
value() = default;
// conversion from type T is done via a temporary of type U, which
// is determined by mapnik_value_type;
// enable_if< decay<T> != value > is necessary to avoid ill-formed
// recursion in noexcept specifier; and it also prevents using this
// constructor where implicitly-declared copy/move should be used
// (e.g. value(value&))
template <typename T,
typename U = typename std::enable_if<
!detail::is_same_decay<T, value>::value,
detail::mapnik_value_type_decay<T>
>::type::type>
value(T && val)
noexcept(noexcept(U(std::forward<T>(val))) &&
std::is_nothrow_constructible<value_base, U && >::value)
: value_base(U(std::forward<T>(val))) {}
template <typename T,
typename U = typename std::enable_if<
!detail::is_same_decay<T, value>::value,
detail::mapnik_value_type_decay<T>
>::type::type>
value& operator=(T && val)
noexcept(noexcept(U(std::forward<T>(val))) &&
std::is_nothrow_assignable<value_base, U && >::value)
{
value_base::operator=(U(std::forward<T>(val)));
return *this;
}
bool operator==(value const& other) const;
bool operator!=(value const& other) const;
bool operator>(value const& other) const;
bool operator>=(value const& other) const;
bool operator<(value const& other) const;
bool operator<=(value const& other) const;
value operator-() const;
bool is_null() const;
template <typename T> T convert() const;
value_bool to_bool() const;
std::string to_expression_string(char quote = '\'') const;
std::string to_string() const;
value_unicode_string to_unicode() const;
value_double to_double() const;
value_integer to_int() const;
};
MAPNIK_DECL value operator+(value const& p1,value const& p2);
MAPNIK_DECL value operator-(value const& p1,value const& p2);
MAPNIK_DECL value operator*(value const& p1,value const& p2);
MAPNIK_DECL value operator/(value const& p1,value const& p2);
MAPNIK_DECL value operator%(value const& p1,value const& p2);
template <typename charT, typename traits>
inline std::basic_ostream<charT,traits>&
operator << (std::basic_ostream<charT,traits>& out,
value const& v)
{
out << v.to_string();
return out;
}
// hash function
inline std::size_t hash_value(value const& val)
{
return mapnik_hash_value(val);
}
} // namespace value_adl_barrier
using value = value_adl_barrier::value;
namespace detail {
struct is_null_visitor
{
bool operator()(value const& val) const
{
return val.is_null();
}
bool operator()(value_null const&) const
{
return true;
}
template <typename T>
bool operator()(T const&) const
{
return false;
}
};
} // namespace detail
} // namespace mapnik
// support for std::unordered_xxx
namespace std
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wmismatched-tags"
template <>
struct hash<mapnik::value>
{
size_t operator()(mapnik::value const& val) const
{
return mapnik::mapnik_hash_value(val);
}
};
#pragma GCC diagnostic pop
}
#endif // MAPNIK_VALUE_HPP
|