This file is indexed.

/usr/include/mapnik/transform_expression.hpp is in libmapnik-dev 2.2.0+ds1-7+b2.

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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2012 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_TRANSFORM_EXPRESSION_HPP
#define MAPNIK_TRANSFORM_EXPRESSION_HPP

// mapnik
#include <mapnik/expression_node.hpp>

// boost
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/variant/variant.hpp>

// fusion
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/vector.hpp>

// stl
#include <vector>

namespace mapnik {

struct identity_node {};

struct matrix_node
{
    expr_node a_;
    expr_node b_;
    expr_node c_;
    expr_node d_;
    expr_node e_;
    expr_node f_;

    explicit matrix_node(double const* m)
        : a_(m[0]), b_(m[1]), c_(m[2]), d_(m[3]), e_(m[4]), f_(m[5]) {}

    template <typename T>
    explicit matrix_node(T const& m)
        : a_(m.sx), b_(m.shy), c_(m.shx), d_(m.sy), e_(m.tx), f_(m.ty) {}

    matrix_node(expr_node const& a, expr_node const& b, expr_node const& c,
                expr_node const& d, expr_node const& e, expr_node const& f)
        : a_(a), b_(b), c_(c), d_(d), e_(e), f_(f) {}
};

struct translate_node
{
    expr_node tx_;
    expr_node ty_;

    translate_node(expr_node const& tx,
                   boost::optional<expr_node> const& ty)
        : tx_(tx)
        , ty_(ty ? expr_node(*ty) : value_null()) {}
};

struct scale_node
{
    expr_node sx_;
    expr_node sy_;

    scale_node(expr_node const& sx,
               boost::optional<expr_node> const& sy)
        : sx_(sx)
        , sy_(sy ? expr_node(*sy) : value_null()) {}
};

struct rotate_node
{
    typedef boost::fusion::vector2<expr_node, expr_node> coords_type;

    expr_node angle_;
    expr_node cx_;
    expr_node cy_;

    explicit rotate_node(expr_node const& angle)
        : angle_(angle) {}

    rotate_node(expr_node const& angle,
                expr_node const& cx, expr_node const& cy)
        : angle_(angle), cx_(cx), cy_(cy) {}

    rotate_node(expr_node const& angle,
                boost::optional<expr_node> const& cx,
                boost::optional<expr_node> const& cy)
        : angle_(angle)
        , cx_(cx ? expr_node(*cx) : value_null())
        , cy_(cy ? expr_node(*cy) : value_null()) {}

    rotate_node(expr_node const& angle,
                boost::optional<coords_type> const& center)
      : angle_(angle)
    {
        if (center)
        {
            cx_ = boost::fusion::at_c<0>(*center);
            cy_ = boost::fusion::at_c<1>(*center);
        }
    }
};

struct skewX_node
{
    expr_node angle_;

    explicit skewX_node(expr_node const& angle)
        : angle_(angle) {}
};

struct skewY_node
{
    expr_node angle_;

    explicit skewY_node(expr_node const& angle)
        : angle_(angle) {}
};

namespace detail {

// boost::spirit::traits::clear<T>(T& val) [with T = boost::variant<...>]
// attempts to assign to the variant's current value a default-constructed
// value of the same type, which not only requires that each value-type is
// default-constructible, but also makes little sense with our variant of
// transform nodes...

typedef boost::variant< identity_node
                        , matrix_node
                        , translate_node
                        , scale_node
                        , rotate_node
                        , skewX_node
                        , skewY_node
                        > transform_variant;

// ... thus we wrap the variant-type in a distinct type and provide
// a custom clear overload, which resets the value to identity_node

struct transform_node
{
    transform_variant base_;

    transform_node()
        : base_() {}

    template <typename T>
    transform_node(T const& val)
        : base_(val) {}

    template <typename T>
    transform_node& operator= (T const& val)
    {
        base_ = val;
        return *this;
    }

    transform_variant const& operator* () const
    {
        return base_;
    }

    transform_variant& operator* ()
    {
        return base_;
    }
};

inline void clear(transform_node& val)
{
    val.base_ = identity_node();
}

} // namespace detail

typedef detail::transform_node              transform_node;
typedef std::vector<transform_node>         transform_list;
typedef boost::shared_ptr<transform_list>   transform_list_ptr;

MAPNIK_DECL std::string to_expression_string(transform_node const& node);
MAPNIK_DECL std::string to_expression_string(transform_list const& list);

} // namespace mapnik

#endif // MAPNIK_TRANSFORM_EXPRESSION_HPP